summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2020-07-14 03:04:18 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-14 03:18:51 +0000
commit41b289ff734a926e784d6ab42c3129f59f40d5b4 (patch)
tree3ea277aa84c0d8100b1ce2c8edf551a06317b1c4
parentf0253e7ba95430c7e100b4ab5f76dd786f9f9a3d (diff)
downloadmongo-r3.6.19.tar.gz
Import wiredtiger: 3a63ddcbed28c5f40ef026c55b85e34042a9715d from branch mongodb-3.6r3.6.19-rc0r3.6.19
ref: 723a4c1329..3a63ddcbed for: 3.6.19 WT-5119 Birthmark records can be read as normal updates if reads race with checkpoints WT-5150 LAS sweep is not removing the entries that are no longer required WT-5196 Data mismatch failures with test/checkpoint after enabling LAS sweep WT-5376 WT_UPDATE.type field can race with visibility checks when returning key/value pairs WT-5587 Limit how many checkpoints are dropped by a subsequent checkpoint
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/cache/cache_las.c10
-rw-r--r--src/third_party/wiredtiger/src/include/txn.i53
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_write.c4
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c39
5 files changed, 61 insertions, 47 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index ae855e43736..6ba8cf0167c 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-3.6",
- "commit": "723a4c13292b0bc7e27be411db4d006a0b865bd8"
+ "commit": "3a63ddcbed28c5f40ef026c55b85e34042a9715d"
}
diff --git a/src/third_party/wiredtiger/src/cache/cache_las.c b/src/third_party/wiredtiger/src/cache/cache_las.c
index 35a76210a0c..07791e38942 100644
--- a/src/third_party/wiredtiger/src/cache/cache_las.c
+++ b/src/third_party/wiredtiger/src/cache/cache_las.c
@@ -1035,11 +1035,8 @@ __las_sweep_init(WT_SESSION_IMPL *session)
* If no files have been dropped and the lookaside file is empty,
* there's nothing to do.
*/
- if (cache->las_dropped_next == 0) {
- if (__wt_las_empty(session))
- ret = WT_NOTFOUND;
- goto err;
- }
+ if (cache->las_dropped_next == 0 && __wt_las_empty(session))
+ WT_ERR(WT_NOTFOUND);
/*
* Record the current page ID: sweep will stop after this point.
@@ -1093,7 +1090,6 @@ __wt_las_sweep(WT_SESSION_IMPL *session)
WT_DECL_RET;
WT_ITEM las_key, las_timestamp, las_value;
WT_ITEM *sweep_key;
- WT_TXN_ISOLATION saved_isolation;
#ifdef HAVE_TIMESTAMPS
wt_timestamp_t timestamp, *val_ts;
#else
@@ -1128,7 +1124,6 @@ __wt_las_sweep(WT_SESSION_IMPL *session)
*/
__wt_las_cursor(session, &cursor, &session_flags);
WT_ASSERT(session, cursor->session == &session->iface);
- __las_set_isolation(session, &saved_isolation);
WT_ERR(__wt_txn_begin(session, NULL));
local_txn = true;
@@ -1323,7 +1318,6 @@ err: __wt_buf_free(session, sweep_key);
&cache->las_remove_count, remove_cnt);
}
- __las_restore_isolation(session, saved_isolation);
WT_TRET(__wt_las_cursor_close(session, &cursor, session_flags));
if (locked)
diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i
index 7010af975c1..816d7693901 100644
--- a/src/third_party/wiredtiger/src/include/txn.i
+++ b/src/third_party/wiredtiger/src/include/txn.i
@@ -784,32 +784,39 @@ __wt_txn_upd_visible(WT_SESSION_IMPL *session, WT_UPDATE *upd)
static inline int
__wt_txn_read(WT_SESSION_IMPL *session, WT_UPDATE *upd, WT_UPDATE **updp)
{
- static WT_UPDATE tombstone = {
+ static WT_UPDATE tombstone = {
.txnid = WT_TXN_NONE, .type = WT_UPDATE_TOMBSTONE
};
- WT_VISIBLE_TYPE upd_visible;
- bool skipped_birthmark;
-
- *updp = NULL;
- for (skipped_birthmark = false; upd != NULL; upd = upd->next) {
- /* Skip reserved place-holders, they're never visible. */
- if (upd->type != WT_UPDATE_RESERVE) {
- upd_visible = __wt_txn_upd_visible_type(session, upd);
- if (upd_visible == WT_VISIBLE_TRUE)
- break;
- if (upd_visible == WT_VISIBLE_PREPARE)
- return (WT_PREPARE_CONFLICT);
- }
- /* An invisible birthmark is equivalent to a tombstone. */
- if (upd->type == WT_UPDATE_BIRTHMARK)
- skipped_birthmark = true;
+ WT_VISIBLE_TYPE upd_visible;
+ uint8_t type;
+ bool skipped_birthmark;
+
+ *updp = NULL;
+
+ type = WT_UPDATE_INVALID; /* [-Wconditional-uninitialized] */
+ for (skipped_birthmark = false; upd != NULL; upd = upd->next) {
+ WT_ORDERED_READ(type, upd->type);
+
+ /* Skip reserved place-holders, they're never visible. */
+ if (type != WT_UPDATE_RESERVE) {
+ upd_visible = __wt_txn_upd_visible_type(session, upd);
+ if (upd_visible == WT_VISIBLE_TRUE)
+ break;
+ if (upd_visible == WT_VISIBLE_PREPARE)
+ return (WT_PREPARE_CONFLICT);
}
-
- if (upd == NULL && skipped_birthmark)
- upd = &tombstone;
-
- *updp = upd == NULL || upd->type == WT_UPDATE_BIRTHMARK ? NULL : upd;
- return (0);
+ /* An invisible birthmark is equivalent to a tombstone. */
+ if (type == WT_UPDATE_BIRTHMARK)
+ skipped_birthmark = true;
+ }
+
+ if (upd == NULL && skipped_birthmark) {
+ upd = &tombstone;
+ type = upd->type;
+ }
+
+ *updp = upd == NULL || type == WT_UPDATE_BIRTHMARK ? NULL : upd;
+ return (0);
}
/*
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c
index 5821292f454..d8632dc6742 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_write.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c
@@ -1347,8 +1347,8 @@ __rec_append_orig_value(WT_SESSION_IMPL *session,
__wt_cache_page_inmem_incr(session, page, size);
if (upd->type == WT_UPDATE_BIRTHMARK) {
- upd->type = WT_UPDATE_STANDARD;
- upd->txnid = WT_TXN_ABORTED;
+ WT_PUBLISH(upd->txnid, WT_TXN_ABORTED);
+ WT_PUBLISH(upd->type, WT_UPDATE_STANDARD);
}
err: __wt_scr_free(session, &tmp);
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index dd00ff7d36a..dcea60b135a 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -1205,23 +1205,36 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[], bool waiting)
static void
__drop(WT_CKPT *ckptbase, const char *name, size_t len)
{
- WT_CKPT *ckpt;
+ WT_CKPT *ckpt;
+ u_int max_ckpt_drop;
- /*
- * If we're dropping internal checkpoints, match to the '.' separating
+ /*
+ * If we're dropping internal checkpoints, match to the '.' separating
* the checkpoint name from the generational number, and take all that
* we can find. Applications aren't allowed to use any variant of this
* name, so the test is still pretty simple, if the leading bytes match,
- * it's one we want to drop.
- */
- if (strncmp(WT_CHECKPOINT, name, len) == 0) {
- WT_CKPT_FOREACH(ckptbase, ckpt)
- if (WT_PREFIX_MATCH(ckpt->name, WT_CHECKPOINT))
- F_SET(ckpt, WT_CKPT_DELETE);
- } else
- WT_CKPT_FOREACH(ckptbase, ckpt)
- if (WT_STRING_MATCH(ckpt->name, name, len))
- F_SET(ckpt, WT_CKPT_DELETE);
+ * it's one we want to drop.
+ */
+ if (strncmp(WT_CHECKPOINT, name, len) == 0) {
+ /*
+ * Currently, hot backup cursors block checkpoint drop, which means
+ * releasing a hot backup cursor can result in immediately attempting
+ * to drop lots of checkpoints, which involves a fair amount of work
+ * while holding locks. Limit the number of standard checkpoints dropped
+ * per checkpoint.
+ */
+ max_ckpt_drop = 0;
+ WT_CKPT_FOREACH (ckptbase, ckpt)
+ if (WT_PREFIX_MATCH(ckpt->name, WT_CHECKPOINT)) {
+ F_SET(ckpt, WT_CKPT_DELETE);
+#define WT_MAX_CHECKPOINT_DROP 4
+ if (++max_ckpt_drop >= WT_MAX_CHECKPOINT_DROP)
+ break;
+ }
+ } else
+ WT_CKPT_FOREACH (ckptbase, ckpt)
+ if (WT_STRING_MATCH(ckpt->name, name, len))
+ F_SET(ckpt, WT_CKPT_DELETE);
}
/*