summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/buf/buf0buf.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index e187297b231..7ab6fc61920 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -3938,14 +3938,17 @@ buf_block_from_ahi(const byte* ptr)
ut_ad(buf_chunk_map_ref == buf_chunk_map_reg);
ut_ad(!buf_pool_resizing);
- const byte* bound = reinterpret_cast<uintptr_t>(ptr)
- > srv_buf_pool_chunk_unit
- ? ptr - srv_buf_pool_chunk_unit : 0;
- it = chunk_map->upper_bound(bound);
+ buf_chunk_t* chunk;
+ it = chunk_map->upper_bound(ptr);
+
+ ut_a(it != chunk_map->begin());
- ut_a(it != chunk_map->end());
+ if (it == chunk_map->end()) {
+ chunk = chunk_map->rbegin()->second;
+ } else {
+ chunk = (--it)->second;
+ }
- buf_chunk_t* chunk = it->second;
ulint offs = ptr - chunk->blocks->frame;
offs >>= UNIV_PAGE_SIZE_SHIFT;