summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2020-08-05 12:32:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-05 12:48:32 +0000
commit2fdb9c36748c3206914a3c6ca23720ce7cc75317 (patch)
tree5e76ee90b16b713d5d9071b4ce6c8c2255785e74
parent403ee63aad4b5d76b2abd5e003eb77cb1dbdbf51 (diff)
downloadmongo-2fdb9c36748c3206914a3c6ca23720ce7cc75317.tar.gz
Import wiredtiger: 54d5655b43b91028ee1c90eadd0969c863a9e7e5 from branch mongodb-4.6
ref: 91b5d984b9..54d5655b43 for: 4.5.1 WT-6491 No need to append the onpage value if it is prepared
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_visibility.c47
2 files changed, 16 insertions, 33 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 62f713290ac..c1416ad69ba 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-4.6",
- "commit": "91b5d984b963379e2a9bb0cf0b048d3720202a1c"
+ "commit": "54d5655b43b91028ee1c90eadd0969c863a9e7e5"
}
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
index f001d787997..523ed514415 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c
@@ -50,8 +50,8 @@ __rec_update_save(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, voi
/*
* __rec_append_orig_value --
* Append the key's original value to its update list. It assumes that we have an onpage value,
- * and we don't overwrite transaction id to WT_TXN_NONE and timestamps to WT_TS_NONE in time
- * window for in-memory databases.
+ * the onpage value is not a prepared update, and we don't overwrite transaction id to
+ * WT_TXN_NONE and timestamps to WT_TS_NONE in time window for in-memory databases.
*/
static int
__rec_append_orig_value(
@@ -63,7 +63,8 @@ __rec_append_orig_value(
size_t size, total_size;
bool tombstone_globally_visible;
- WT_ASSERT(session, upd != NULL && unpack != NULL && unpack->type != WT_CELL_DEL);
+ WT_ASSERT(
+ session, upd != NULL && unpack != NULL && unpack->type != WT_CELL_DEL && !unpack->tw.prepare);
append = oldest_upd = tombstone = NULL;
total_size = 0;
@@ -76,13 +77,6 @@ __rec_append_orig_value(
return (0);
/*
- * Prepared updates should already be in the update list, add the original update to the
- * list only when the prepared update is a tombstone.
- */
- if (unpack->tw.prepare && upd->type != WT_UPDATE_TOMBSTONE)
- return (0);
-
- /*
* Done if the on page value already appears on the update list. We can't do the same check
* for stop time point because we may still need to append the onpage value if only the
* tombstone is on the update chain. We only need to check it in the in memory case as in
@@ -132,13 +126,8 @@ __rec_append_orig_value(
if (WT_TIME_WINDOW_HAS_STOP(&unpack->tw)) {
tombstone_globally_visible = __wt_txn_tw_stop_visible_all(session, &unpack->tw);
- /*
- * No need to append the tombstone if it is already in the update chain.
- *
- * Don't append the onpage tombstone if it is a prepared update as it is either on the
- * update chain or has been aborted. If it is aborted, discard it silently.
- */
- if (oldest_upd->type != WT_UPDATE_TOMBSTONE && !unpack->tw.prepare) {
+ /* No need to append the tombstone if it is already in the update chain. */
+ if (oldest_upd->type != WT_UPDATE_TOMBSTONE) {
/*
* We still need to append the globally visible tombstone if its timestamp is WT_TS_NONE
* as we may need it to clear the history store content of the key. We don't append a
@@ -157,27 +146,17 @@ __rec_append_orig_value(
F_SET(tombstone, WT_UPDATE_RESTORED_FROM_DS);
} else {
/*
- * Once the prepared update is resolved, the in-memory update and on-disk written copy
- * doesn't have same timestamp due to replacing of prepare timestamp with commit and
- * durable timestamps. Don't compare them when the on-disk version is a prepare.
- *
* We may have overwritten its transaction id to WT_TXN_NONE and its timestamps to
* WT_TS_NONE in the time window.
*/
- WT_ASSERT(session, unpack->tw.prepare ||
- ((unpack->tw.stop_ts == oldest_upd->start_ts || unpack->tw.stop_ts == WT_TS_NONE) &&
- (unpack->tw.stop_txn == oldest_upd->txnid ||
- unpack->tw.stop_txn == WT_TXN_NONE)));
+ WT_ASSERT(session,
+ (unpack->tw.stop_ts == oldest_upd->start_ts || unpack->tw.stop_ts == WT_TS_NONE) &&
+ (unpack->tw.stop_txn == oldest_upd->txnid || unpack->tw.stop_txn == WT_TXN_NONE));
if (tombstone_globally_visible)
return (0);
}
- } else if (unpack->tw.prepare)
- /*
- * Don't append the onpage value if it is a prepared update as it is either on the update
- * chain or has been aborted. If it is aborted, discard it silently.
- */
- return (0);
+ }
/* We need the original on-page value for some reader: get a copy. */
if (!tombstone_globally_visible) {
@@ -560,9 +539,13 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v
* part of the page, and they are physically removed by checkpoint writing this page, that is,
* the checkpoint doesn't include the overflow blocks so they're removed and future readers of
* this page won't be able to find them.
+ *
+ * We never append prepared updates back to the onpage value. If it is a prepared full update,
+ * it is already on the update chain. If it is a prepared tombstone, the onpage value is already
+ * appended to the update chain when the page is read into memory.
*/
if (upd_select->upd != NULL && vpack != NULL && vpack->type != WT_CELL_DEL &&
- (upd_saved || F_ISSET(vpack, WT_CELL_UNPACK_OVERFLOW)))
+ !vpack->tw.prepare && (upd_saved || F_ISSET(vpack, WT_CELL_UNPACK_OVERFLOW)))
WT_ERR(__rec_append_orig_value(session, page, upd_select->upd, vpack));
__wt_time_window_clear_obsolete(