summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-09-09 16:05:11 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-09 06:34:14 +0000
commit08344712d5b08a44f45694b5e6257097db0d74c5 (patch)
tree09119c947927e2021ffdfe39c6de03e471260cfd
parentbf56db18c0b0783864c61859fc9d8e0218fc60ff (diff)
downloadmongo-08344712d5b08a44f45694b5e6257097db0d74c5.tar.gz
Import wiredtiger: 987bc122e766ff2147e512b05e42a8434ccf1924 from branch mongodb-6.1
ref: 8be0aa4ba3..987bc122e7 for: 6.1.0-rc2 WT-9405 Fix segfault when opening history store cursor during rollback (#8239)
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c26
2 files changed, 21 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 605e8f05e4a..e014839e84e 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-6.1",
- "commit": "8be0aa4ba3878c34dbcd956e12ecc44cba094f30"
+ "commit": "987bc122e766ff2147e512b05e42a8434ccf1924"
}
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
index 444374bda1f..9f980c86029 100644
--- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
+++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
@@ -1634,6 +1634,20 @@ __rollback_progress_msg(WT_SESSION_IMPL *session, struct timespec rollback_start
}
/*
+ * __rollback_to_stable_check_btree_modified --
+ * Check that the rollback to stable btree is modified or not.
+ */
+static int
+__rollback_to_stable_check_btree_modified(WT_SESSION_IMPL *session, const char *uri, bool *modified)
+{
+ WT_DECL_RET;
+
+ ret = __wt_conn_dhandle_find(session, uri, NULL);
+ *modified = ret == 0 && S2BT(session)->modified;
+ return (ret);
+}
+
+/*
* __rollback_to_stable_btree_apply --
* Perform rollback to stable on a single file.
*/
@@ -1649,7 +1663,7 @@ __rollback_to_stable_btree_apply(
uint64_t rollback_txnid, write_gen;
uint32_t btree_id;
char ts_string[2][WT_TS_INT_STRING_SIZE];
- bool dhandle_allocated, durable_ts_found, has_txn_updates_gt_than_ckpt_snap, perform_rts;
+ bool dhandle_allocated, durable_ts_found, has_txn_updates_gt_than_ckpt_snap, modified;
bool prepared_updates;
/* Ignore non-btree objects as well as the metadata and history store files. */
@@ -1738,14 +1752,14 @@ __rollback_to_stable_btree_apply(
* 4. There is no durable timestamp in any checkpoint.
* 5. The checkpoint newest txn is greater than snapshot min txn id.
*/
- WT_WITH_HANDLE_LIST_READ_LOCK(session, (ret = __wt_conn_dhandle_find(session, uri, NULL)));
-
- perform_rts = ret == 0 && S2BT(session)->modified;
+ WT_WITHOUT_DHANDLE(session,
+ WT_WITH_HANDLE_LIST_READ_LOCK(
+ session, (ret = __rollback_to_stable_check_btree_modified(session, uri, &modified))));
WT_ERR_NOTFOUND_OK(ret, false);
- if (perform_rts || max_durable_ts > rollback_timestamp || prepared_updates ||
- !durable_ts_found || has_txn_updates_gt_than_ckpt_snap) {
+ if (modified || max_durable_ts > rollback_timestamp || prepared_updates || !durable_ts_found ||
+ has_txn_updates_gt_than_ckpt_snap) {
/*
* Open a handle; we're potentially opening a lot of handles and there's no reason to cache
* all of them for future unknown use, discard on close.