summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-05-07 17:23:07 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-07 07:44:10 +0000
commitcbf70774536feb06cb43347bf6aa0c2a128e61d1 (patch)
treede8fca4a7bedbaf703e5f514767db45e48654ae0
parentd333fb9aebf6ec653cce01c8db491de0e0def89c (diff)
downloadmongo-cbf70774536feb06cb43347bf6aa0c2a128e61d1.tar.gz
Import wiredtiger: 20de274ac6114b15f07ee4c628714ed513a27af9 from branch mongodb-5.0
ref: d7625c36a8..20de274ac6 for: 5.0.0 WT-7489 Avoid running RTS concurrently with checkpoint
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c54
2 files changed, 29 insertions, 27 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 1f4eaf71e59..069a78f1b08 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": "d7625c36a8e62af4b6f668054a18b9a8a50da6df"
+ "commit": "20de274ac6114b15f07ee4c628714ed513a27af9"
}
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 018a42a71f1..de2ff910072 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
@@ -1590,39 +1590,58 @@ err:
* Rollback all modifications with timestamps more recent than the passed in timestamp.
*/
static int
-__rollback_to_stable(WT_SESSION_IMPL *session)
+__rollback_to_stable(WT_SESSION_IMPL *session, bool no_ckpt)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
+ WT_TXN_GLOBAL *txn_global;
conn = S2C(session);
+ txn_global = &conn->txn_global;
+
+ /*
+ * Rollback to stable should ignore tombstones in the history store since it needs to scan the
+ * entire table sequentially.
+ */
+ F_SET(session, WT_SESSION_ROLLBACK_TO_STABLE);
- WT_RET(__rollback_to_stable_check(session));
+ WT_ERR(__rollback_to_stable_check(session));
/*
* Allocate a non-durable btree bitstring. We increment the global value before using it, so the
* current value is already in use, and hence we need to add one here.
*/
conn->stable_rollback_maxfile = conn->next_file_id + 1;
- WT_WITH_SCHEMA_LOCK(session, ret = __rollback_to_stable_btree_apply(session));
+ WT_ERR(__rollback_to_stable_btree_apply(session));
+ /* Rollback the global durable timestamp to the stable timestamp. */
+ txn_global->has_durable_timestamp = txn_global->has_stable_timestamp;
+ txn_global->durable_timestamp = txn_global->stable_timestamp;
+
+ /*
+ * If the configuration is not in-memory, forcibly log a checkpoint after rollback to stable to
+ * ensure that both in-memory and on-disk versions are the same unless caller requested for no
+ * checkpoint.
+ */
+ if (!F_ISSET(conn, WT_CONN_IN_MEMORY) && !no_ckpt)
+ WT_ERR(session->iface.checkpoint(&session->iface, "force=1"));
+
+err:
+ F_CLR(session, WT_SESSION_ROLLBACK_TO_STABLE);
return (ret);
}
/*
* __wt_rollback_to_stable --
- * Rollback all modifications with timestamps more recent than the passed in timestamp.
+ * Rollback the database to the stable timestamp.
*/
int
__wt_rollback_to_stable(WT_SESSION_IMPL *session, const char *cfg[], bool no_ckpt)
{
WT_DECL_RET;
- WT_TXN_GLOBAL *txn_global;
WT_UNUSED(cfg);
- txn_global = &S2C(session)->txn_global;
-
/*
* Don't use the connection's default session: we are working on data handles and (a) don't want
* to cache all of them forever, plus (b) can't guarantee that no other method will be called
@@ -1632,28 +1651,11 @@ __wt_rollback_to_stable(WT_SESSION_IMPL *session, const char *cfg[], bool no_ckp
WT_RET(__wt_open_internal_session(S2C(session), "txn rollback_to_stable", true,
F_MASK(session, WT_SESSION_NO_LOGGING), 0, &session));
- /*
- * Rollback to stable should ignore tombstones in the history store since it needs to scan the
- * entire table sequentially.
- */
WT_STAT_CONN_SET(session, txn_rollback_to_stable_running, 1);
- F_SET(session, WT_SESSION_ROLLBACK_TO_STABLE);
- ret = __rollback_to_stable(session);
- F_CLR(session, WT_SESSION_ROLLBACK_TO_STABLE);
+ WT_WITH_CHECKPOINT_LOCK(
+ session, WT_WITH_SCHEMA_LOCK(session, ret = __rollback_to_stable(session, no_ckpt)));
WT_STAT_CONN_SET(session, txn_rollback_to_stable_running, 0);
- WT_RET(ret);
- /* Rollback the global durable timestamp to the stable timestamp. */
- txn_global->has_durable_timestamp = txn_global->has_stable_timestamp;
- txn_global->durable_timestamp = txn_global->stable_timestamp;
-
- /*
- * If the configuration is not in-memory, forcibly log a checkpoint after rollback to stable to
- * ensure that both in-memory and on-disk versions are the same unless caller requested for no
- * checkpoint.
- */
- if (!F_ISSET(S2C(session), WT_CONN_IN_MEMORY) && !no_ckpt)
- WT_TRET(session->iface.checkpoint(&session->iface, "force=1"));
WT_TRET(__wt_session_close_internal(session));
return (ret);