@@ -1081,17 +1081,17 @@ void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
1081
1081
mem_heap_free (heap);
1082
1082
}
1083
1083
1084
+ /* * PAGE_INDEX_ID value for freed index B-trees */
1085
+ static const index_id_t BTR_FREED_INDEX_ID = 0 ;
1086
+
1084
1087
/* * Free a B-tree root page. btr_free_but_not_root() must already
1085
1088
have been called.
1086
1089
In a persistent tablespace, the caller must invoke fsp_init_file_page()
1087
1090
before mtr.commit().
1088
- @param[in,out] block index root page
1089
- @param[in,out] mtr mini-transaction */
1090
- static
1091
- void
1092
- btr_free_root (
1093
- buf_block_t * block,
1094
- mtr_t * mtr)
1091
+ @param[in,out] block index root page
1092
+ @param[in,out] mtr mini-transaction
1093
+ @param[in] invalidate whether to invalidate PAGE_INDEX_ID */
1094
+ static void btr_free_root (buf_block_t * block, mtr_t * mtr, bool invalidate)
1095
1095
{
1096
1096
fseg_header_t * header;
1097
1097
@@ -1105,31 +1105,18 @@ btr_free_root(
1105
1105
#ifdef UNIV_BTR_DEBUG
1106
1106
ut_a (btr_root_fseg_validate (header, block->page .id .space ()));
1107
1107
#endif /* UNIV_BTR_DEBUG */
1108
+ if (invalidate) {
1109
+ btr_page_set_index_id (
1110
+ buf_block_get_frame (block),
1111
+ buf_block_get_page_zip (block),
1112
+ BTR_FREED_INDEX_ID, mtr);
1113
+ }
1108
1114
1109
1115
while (!fseg_free_step (header, true , mtr)) {
1110
1116
/* Free the entire segment in small steps. */
1111
1117
}
1112
1118
}
1113
1119
1114
- /* * PAGE_INDEX_ID value for freed index B-trees */
1115
- static const index_id_t BTR_FREED_INDEX_ID = 0 ;
1116
-
1117
- /* * Invalidate an index root page so that btr_free_root_check()
1118
- will not find it.
1119
- @param[in,out] block index root page
1120
- @param[in,out] mtr mini-transaction */
1121
- static
1122
- void
1123
- btr_free_root_invalidate (
1124
- buf_block_t * block,
1125
- mtr_t * mtr)
1126
- {
1127
- btr_page_set_index_id (
1128
- buf_block_get_frame (block),
1129
- buf_block_get_page_zip (block),
1130
- BTR_FREED_INDEX_ID, mtr);
1131
- }
1132
-
1133
1120
/* * Prepare to free a B-tree.
1134
1121
@param[in] page_id page id
1135
1122
@param[in] page_size page size
@@ -1249,11 +1236,8 @@ btr_create(
1249
1236
PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr)) {
1250
1237
/* Not enough space for new segment, free root
1251
1238
segment before return. */
1252
- btr_free_root (block, mtr);
1253
- if (!dict_table_is_temporary (index->table )) {
1254
- btr_free_root_invalidate (block, mtr);
1255
- }
1256
-
1239
+ btr_free_root (block, mtr,
1240
+ !index->table ->is_temporary ());
1257
1241
return (FIL_NULL);
1258
1242
}
1259
1243
@@ -1427,8 +1411,7 @@ btr_free_if_exists(
1427
1411
1428
1412
btr_free_but_not_root (root, mtr->get_log_mode ());
1429
1413
mtr->set_named_space (page_id.space ());
1430
- btr_free_root (root, mtr);
1431
- btr_free_root_invalidate (root, mtr);
1414
+ btr_free_root (root, mtr, true );
1432
1415
}
1433
1416
1434
1417
/* * Free an index tree in a temporary tablespace or during TRUNCATE TABLE.
@@ -1448,7 +1431,7 @@ btr_free(
1448
1431
1449
1432
if (block) {
1450
1433
btr_free_but_not_root (block, MTR_LOG_NO_REDO);
1451
- btr_free_root (block, &mtr);
1434
+ btr_free_root (block, &mtr, false );
1452
1435
}
1453
1436
mtr.commit ();
1454
1437
}
0 commit comments