diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-01-21 16:03:10 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-21 05:33:29 +0000 |
commit | 00ddf9d37a5916bf3626c318258bb05511899742 (patch) | |
tree | 197aab80e7b794a21aa08b8bfdf420ff34154065 /src/third_party | |
parent | aa729eac79f4a193933f8ab273fb2053c5c44004 (diff) | |
download | mongo-00ddf9d37a5916bf3626c318258bb05511899742.tar.gz |
Import wiredtiger: b618dbb622550adea39e79b525f2a06f3101960e from branch mongodb-master
ref: f7869fbf08..b618dbb622
for: 5.3.0
WT-8702 Limit oldest id to recovered checkpoint snapshot in recovery
Diffstat (limited to 'src/third_party')
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn_inline.h | 38 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn.c | 8 |
3 files changed, 24 insertions, 24 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index e8403d8e4cd..d80a4818017 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-master", - "commit": "f7869fbf082261c45cc1d690f25bf3bf5b585aa3" + "commit": "b618dbb622550adea39e79b525f2a06f3101960e" } diff --git a/src/third_party/wiredtiger/src/include/txn_inline.h b/src/third_party/wiredtiger/src/include/txn_inline.h index 684ae459a70..ae964bdf065 100644 --- a/src/third_party/wiredtiger/src/include/txn_inline.h +++ b/src/third_party/wiredtiger/src/include/txn_inline.h @@ -451,10 +451,12 @@ err: static inline uint64_t __wt_txn_oldest_id(WT_SESSION_IMPL *session) { + WT_CONNECTION_IMPL *conn; WT_TXN_GLOBAL *txn_global; - uint64_t checkpoint_pinned, oldest_id; + uint64_t checkpoint_pinned, oldest_id, recovery_ckpt_snap_min; - txn_global = &S2C(session)->txn_global; + conn = S2C(session); + txn_global = &conn->txn_global; /* * The metadata is tracked specially because of optimizations for checkpoints. @@ -474,19 +476,25 @@ __wt_txn_oldest_id(WT_SESSION_IMPL *session) */ WT_READ_BARRIER(); - /* - * Checkpoint transactions often fall behind ordinary application threads. Take special effort - * to not keep changes pinned in cache if they are only required for the checkpoint and it has - * already seen them. - * - * If there is no active checkpoint or this handle is up to date with the active checkpoint then - * it's safe to ignore the checkpoint ID in the visibility check. - */ - checkpoint_pinned = txn_global->checkpoint_txn_shared.pinned_id; - if (checkpoint_pinned == WT_TXN_NONE || WT_TXNID_LT(oldest_id, checkpoint_pinned)) - return (oldest_id); - - return (checkpoint_pinned); + if (!F_ISSET(conn, WT_CONN_RECOVERING)) { + /* + * Checkpoint transactions often fall behind ordinary application threads. If there is an + * active checkpoint, keep changes until checkpoint is finished. + */ + checkpoint_pinned = txn_global->checkpoint_txn_shared.pinned_id; + if (checkpoint_pinned == WT_TXN_NONE || WT_TXNID_LT(oldest_id, checkpoint_pinned)) + return (oldest_id); + return (checkpoint_pinned); + } else { + /* + * Recovered checkpoint snapshot rarely fall behind ordinary application threads. Keep the + * changes until the recovery is finished. + */ + recovery_ckpt_snap_min = conn->recovery_ckpt_snap_min; + if (recovery_ckpt_snap_min == WT_TXN_NONE || WT_TXNID_LT(oldest_id, recovery_ckpt_snap_min)) + return (oldest_id); + return (recovery_ckpt_snap_min); + } } /* diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c index 1875474f30c..a9e8748be23 100644 --- a/src/third_party/wiredtiger/src/txn/txn.c +++ b/src/third_party/wiredtiger/src/txn/txn.c @@ -427,14 +427,6 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, uint32_t flags) prev_metadata_pinned = txn_global->metadata_pinned; prev_oldest_id = txn_global->oldest_id; - /* - * Do not modify the oldest ID during recovery. Modifying the oldest ID during recovery can lead - * to a scenario where the current generation oldest ID leads to wrong global visibility of the - * data whereas it doesn't according to the recovered checkpoint snapshot. - */ - if (F_ISSET(conn, WT_CONN_RECOVERING)) - return (0); - /* Try to move the pinned timestamp forward. */ if (strict) WT_RET(__wt_txn_update_pinned_timestamp(session, false)); |