diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-10-04 10:11:27 +1100 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-10-04 10:11:27 +1100 |
commit | 213053e190333eecf91556875317a44ac7f283f6 (patch) | |
tree | 25404b2d9224b12ce5288ddbb06d1ce049227143 /src/lsm | |
parent | 17221485164bd2041f0bfba2b9eff6d8a627344c (diff) | |
download | mongo-213053e190333eecf91556875317a44ac7f283f6.tar.gz |
WT-2933 Fix a race between named snapshots and checkpoints. (#3068)
Diffstat (limited to 'src/lsm')
-rw-r--r-- | src/lsm/lsm_cursor.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index e98f59e7b05..b9a6dd18b7a 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -165,8 +165,7 @@ __clsm_enter(WT_CURSOR_LSM *clsm, bool reset, bool update) WT_LSM_TREE *lsm_tree; WT_SESSION_IMPL *session; WT_TXN *txn; - uint64_t *switch_txnp; - uint64_t snap_min; + uint64_t pinned_id, *switchp; lsm_tree = clsm->lsm_tree; session = (WT_SESSION_IMPL *)clsm->iface.session; @@ -226,8 +225,8 @@ __clsm_enter(WT_CURSOR_LSM *clsm, bool reset, bool update) * that overlaps with our snapshot is a potential * conflict. * - * Note that the global snap_min is correct here: it - * tracks concurrent transactions excluding special + * Note that the pinned ID is correct here: it tracks + * concurrent transactions excluding special * transactions such as checkpoint (which we can't * conflict with because checkpoint only writes the * metadata, which is not an LSM tree). @@ -237,17 +236,17 @@ __clsm_enter(WT_CURSOR_LSM *clsm, bool reset, bool update) F_ISSET(clsm, WT_CLSM_OPEN_SNAPSHOT)) { WT_ASSERT(session, F_ISSET(txn, WT_TXN_HAS_SNAPSHOT)); - snap_min = - WT_SESSION_TXN_STATE(session)->snap_min; - for (switch_txnp = + pinned_id = + WT_SESSION_TXN_STATE(session)->pinned_id; + for (switchp = &clsm->switch_txn[clsm->nchunks - 2]; clsm->nupdates < clsm->nchunks; - clsm->nupdates++, switch_txnp--) { - if (WT_TXNID_LT(*switch_txnp, snap_min)) + clsm->nupdates++, switchp--) { + if (WT_TXNID_LT(*switchp, pinned_id)) break; WT_ASSERT(session, !__wt_txn_visible_all( - session, *switch_txnp)); + session, *switchp)); } } } |