31
31
#define WT_REC_CHECKPOINT_RUNNING 0x008u
32
32
#define WT_REC_CLEAN_AFTER_REC 0x010u
33
33
#define WT_REC_EVICT 0x020u
34
+ //__evict_reconcile中如果是leaf page设置该标识
34
35
#define WT_REC_HS 0x040u
35
36
#define WT_REC_IN_MEMORY 0x080u
36
37
#define WT_REC_SCRUB 0x100u
@@ -135,7 +136,7 @@ __wt_page_header_byteswap(WT_PAGE_HEADER *dsk)
135
136
* WT_PAGE_HEADER_BYTE_SIZE --
136
137
* The first usable data byte on the block (past the combined headers).
137
138
*/
138
- //page header + block header
139
+ //page header(WT_PAGE_HEADER_SIZE) + block header(WT_BLOCK_HEADER_SIZE)
139
140
#define WT_PAGE_HEADER_BYTE_SIZE (btree ) ((u_int)(WT_PAGE_HEADER_SIZE + (btree)->block_header))
140
141
//dsk开始跳过page header + block header
141
142
#define WT_PAGE_HEADER_BYTE (btree , dsk ) \
@@ -273,7 +274,7 @@ struct __wt_multi {
273
274
/*
274
275
* Block's key: either a column-store record number or a row-store variable length byte string.
275
276
*/
276
- //page拆分后对应的ref key,参考__rec_split_write
277
+ //page拆分后对应的ref key,参考__rec_split_dump_keys的打印,赋值的地方在__rec_split_write
277
278
union {
278
279
uint64_t recno ;
279
280
WT_IKEY * ikey ;
@@ -403,8 +404,10 @@ struct __wt_page_modify {
403
404
uint32_t multi_entries ; /* Multiple blocks element count */
404
405
} m ;
405
406
#undef mod_multi
407
+ //赋值参考__rec_write_wrapup, 一次reconcile结束后,reconcile的multi信息转存到mod->mod_multi中
406
408
#define mod_multi u1.m.multi
407
409
#undef mod_multi_entries
410
+ //赋值参考__rec_write_wrapup,一次reconcile结束后,reconcile的multi信息转存到mod->mod_multi中
408
411
#define mod_multi_entries u1.m.multi_entries
409
412
} u1 ;
410
413
@@ -464,13 +467,17 @@ struct __wt_page_modify {
464
467
WT_INSERT_HEAD * * insert ;
465
468
466
469
/* Updated items for row-stores. */
470
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
467
471
WT_UPDATE * * update ;
468
472
} row_leaf ;
469
473
#undef mod_row_insert
474
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
475
+
470
476
//WT_PAGE_ALLOC_AND_SWAP、__split_insert分配空间
471
477
//WT_ROW_INSERT_SLOT获取对应的跳跃表,实际上insert是个数组,数组每个成员对应一个跳跃表,参考__wt_leaf_page_can_split
472
478
#define mod_row_insert u2.row_leaf.insert
473
479
#undef mod_row_update
480
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
474
481
#define mod_row_update u2.row_leaf.update
475
482
} u2 ;
476
483
@@ -505,6 +512,7 @@ struct __wt_page_modify {
505
512
* WT_PAGE_DIRTY --
506
513
* Two or more updates have been added to the page.
507
514
*/
515
+ //__wt_page_modify_clear
508
516
#define WT_PAGE_CLEAN 0
509
517
#define WT_PAGE_DIRTY_FIRST 1
510
518
#define WT_PAGE_DIRTY 2
@@ -514,6 +522,7 @@ struct __wt_page_modify {
514
522
#define WT_PM_REC_EMPTY 1 /* Reconciliation: no replacement */
515
523
#define WT_PM_REC_MULTIBLOCK 2 /* Reconciliation: multiple blocks */
516
524
#define WT_PM_REC_REPLACE 3 /* Reconciliation: single block */
525
+ //复制参考__rec_write_wrapup
517
526
uint8_t rec_result ; /* Reconciliation state */
518
527
519
528
#define WT_PAGE_RS_RESTORED 0x1
@@ -690,6 +699,7 @@ struct __wt_page {
690
699
//指向该page存储的真实数据,见__wt_page_alloc
691
700
WT_ROW * row ; /* Key/value pairs */
692
701
#undef pg_row
702
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
693
703
//指向该page存储的真实数据,见__wt_page_alloc
694
704
#define pg_row u.row
695
705
@@ -1023,6 +1033,7 @@ struct __wt_ref {
1023
1033
* or NULL if page created in-memory.
1024
1034
*/
1025
1035
//数据对应的磁盘地址???????
1036
+ //例如evict reconcile流程中的__wt_multi_to_ref,指向该page对应的磁盘元数据信息
1026
1037
void * addr ;
1027
1038
1028
1039
/*
@@ -1248,6 +1259,7 @@ struct __wt_row { /* On-page key, on-page cell, or off-page WT_IKEY */
1248
1259
* WT_ROW_FOREACH --
1249
1260
* Walk the entries of an in-memory row-store leaf page.
1250
1261
*/
1262
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
1251
1263
#define WT_ROW_FOREACH (page , rip , i ) \
1252
1264
for ((i) = (page)->entries, (rip) = (page)->pg_row; (i) > 0; ++(rip), --(i))
1253
1265
#define WT_ROW_FOREACH_REVERSE (page , rip , i ) \
@@ -1557,6 +1569,7 @@ struct __wt_insert_head {
1557
1569
* following macros return an array entry if the array of pointers and the specific structure exist,
1558
1570
* else NULL.
1559
1571
*/
1572
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
1560
1573
#define WT_ROW_INSERT_SLOT (page , slot ) \
1561
1574
((page)->modify == NULL || (page)->modify->mod_row_insert == NULL ? \
1562
1575
NULL : \
@@ -1571,6 +1584,7 @@ struct __wt_insert_head {
1571
1584
* insert array. That's because the insert array requires an extra slot to hold keys that sort
1572
1585
* before any key found on the original page.
1573
1586
*/
1587
+ //pg_row指向磁盘KV相关数据,mod_row_insert指向内存相关KV数据,mod_row_update记录内存中同一个K的变更过程
1574
1588
#define WT_ROW_INSERT_SMALLEST (page ) \
1575
1589
((page)->modify == NULL || (page)->modify->mod_row_insert == NULL ? \
1576
1590
NULL : \
0 commit comments