diff options
author | Luke Chen <luke.chen@mongodb.com> | 2023-01-23 17:34:32 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-23 06:48:37 +0000 |
commit | d0e6f7a9424395038b3cf3080beca371f54b9058 (patch) | |
tree | 9b7db5e2bf04c22ec0341df5e91fd6681a7ba013 | |
parent | bef768721de84f6474096ab70f637df4c975bbb0 (diff) | |
download | mongo-d0e6f7a9424395038b3cf3080beca371f54b9058.tar.gz |
Import wiredtiger: c2114ce2b1c40599892dc244e0fe1b5c35f9e296 from branch mongodb-4.4
ref: 671cb6e1d5..c2114ce2b1
for: 4.4.19
WT-9323 Fix a race tracking whether a tree has updates after a checkpoint
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/btree_inline.h | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 513189c1490..3134840e789 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-4.4", - "commit": "671cb6e1d5617e0f18452e69016830fb2bacba53" + "commit": "c2114ce2b1c40599892dc244e0fe1b5c35f9e296" } diff --git a/src/third_party/wiredtiger/src/include/btree_inline.h b/src/third_party/wiredtiger/src/include/btree_inline.h index 7b9a2b74a5f..8cdc8557155 100644 --- a/src/third_party/wiredtiger/src/include/btree_inline.h +++ b/src/third_party/wiredtiger/src/include/btree_inline.h @@ -679,6 +679,13 @@ __wt_tree_modify_set(WT_SESSION_IMPL *session) S2BT(session)->modified = true; WT_FULL_BARRIER(); + + /* + * There is a potential race where checkpoint walks the tree and marks it as clean before a + * page is subsequently marked as dirty, leaving us with a dirty page on a clean tree. Yield + * here to encourage this scenario and ensure we're handling it correctly. + */ + WT_DIAGNOSTIC_YIELD; } /* @@ -738,6 +745,18 @@ __wt_page_modify_set(WT_SESSION_IMPL *session, WT_PAGE *page) __wt_tree_modify_set(session); __wt_page_only_modify_set(session, page); + + /* + * We need to make sure a checkpoint doesn't come through and mark the tree clean before we have + * a chance to mark the page dirty. Otherwise, the checkpoint may also visit the page before it + * is marked dirty and skip it without also marking the tree clean. Worst case scenario with + * this approach is that a future checkpoint reviews the tree again unnecessarily - however, it + * is likely this is necessary since the update triggering this modify set would not be included + * in the checkpoint. If hypothetically a checkpoint came through after the page was modified + * and before the tree is marked dirty again, that is fine. The transaction installing this + * update wasn't visible to the checkpoint, so it's reasonable for the tree to remain dirty. + */ + __wt_tree_modify_set(session); } /* |