Skip to content

Commit af67844

Browse files
wt-vendoring-bot[bot]MongoDB Bot
authored andcommitted
Import wiredtiger: 716124b6cde14a684a6a3b349f1d0bb896a96b5b from branch mongodb-7.0 (#32184)
GitOrigin-RevId: 2bb9022f868c5114515236fed965a84ad216adb4
1 parent d3b4eab commit af67844

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/third_party/wiredtiger/import.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"vendor": "wiredtiger",
33
"github": "wiredtiger/wiredtiger",
44
"branch": "mongodb-7.0",
5-
"commit": "7bfbedde948aee7a58f325dac6bb3e4b18d5a871"
5+
"commit": "716124b6cde14a684a6a3b349f1d0bb896a96b5b"
66
}

src/third_party/wiredtiger/src/btree/bt_vrfy.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,19 @@ __verify_tree(
536536
* (just created), it won't have a disk image; if there is no disk image, there is no page
537537
* content to check.
538538
*/
539-
if (page->dsk != NULL)
539+
if (page->dsk != NULL) {
540+
/*
541+
* Compare the write generation number on the page to the write generation number on the
542+
* parent. Since a parent page's reconciliation takes place once all of its child pages have
543+
* been completed, the parent page's write generation number must be higher than that of its
544+
* children.
545+
*/
546+
if (!__wt_ref_is_root(ref) && page->dsk->write_gen >= ref->home->dsk->write_gen)
547+
WT_RET_MSG(session, EINVAL,
548+
"child write generation number %" PRIu64
549+
" is greater/equal to the parent page write generation number %" PRIu64,
550+
page->dsk->write_gen, ref->home->dsk->write_gen);
551+
540552
switch (page->type) {
541553
case WT_PAGE_COL_FIX:
542554
WT_RET(__verify_page_content_fix(session, ref, addr_unpack, vs));
@@ -550,6 +562,7 @@ __verify_tree(
550562
WT_RET(__verify_page_content_leaf(session, ref, addr_unpack, vs));
551563
break;
552564
}
565+
}
553566

554567
/* Compare the address type against the page type. */
555568
switch (page->type) {

src/third_party/wiredtiger/src/reconcile/rec_write.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,14 +1899,13 @@ __rec_set_page_write_gen(WT_BTREE *btree, WT_PAGE_HEADER *dsk)
18991899
* it's not as good anyway, because the internal page may not have been written after the leaf
19001900
* page was updated. So, write generations it is.
19011901
*
1902-
* Nothing is locked at this point but two versions of a page with the same generation is pretty
1903-
* unlikely, and if we did, they're going to be roughly identical for the purposes of salvage,
1904-
* anyway.
1902+
* The write generation number should be increased atomically to prevent it from moving backward
1903+
* when it is updated simultaneously.
19051904
*
19061905
* Other than salvage, the write generation number is used to reset the stale transaction id's
19071906
* present on the page upon server restart.
19081907
*/
1909-
dsk->write_gen = ++btree->write_gen;
1908+
dsk->write_gen = __wt_atomic_add64(&btree->write_gen, 1);
19101909
}
19111910

19121911
/*

0 commit comments

Comments
 (0)