diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-11-10 16:12:45 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-11-10 16:12:45 +0200 |
commit | a48aa0cd569eda88bef98ed4abe41b0b570fcd51 (patch) | |
tree | 6008b19aabfe0554432c87614d1022594f08fc5f /storage/innobase/ibuf | |
parent | 8409f721ffe2d91b11d3fc03c6872ff57051bbf8 (diff) | |
parent | 386e5d476e9bf8f216c760c9076ae0ecdc99054d (diff) | |
download | mariadb-git-a48aa0cd569eda88bef98ed4abe41b0b570fcd51.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'storage/innobase/ibuf')
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index c276a4ce137..b0d9ccbde7d 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4964,21 +4964,36 @@ ibuf_check_bitmap_on_import( const trx_t* trx, /*!< in: transaction */ ulint space_id) /*!< in: tablespace identifier */ { - ulint size; ulint page_no; ut_ad(space_id); ut_ad(trx->mysql_thd); - bool found; - const page_size_t& page_size - = fil_space_get_page_size(space_id, &found); - - if (!found) { + FilSpace space(space_id); + if (!space()) { return(DB_TABLE_NOT_FOUND); } - size = fil_space_get_size(space_id); + const page_size_t page_size(space->flags); + /* fil_space_t::size and fil_space_t::free_limit would still be 0 + at this point. So, we will have to read page 0. */ + ut_ad(!space->free_limit); + ut_ad(!space->size); + + mtr_t mtr; + ulint size; + mtr.start(); + if (buf_block_t* sp = buf_page_get(page_id_t(space_id, 0), page_size, + RW_S_LATCH, &mtr)) { + size = std::min( + mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + sp->frame), + mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + sp->frame)); + } else { + size = 0; + } + mtr.commit(); if (size == 0) { return(DB_TABLE_NOT_FOUND); @@ -4993,7 +5008,6 @@ ibuf_check_bitmap_on_import( the space, as usual. */ for (page_no = 0; page_no < size; page_no += page_size.physical()) { - mtr_t mtr; page_t* bitmap_page; ulint i; |