@@ -1485,20 +1485,12 @@ btr_search_build_page_hash_index(
1485
1485
1486
1486
btr_search_check_free_space_in_heap (index);
1487
1487
1488
- hash_table_t * table = btr_get_search_table (index);
1489
1488
rw_lock_x_lock (ahi_latch);
1490
1489
1491
1490
if (!btr_search_enabled) {
1492
1491
goto exit_func;
1493
1492
}
1494
1493
1495
- table = btr_get_search_table (index);
1496
- if (block->index && ((block->curr_n_fields != n_fields)
1497
- || (block->curr_n_bytes != n_bytes)
1498
- || (block->curr_left_side != left_side))) {
1499
- goto exit_func;
1500
- }
1501
-
1502
1494
/* This counter is decremented every time we drop page
1503
1495
hash index entries and is incremented here. Since we can
1504
1496
rebuild hash index for a page that is already hashed, we
@@ -1507,6 +1499,10 @@ btr_search_build_page_hash_index(
1507
1499
if (!block->index ) {
1508
1500
assert_block_ahi_empty (block);
1509
1501
index->search_info ->ref_count ++;
1502
+ } else if (block->curr_n_fields != n_fields
1503
+ || block->curr_n_bytes != n_bytes
1504
+ || block->curr_left_side != left_side) {
1505
+ goto exit_func;
1510
1506
}
1511
1507
1512
1508
block->n_hash_helps = 0 ;
@@ -1516,9 +1512,11 @@ btr_search_build_page_hash_index(
1516
1512
block->curr_left_side = unsigned (left_side);
1517
1513
block->index = index;
1518
1514
1519
- for (i = 0 ; i < n_cached; i++) {
1520
-
1521
- ha_insert_for_fold (table, folds[i], block, recs[i]);
1515
+ {
1516
+ hash_table_t * table = btr_get_search_table (index);
1517
+ for (i = 0 ; i < n_cached; i++) {
1518
+ ha_insert_for_fold (table, folds[i], block, recs[i]);
1519
+ }
1522
1520
}
1523
1521
1524
1522
MONITOR_INC (MONITOR_ADAPTIVE_HASH_PAGE_ADDED);
0 commit comments