Skip to content

Commit 06e5f28

Browse files
committed
MDEV-12266: Remove a level of pointer indirection
Replace table->space->id with table->space_id.
1 parent 0c69f2e commit 06e5f28

24 files changed

+90
-89
lines changed

storage/innobase/btr/btr0btr.cc

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ btr_root_block_get(
225225
}
226226

227227
buf_block_t* block = btr_block_get(
228-
page_id_t(index->table->space->id, index->page),
228+
page_id_t(index->table->space_id, index->page),
229229
page_size_t(index->table->space->flags), mode,
230230
index, mtr);
231231

@@ -250,9 +250,9 @@ btr_root_block_get(
250250
const page_t* root = buf_block_get_frame(block);
251251

252252
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
253-
+ root, index->table->space->id));
253+
+ root, index->table->space_id));
254254
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
255-
+ root, index->table->space->id));
255+
+ root, index->table->space_id));
256256
}
257257
#endif /* UNIV_BTR_DEBUG */
258258

@@ -363,7 +363,7 @@ btr_root_adjust_on_import(
363363
buf_block_t* block;
364364
page_zip_des_t* page_zip;
365365
dict_table_t* table = index->table;
366-
const page_id_t page_id(table->space->id, index->page);
366+
const page_id_t page_id(table->space_id, index->page);
367367
const page_size_t page_size(table->space->flags);
368368

369369
DBUG_EXECUTE_IF("ib_import_trigger_corruption_3",
@@ -405,10 +405,10 @@ btr_root_adjust_on_import(
405405
if (err == DB_SUCCESS
406406
&& (!btr_root_fseg_adjust_on_import(
407407
FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
408-
+ page, page_zip, table->space->id, &mtr)
408+
+ page, page_zip, table->space_id, &mtr)
409409
|| !btr_root_fseg_adjust_on_import(
410410
FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
411-
+ page, page_zip, table->space->id, &mtr))) {
411+
+ page, page_zip, table->space_id, &mtr))) {
412412

413413
err = DB_CORRUPTION;
414414
}
@@ -474,7 +474,7 @@ btr_page_alloc_for_ibuf(
474474
ut_a(node_addr.page != FIL_NULL);
475475

476476
new_block = buf_page_get(
477-
page_id_t(index->table->space->id, node_addr.page),
477+
page_id_t(index->table->space_id, node_addr.page),
478478
page_size_t(index->table->space->flags),
479479
RW_X_LATCH, mtr);
480480

@@ -923,11 +923,11 @@ btr_node_ptr_get_child(
923923
mtr_t* mtr) /*!< in: mtr */
924924
{
925925
ut_ad(rec_offs_validate(node_ptr, index, offsets));
926-
ut_ad(index->table->space->id
926+
ut_ad(index->table->space_id
927927
== page_get_space_id(page_align(node_ptr)));
928928

929929
return btr_block_get(
930-
page_id_t(index->table->space->id,
930+
page_id_t(index->table->space_id,
931931
btr_node_ptr_get_child_page_no(node_ptr, offsets)),
932932
page_size_t(index->table->space->flags),
933933
RW_SX_LATCH, index, mtr);
@@ -1472,7 +1472,7 @@ btr_read_autoinc(dict_index_t* index)
14721472
mtr.start();
14731473
ib_uint64_t autoinc;
14741474
if (buf_block_t* block = buf_page_get(
1475-
page_id_t(index->table->space->id, index->page),
1475+
page_id_t(index->table->space_id, index->page),
14761476
page_size_t(index->table->space->flags),
14771477
RW_S_LATCH, &mtr)) {
14781478
autoinc = page_get_autoinc(block->frame);
@@ -1504,7 +1504,7 @@ btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no)
15041504
mtr_t mtr;
15051505
mtr.start();
15061506
buf_block_t* block = buf_page_get(
1507-
page_id_t(index->table->space->id, index->page),
1507+
page_id_t(index->table->space_id, index->page),
15081508
page_size_t(index->table->space->flags),
15091509
RW_S_LATCH, &mtr);
15101510

@@ -1979,7 +1979,7 @@ btr_root_raise_and_insert(
19791979
#endif /* UNIV_ZIP_DEBUG */
19801980
#ifdef UNIV_BTR_DEBUG
19811981
if (!dict_index_is_ibuf(index)) {
1982-
ulint space = index->table->space->id;
1982+
ulint space = index->table->space_id;
19831983

19841984
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
19851985
+ root, space));
@@ -3906,7 +3906,7 @@ btr_compress(
39063906
btr_search_drop_page_hash_index(block);
39073907

39083908
/* Remove the page from the level list */
3909-
btr_level_list_remove(index->table->space->id,
3909+
btr_level_list_remove(index->table->space_id,
39103910
page_size, page, index, mtr);
39113911

39123912
if (dict_index_is_spatial(index)) {
@@ -4036,7 +4036,7 @@ btr_compress(
40364036
#endif /* UNIV_BTR_DEBUG */
40374037

40384038
/* Remove the page from the level list */
4039-
btr_level_list_remove(index->table->space->id,
4039+
btr_level_list_remove(index->table->space_id,
40404040
page_size, page, index, mtr);
40414041

40424042
ut_ad(btr_node_ptr_get_child_page_no(
@@ -4276,7 +4276,7 @@ btr_discard_only_page_on_level(
42764276
#ifdef UNIV_BTR_DEBUG
42774277
if (!dict_index_is_ibuf(index)) {
42784278
const page_t* root = buf_block_get_frame(block);
4279-
const ulint space = index->table->space->id;
4279+
const ulint space = index->table->space_id;
42804280
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
42814281
+ root, space));
42824282
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
@@ -4357,7 +4357,7 @@ btr_discard_page(
43574357

43584358
if (left_page_no != FIL_NULL) {
43594359
merge_block = btr_block_get(
4360-
page_id_t(index->table->space->id, left_page_no),
4360+
page_id_t(index->table->space_id, left_page_no),
43614361
page_size, RW_X_LATCH, index, mtr);
43624362

43634363
merge_page = buf_block_get_frame(merge_block);
@@ -4373,7 +4373,7 @@ btr_discard_page(
43734373
== btr_cur_get_rec(&parent_cursor)));
43744374
} else if (right_page_no != FIL_NULL) {
43754375
merge_block = btr_block_get(
4376-
page_id_t(index->table->space->id, right_page_no),
4376+
page_id_t(index->table->space_id, right_page_no),
43774377
page_size, RW_X_LATCH, index, mtr);
43784378

43794379
merge_page = buf_block_get_frame(merge_block);
@@ -4422,7 +4422,7 @@ btr_discard_page(
44224422
}
44234423

44244424
/* Remove the page from the level list */
4425-
btr_level_list_remove(index->table->space->id, page_size,
4425+
btr_level_list_remove(index->table->space_id, page_size,
44264426
page, index, mtr);
44274427

44284428
#ifdef UNIV_ZIP_DEBUG
@@ -4979,7 +4979,7 @@ btr_validate_level(
49794979
ret = false;
49804980
}
49814981

4982-
ut_a(index->table->space->id == block->page.id.space());
4982+
ut_a(index->table->space_id == block->page.id.space());
49834983
ut_a(block->page.id.space() == page_get_space_id(page));
49844984
#ifdef UNIV_ZIP_DEBUG
49854985
page_zip = buf_block_get_page_zip(block);
@@ -5016,7 +5016,7 @@ btr_validate_level(
50165016

50175017
savepoint2 = mtr_set_savepoint(&mtr);
50185018
block = btr_block_get(
5019-
page_id_t(index->table->space->id,
5019+
page_id_t(index->table->space_id,
50205020
left_page_no),
50215021
table_page_size,
50225022
RW_SX_LATCH, index, &mtr);
@@ -5045,7 +5045,7 @@ btr_validate_level(
50455045
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
50465046
#endif /* UNIV_ZIP_DEBUG */
50475047

5048-
ut_a(block->page.id.space() == index->table->space->id);
5048+
ut_a(block->page.id.space() == index->table->space_id);
50495049

50505050
if (fseg_page_is_free(space, block->page.id.page_no())) {
50515051

@@ -5088,7 +5088,7 @@ btr_validate_level(
50885088
savepoint = mtr_set_savepoint(&mtr);
50895089

50905090
right_block = btr_block_get(
5091-
page_id_t(index->table->space->id, right_page_no),
5091+
page_id_t(index->table->space_id, right_page_no),
50925092
table_page_size,
50935093
RW_SX_LATCH, index, &mtr);
50945094

@@ -5265,13 +5265,13 @@ btr_validate_level(
52655265
&mtr, savepoint, right_block);
52665266

52675267
btr_block_get(
5268-
page_id_t(index->table->space->id,
5268+
page_id_t(index->table->space_id,
52695269
parent_right_page_no),
52705270
table_page_size,
52715271
RW_SX_LATCH, index, &mtr);
52725272

52735273
right_block = btr_block_get(
5274-
page_id_t(index->table->space->id,
5274+
page_id_t(index->table->space_id,
52755275
right_page_no),
52765276
table_page_size,
52775277
RW_SX_LATCH, index, &mtr);
@@ -5349,22 +5349,22 @@ btr_validate_level(
53495349
if (parent_right_page_no != FIL_NULL) {
53505350
btr_block_get(
53515351
page_id_t(
5352-
index->table->space->id,
5352+
index->table->space_id,
53535353
parent_right_page_no),
53545354
table_page_size,
53555355
RW_SX_LATCH, index, &mtr);
53565356
}
53575357
} else if (parent_page_no != FIL_NULL) {
53585358
btr_block_get(
5359-
page_id_t(index->table->space->id,
5359+
page_id_t(index->table->space_id,
53605360
parent_page_no),
53615361
table_page_size,
53625362
RW_SX_LATCH, index, &mtr);
53635363
}
53645364
}
53655365

53665366
block = btr_block_get(
5367-
page_id_t(index->table->space->id, right_page_no),
5367+
page_id_t(index->table->space_id, right_page_no),
53685368
table_page_size,
53695369
RW_SX_LATCH, index, &mtr);
53705370

@@ -5510,7 +5510,7 @@ btr_can_merge_with_page(
55105510
index = btr_cur_get_index(cursor);
55115511
page = btr_cur_get_page(cursor);
55125512

5513-
const page_id_t page_id(index->table->space->id, page_no);
5513+
const page_id_t page_id(index->table->space_id, page_no);
55145514
const page_size_t page_size(index->table->space->flags);
55155515

55165516
mblock = btr_block_get(page_id, page_size, RW_X_LATCH, index, mtr);

storage/innobase/btr/btr0bulk.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ PageBulk::init()
120120
}
121121
} else {
122122
new_block = btr_block_get(
123-
page_id_t(m_index->table->space->id, m_page_no),
123+
page_id_t(m_index->table->space_id, m_page_no),
124124
page_size_t(m_index->table->space->flags),
125125
RW_X_LATCH, m_index, &m_mtr);
126126

@@ -663,7 +663,7 @@ PageBulk::latch()
663663
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
664664
__FILE__, __LINE__, &m_mtr)) {
665665
m_block = buf_page_get_gen(
666-
page_id_t(m_index->table->space->id, m_page_no),
666+
page_id_t(m_index->table->space_id, m_page_no),
667667
page_size_t(m_index->table->space->flags),
668668
RW_X_LATCH, m_block, BUF_GET_IF_IN_POOL,
669669
__FILE__, __LINE__, &m_mtr, &m_err);
@@ -1015,7 +1015,7 @@ BtrBulk::finish(dberr_t err)
10151015

10161016
ut_ad(last_page_no != FIL_NULL);
10171017
last_block = btr_block_get(
1018-
page_id_t(m_index->table->space->id, last_page_no),
1018+
page_id_t(m_index->table->space_id, last_page_no),
10191019
page_size_t(m_index->table->space->flags),
10201020
RW_X_LATCH, m_index, &mtr);
10211021
first_rec = page_rec_get_next(

storage/innobase/btr/btr0cur.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ btr_cur_optimistic_latch_leaves(
667667

668668
if (left_page_no != FIL_NULL) {
669669
cursor->left_block = btr_block_get(
670-
page_id_t(cursor->index->table->space->id,
670+
page_id_t(cursor->index->table->space_id,
671671
left_page_no),
672672
page_size_t(cursor->index->table->space
673673
->flags),
@@ -1346,7 +1346,7 @@ btr_cur_search_to_nth_level_func(
13461346
const page_size_t page_size(index->table->space->flags);
13471347

13481348
/* Start with the root page. */
1349-
page_id_t page_id(index->table->space->id, index->page);
1349+
page_id_t page_id(index->table->space_id, index->page);
13501350

13511351
if (root_leaf_rw_latch == RW_X_LATCH) {
13521352
node_ptr_max_size = btr_node_ptr_max_size(index);
@@ -2453,7 +2453,7 @@ btr_cur_open_at_index_side_func(
24532453
page_cursor = btr_cur_get_page_cur(cursor);
24542454
cursor->index = index;
24552455

2456-
page_id_t page_id(index->table->space->id, index->page);
2456+
page_id_t page_id(index->table->space_id, index->page);
24572457
const page_size_t page_size(index->table->space->flags);
24582458

24592459
if (root_leaf_rw_latch == RW_X_LATCH) {
@@ -2810,7 +2810,7 @@ btr_cur_open_at_rnd_pos_func(
28102810
page_cursor = btr_cur_get_page_cur(cursor);
28112811
cursor->index = index;
28122812

2813-
page_id_t page_id(index->table->space->id, index->page);
2813+
page_id_t page_id(index->table->space_id, index->page);
28142814
const page_size_t page_size(index->table->space->flags);
28152815
dberr_t err = DB_SUCCESS;
28162816

@@ -7185,7 +7185,7 @@ struct btr_blob_log_check_t {
71857185
if (m_op == BTR_STORE_INSERT_BULK) {
71867186
mtr_x_lock(dict_index_get_lock(index), m_mtr);
71877187
m_pcur->btr_cur.page_cur.block = btr_block_get(
7188-
page_id_t(index->table->space->id, page_no),
7188+
page_id_t(index->table->space_id, page_no),
71897189
page_size_t(index->table->space->flags),
71907190
RW_X_LATCH, index, m_mtr);
71917191
m_pcur->btr_cur.page_cur.rec
@@ -7789,6 +7789,7 @@ btr_free_externally_stored_field(
77897789
& ~((BTR_EXTERN_OWNER_FLAG
77907790
| BTR_EXTERN_INHERITED_FLAG) << 24)));
77917791
ut_ad(space_id == index->table->space->id);
7792+
ut_ad(space_id == index->table->space_id);
77927793

77937794
const page_size_t ext_page_size(dict_table_page_size(index->table));
77947795
const page_size_t& rec_page_size(rec == NULL

storage/innobase/btr/btr0defragment.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ btr_defragment_add_index(
166166
mtr_start(&mtr);
167167
// Load index rood page.
168168
buf_block_t* block = btr_block_get(
169-
page_id_t(index->table->space->id, index->page),
169+
page_id_t(index->table->space_id, index->page),
170170
page_size_t(index->table->space->flags),
171171
RW_NO_LATCH, index, &mtr);
172172
page_t* page = NULL;
@@ -314,7 +314,7 @@ btr_defragment_save_defrag_stats_if_needed(
314314
dict_index_t* index) /*!< in: index */
315315
{
316316
if (srv_defragment_stats_accuracy != 0 // stats tracking disabled
317-
&& index->table->space->id != 0 // do not track system tables
317+
&& index->table->space_id != 0 // do not track system tables
318318
&& index->stat_defrag_modified_counter
319319
>= srv_defragment_stats_accuracy) {
320320
dict_stats_defrag_pool_add(index);
@@ -489,7 +489,7 @@ btr_defragment_merge_pages(
489489
from_block);
490490
btr_search_drop_page_hash_index(from_block);
491491
btr_level_list_remove(
492-
index->table->space->id,
492+
index->table->space_id,
493493
page_size, from_page, index, mtr);
494494
btr_node_ptr_delete(index, from_block, mtr);
495495
/* btr_blob_dbg_remove(from_page, index,
@@ -564,7 +564,7 @@ btr_defragment_n_pages(
564564
return NULL;
565565
}
566566

567-
if (!index->table->space || !index->table->space->id) {
567+
if (!index->table->space || !index->table->space_id) {
568568
/* Ignore space 0. */
569569
return NULL;
570570
}
@@ -589,7 +589,7 @@ btr_defragment_n_pages(
589589
break;
590590
}
591591

592-
blocks[i] = btr_block_get(page_id_t(index->table->space->id,
592+
blocks[i] = btr_block_get(page_id_t(index->table->space_id,
593593
page_no), page_size,
594594
RW_X_LATCH, index, mtr);
595595
}

storage/innobase/btr/btr0scrub.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,14 @@ btr_pessimistic_scrub(
450450
mtr->release_block_at_savepoint(scrub_data->savepoint, block);
451451

452452
buf_block_t* get_block __attribute__((unused)) = btr_block_get(
453-
page_id_t(index->table->space->id, left_page_no),
453+
page_id_t(index->table->space_id, left_page_no),
454454
page_size, RW_X_LATCH, index, mtr);
455455

456456
/**
457457
* Refetch block and re-initialize page
458458
*/
459459
block = btr_block_get(
460-
page_id_t(index->table->space->id, page_no),
460+
page_id_t(index->table->space_id, page_no),
461461
page_size, RW_X_LATCH, index, mtr);
462462

463463
page = buf_block_get_frame(block);
@@ -471,7 +471,7 @@ btr_pessimistic_scrub(
471471

472472
if (right_page_no != FIL_NULL) {
473473
buf_block_t* get_block __attribute__((unused))= btr_block_get(
474-
page_id_t(index->table->space->id, right_page_no),
474+
page_id_t(index->table->space_id, right_page_no),
475475
page_size, RW_X_LATCH, index, mtr);
476476
}
477477

@@ -787,7 +787,7 @@ btr_scrub_page(
787787
/* check that table/index still match now that they are loaded */
788788

789789
if (!scrub_data->current_table->space
790-
|| scrub_data->current_table->space->id != scrub_data->space) {
790+
|| scrub_data->current_table->space_id != scrub_data->space) {
791791
/* this is truncate table */
792792
mtr_commit(mtr);
793793
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;

0 commit comments

Comments
 (0)