Commit 5c2bb5e9 authored by marko's avatar marko

branches/zip: Minor cleanup.

btr_pcur_restore_position(): Add const qualifiers.

buf_LRU_block_remove_hashed_page(): Reduce the amount
of buf_page_hash_get() calls and add a UNIV_UNLIKELY hint
to an assertion-like test.
parent 3356f069
...@@ -252,9 +252,9 @@ btr_pcur_restore_position( ...@@ -252,9 +252,9 @@ btr_pcur_restore_position(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (cursor->rel_pos == BTR_PCUR_ON) { if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
rec_t* rec; const rec_t* rec;
ulint* offsets1; const ulint* offsets1;
ulint* offsets2; const ulint* offsets2;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
......
...@@ -899,6 +899,7 @@ buf_LRU_block_remove_hashed_page( ...@@ -899,6 +899,7 @@ buf_LRU_block_remove_hashed_page(
be in a state where it can be freed; there be in a state where it can be freed; there
may or may not be a hash index to the page */ may or may not be a hash index to the page */
{ {
const buf_block_t* hashed_block;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -917,22 +918,21 @@ buf_LRU_block_remove_hashed_page( ...@@ -917,22 +918,21 @@ buf_LRU_block_remove_hashed_page(
buf_block_modify_clock_inc(block); buf_block_modify_clock_inc(block);
if (block != buf_page_hash_get(block->space, block->offset)) { hashed_block = buf_page_hash_get(block->space, block->offset);
if (UNIV_UNLIKELY(block != hashed_block)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page %lu %lu not found" "InnoDB: Error: page %lu %lu not found"
" in the hash table\n", " in the hash table\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
if (buf_page_hash_get(block->space, block->offset)) { if (hashed_block) {
fprintf(stderr, fprintf(stderr,
"InnoDB: In hash table we find block" "InnoDB: In hash table we find block"
" %p of %lu %lu which is not %p\n", " %p of %lu %lu which is not %p\n",
(void*) buf_page_hash_get( (const void*) hashed_block,
block->space, block->offset), (ulong) hashed_block->space,
(ulong) buf_page_hash_get( (ulong) hashed_block->offset,
block->space, block->offset)->space,
(ulong) buf_page_hash_get(
block->space, block->offset)->offset,
(void*) block); (void*) block);
} }
...@@ -942,7 +942,7 @@ buf_LRU_block_remove_hashed_page( ...@@ -942,7 +942,7 @@ buf_LRU_block_remove_hashed_page(
buf_validate(); buf_validate();
buf_LRU_validate(); buf_LRU_validate();
#endif #endif
ut_a(0); ut_error;
} }
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash, HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment