diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-04-06 16:06:32 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-04-06 16:23:17 +1000 |
commit | b180ec4ad34b40b499cb4c7a2f01508ed639b44b (patch) | |
tree | 87c8fe8e92a19bb0beb69c1c2696e2b3d98aca07 /src/third_party/wiredtiger/src/include/txn.i | |
parent | f728898d2be6b231175c9d64b39d0f072f5d8d18 (diff) | |
download | mongo-b180ec4ad34b40b499cb4c7a2f01508ed639b44b.tar.gz |
Import wiredtiger: ea986ede145b8c2e3da8f8d11ef25813770c0b39 from branch mongodb-3.8
ref: 875e91581c..ea986ede14
for: 3.7.4
WT-3724 Log an error if flushing with F_FULLSYNC fails
WT-3849 Add timestamp validation to WT_SESSION::prepare_transaction
WT-3870 Bi-weekly WT codebase lint
WT-3922 Allow truncate operations to be prepared
WT-3931 cursor.prev split race
WT-3971 Make cursor duplication use cursor caching
WT-3973 Allow alter to modify app_metadata
WT-3981 Make snapshot consistent with read_timestamp
WT-3984 Fix race conditions around prepare state transitions
WT-3996 Test truncate with timestamps and lookaside
WT-3997 The cursor walk code can spin without sleeping on restart/split.
WT-4002 Allow duplicates in api_data.py
WT-4005 AddressSanitizer in __wt_timestamp_iszero().
WT-4007 eviction instantiates pages from dead trees.
WT-4008 Add ARM NEON support for row search operations
WT-4011 Checkpoint should not read truncated pages
WT-4022 Avoid WT_RESTART error return during eviction walk
WT-4025 Allow debug dumping of internal pages
Diffstat (limited to 'src/third_party/wiredtiger/src/include/txn.i')
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn.i | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i index 9061157ff5a..f077ef164e9 100644 --- a/src/third_party/wiredtiger/src/include/txn.i +++ b/src/third_party/wiredtiger/src/include/txn.i @@ -251,8 +251,20 @@ static inline bool __wt_txn_update_needs_timestamp(WT_SESSION_IMPL *session, WT_TXN_OP *op) { WT_TXN *txn; + wt_timestamp_t *timestamp; txn = &session->txn; + + /* + * The timestamp is in the page deleted structure for truncates, or + * in the update for other operations. + */ + if (op->type == WT_TXN_OP_REF_DELETE) + timestamp = op->u.ref == NULL || op->u.ref->page_del == NULL ? + NULL : &op->u.ref->page_del->timestamp; + else + timestamp = op->u.upd == NULL ? NULL : &op->u.upd->timestamp; + /* * Updates in the metadata never get timestamps (either now or at * commit): metadata cannot be read at a point in time, only the most @@ -260,8 +272,7 @@ __wt_txn_update_needs_timestamp(WT_SESSION_IMPL *session, WT_TXN_OP *op) */ return (op->fileid != WT_METAFILE_ID && F_ISSET(txn, WT_TXN_HAS_TS_COMMIT) && - (op->u.upd == NULL || - __wt_timestamp_iszero(&(op->u.upd->timestamp)) || + (timestamp == NULL || __wt_timestamp_iszero(timestamp) || F_ISSET(txn, WT_TXN_PREPARE))); } #endif @@ -550,12 +561,13 @@ __wt_txn_visible( static inline WT_VISIBLE_TYPE __wt_txn_upd_visible_type(WT_SESSION_IMPL *session, WT_UPDATE *upd) { - uint8_t upd_state; + uint8_t prepare_state, previous_state; bool upd_visible; for (;;__wt_yield()) { - /* Commit is in progress, yield and try again. */ - if ((upd_state = upd->state) == WT_UPDATE_STATE_LOCKED) + /* Prepare state change is in progress, yield and try again. */ + WT_ORDERED_READ(prepare_state, upd->prepare_state); + if (prepare_state == WT_PREPARE_LOCKED) continue; upd_visible = __wt_txn_visible( @@ -565,14 +577,17 @@ __wt_txn_upd_visible_type(WT_SESSION_IMPL *session, WT_UPDATE *upd) * The visibility check is only valid if the update does not * change state. If the state does change, recheck visibility. */ - if (upd->state == upd_state) + previous_state = prepare_state; + WT_ORDERED_READ(prepare_state, upd->prepare_state); + if (previous_state == prepare_state) break; } if (!upd_visible) return (WT_VISIBLE_FALSE); - if (upd_state == WT_UPDATE_STATE_PREPARED) + /* Ignore the prepared update, if transaction configuration says so. */ + if (prepare_state == WT_PREPARE_INPROGRESS) return (F_ISSET(&session->txn, WT_TXN_IGNORE_PREPARE) ? WT_VISIBLE_FALSE : WT_VISIBLE_PREPARE); @@ -620,7 +635,7 @@ __wt_txn_read(WT_SESSION_IMPL *session, WT_UPDATE *upd, WT_UPDATE **updp) if (upd == NULL && skipped_birthmark) upd = &tombstone; - *updp = (upd == NULL || upd->type == WT_UPDATE_BIRTHMARK ? NULL : upd); + *updp = upd == NULL || upd->type == WT_UPDATE_BIRTHMARK ? NULL : upd; return (0); } |