diff options
author | Luke Chen <luke.chen@mongodb.com> | 2019-08-14 05:27:54 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-14 05:27:54 +0000 |
commit | 2d3b6c1615163cabd1b49363000eb0322b88c0d2 (patch) | |
tree | f1f0013717ae1837e0ac2c9af47b7b1dfc3f1254 /src/third_party/wiredtiger/src | |
parent | 06a2692de5f5803348f395ff45ed6b7241c57f2e (diff) | |
download | mongo-2d3b6c1615163cabd1b49363000eb0322b88c0d2.tar.gz |
Import wiredtiger: c809757d8ba95c9fc2638b80c9b625c9f8df3f65 from branch mongodb-4.4
ref: 2e5a26d8b0..c809757d8b
for: 4.3.1
WT-5038 Prevent eviction of prepared updates during commit
WT-5040 Add dumping of cursor's page on a mismatch
WT-5054 Fix test/format bug where truncation operations could fail repeatable read testing
Diffstat (limited to 'src/third_party/wiredtiger/src')
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_debug.c | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn.i | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn.c | 35 |
4 files changed, 29 insertions, 11 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c index 2eb71967799..9f5cadfecd0 100644 --- a/src/third_party/wiredtiger/src/btree/bt_debug.c +++ b/src/third_party/wiredtiger/src/btree/bt_debug.c @@ -718,6 +718,7 @@ __wt_debug_page( */ int __wt_debug_cursor_page(void *cursor_arg, const char *ofile) + WT_GCC_FUNC_ATTRIBUTE((visibility("default"))) { WT_CURSOR *cursor; WT_CURSOR_BTREE *cbt; diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 843cf562c66..5dbd7115684 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -277,7 +277,7 @@ extern int __wt_curtable_get_value(WT_CURSOR *cursor, ...) WT_GCC_FUNC_DECL_ATTR extern int __wt_curtable_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_addr(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_addr_print( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_debug_cursor_page(void *cursor_arg, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_debug_cursor_page(void *cursor_arg, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default"))) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_disk( WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_mode_config(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_offset(WT_SESSION_IMPL *session, wt_off_t offset, uint32_t size, uint32_t checksum, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i index e2141518e3a..e9c6f7f8e9d 100644 --- a/src/third_party/wiredtiger/src/include/txn.i +++ b/src/third_party/wiredtiger/src/include/txn.i @@ -232,8 +232,6 @@ __wt_txn_resolve_prepared_op( continue; if (upd->txnid != txn->id) break; - if (op->u.op_upd == NULL) - op->u.op_upd = upd; ++(*resolved_update_countp); diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c index f888a470c8c..b3085080956 100644 --- a/src/third_party/wiredtiger/src/txn/txn.c +++ b/src/third_party/wiredtiger/src/txn/txn.c @@ -664,13 +664,15 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) WT_TXN *txn; WT_TXN_OP *op; WT_UPDATE *upd; - wt_timestamp_t op_timestamp; + wt_timestamp_t durable_op_timestamp, op_timestamp, prev_op_timestamp; u_int i; const char *open_cursor_cfg[] = { WT_CONFIG_BASE(session, WT_SESSION_open_cursor), NULL }; bool op_zero_ts, upd_zero_ts; txn = &session->txn; + cursor = NULL; + durable_op_timestamp = prev_op_timestamp = WT_TS_NONE; /* * Debugging checks on timestamps, if user requested them. @@ -728,13 +730,15 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) WT_WITH_BTREE(session, op->btree, ret = __wt_btcur_search_uncommitted( (WT_CURSOR_BTREE *)cursor, &upd)); - WT_TRET(cursor->close(cursor)); if (ret != 0) WT_RET_MSG(session, EINVAL, "prepared update restore failed"); - op->u.op_upd = upd; } else - upd = op->u.op_upd->next; + upd = op->u.op_upd; + + WT_ASSERT(session, upd != NULL); + op_timestamp = upd->start_ts; + /* * Skip over any aborted update structures, internally * created update structures or ones from our own @@ -749,6 +753,22 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) * first valid update in the chain. They're in * most recent order. */ + if (upd != NULL) { + prev_op_timestamp = upd->start_ts; + durable_op_timestamp = upd->durable_ts; + } + + /* + * We no longer need to access the update structure so + * it's safe to release our reference to the page. + */ + if (cursor != NULL) { + WT_ASSERT( + session, F_ISSET(txn, WT_TXN_PREPARE)); + WT_RET(cursor->close(cursor)); + cursor = NULL; + } + if (upd == NULL) continue; /* @@ -760,7 +780,7 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) * Check timestamps are used in order. */ op_zero_ts = !F_ISSET(txn, WT_TXN_HAS_TS_COMMIT); - upd_zero_ts = upd->start_ts == WT_TS_NONE; + upd_zero_ts = prev_op_timestamp == WT_TS_NONE; if (op_zero_ts != upd_zero_ts) WT_RET_MSG(session, EINVAL, "per-key timestamps used inconsistently"); @@ -772,7 +792,6 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) if (op_zero_ts) continue; - op_timestamp = op->u.op_upd->start_ts; /* * Only if the update structure doesn't have a timestamp * then use the one in the transaction structure. @@ -780,11 +799,11 @@ __txn_commit_timestamps_assert(WT_SESSION_IMPL *session) if (op_timestamp == WT_TS_NONE) op_timestamp = txn->commit_timestamp; if (F_ISSET(txn, WT_TXN_TS_COMMIT_KEYS) && - op_timestamp < upd->start_ts) + op_timestamp < prev_op_timestamp) WT_RET_MSG(session, EINVAL, "out of order commit timestamps"); if (F_ISSET(txn, WT_TXN_TS_DURABLE_KEYS) && - txn->durable_timestamp < upd->durable_ts) + txn->durable_timestamp < durable_op_timestamp) WT_RET_MSG(session, EINVAL, "out of order durable timestamps"); } |