diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-10-21 16:23:00 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-21 05:53:12 +0000 |
commit | 3aae86f4bf367f6a86a1f827e3cd43688a0e3ca9 (patch) | |
tree | 3edd437fc7e3e522024ac725a82d9e7c3f3dc260 | |
parent | 7b1e3917a4f1cabeea49c13a441e142023d1581d (diff) | |
download | mongo-3aae86f4bf367f6a86a1f827e3cd43688a0e3ca9.tar.gz |
Import wiredtiger: d9340610d5c44fc315912673d15203b25ce5a80b from branch mongodb-5.0
ref: 9a95edfe23..d9340610d5
for: 5.0.14
WT-9323 Fix a race tracking whether a tree has updates after a checkpoint (#8194) (#8228) (#8356)
-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 860f36beb69..df65ac8b209 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-5.0", - "commit": "9a95edfe238515bfd3186a1fd3a416e6b62905d1" + "commit": "d9340610d5c44fc315912673d15203b25ce5a80b" } diff --git a/src/third_party/wiredtiger/src/include/btree_inline.h b/src/third_party/wiredtiger/src/include/btree_inline.h index a079a133bd1..6bb82f49d94 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); } /* |