summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2019-10-08 05:00:51 +0000
committerevergreen <evergreen@mongodb.com>2019-10-08 05:00:51 +0000
commitb9de40f63d2edfe296a0c09b0a4b0d7609dbdc02 (patch)
treef683de3c5883f8602f3a81bfa31da835d19dbef7
parent4f203678e2d86814e0e77b5b6d1cfa8494dcb929 (diff)
downloadmongo-b9de40f63d2edfe296a0c09b0a4b0d7609dbdc02.tar.gz
Import wiredtiger: 3818fb14bd816a5fa2b9e8d50b0c2f93a3bfb9ca from branch mongodb-4.4
ref: e0041ca53c..3818fb14bd for: 4.3.1 WT-5083 Add mips64el support WT-5118 Remove incorrect assert that there are no hazard references to discarded WT_REF WT-5134 Fix leaf-page only search and search-near operations WT-5148 Switch little-endian test to use ubuntu1808 distro WT-5149 Clear the debugging field value so it cannot get stale WT-5156 Lookaside table cursors not operating at isolation level WT_ISO_READ_UNCOMMITTED WT-5160 Stop requiring a checkpoint before calling rollback_to_stable
-rw-r--r--src/third_party/wiredtiger/build_posix/configure.ac.in6
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_cursor.c34
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c1
-rw-r--r--src/third_party/wiredtiger/src/cache/cache_las.c16
-rw-r--r--src/third_party/wiredtiger/src/include/gcc.h15
-rw-r--r--src/third_party/wiredtiger/src/include/time.i8
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c5
-rwxr-xr-xsrc/third_party/wiredtiger/test/evergreen.yml2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn20.py5
10 files changed, 65 insertions, 29 deletions
diff --git a/src/third_party/wiredtiger/build_posix/configure.ac.in b/src/third_party/wiredtiger/build_posix/configure.ac.in
index 7c829f86f80..c50d86678e6 100644
--- a/src/third_party/wiredtiger/build_posix/configure.ac.in
+++ b/src/third_party/wiredtiger/build_posix/configure.ac.in
@@ -56,7 +56,7 @@ AS_CASE([$host_cpu],
[wt_cv_powerpc="no"])
AM_CONDITIONAL([POWERPC_HOST], [test "$wt_cv_powerpc" = "yes"])
AS_CASE([$host_cpu],
- [amd*|i[[3456]]86*|pentium|x86*], [wt_cv_x86="yes"], [wt_cv_x86="no"])
+ [amd*|i[[3456]]86*|pentium|x86*|mips64el*], [wt_cv_x86="yes"], [wt_cv_x86="no"])
AM_CONDITIONAL([X86_HOST], [test "$wt_cv_x86" = "yes"])
AS_CASE([$host_cpu],
[s390x*], [wt_cv_zseries="yes"],
@@ -66,6 +66,10 @@ AS_CASE([$host_cpu],
[aarch64*], [wt_cv_arm64="yes"],
[wt_cv_arm64="no"])
AM_CONDITIONAL([ARM64_HOST], [test "$wt_cv_arm64" = "yes"])
+AS_CASE([$host_cpu],
+ [mips64el*], [wt_cv_mips64el="yes"],
+ [wt_cv_mips64el="no"])
+AM_CONDITIONAL([MIPS64EL_HOST], [test "$wt_cv_mips64el" = "yes"])
AS_CASE([$host_os], [*solaris*], [wt_cv_solaris="yes"], [wt_cv_solaris="no"])
# This is a workaround as part of WT-2459. Currently, clang (v3.7) does not
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 427cb8cd696..32cdae47322 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -1,5 +1,5 @@
{
- "commit": "e0041ca53c1c1a4a23cc7aaa7ef8137dc1c61117",
+ "commit": "3818fb14bd816a5fa2b9e8d50b0c2f93a3bfb9ca",
"github": "wiredtiger/wiredtiger.git",
"vendor": "wiredtiger",
"branch": "mongodb-4.4"
diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c
index c45d9ed8b6b..bc70a9d389f 100644
--- a/src/third_party/wiredtiger/src/btree/bt_cursor.c
+++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c
@@ -54,7 +54,7 @@ __cursor_state_restore(WT_CURSOR *cursor, WT_CURFILE_STATE *state)
* Return if we have a page pinned.
*/
static inline bool
-__cursor_page_pinned(WT_CURSOR_BTREE *cbt)
+__cursor_page_pinned(WT_CURSOR_BTREE *cbt, bool search_operation)
{
WT_CURSOR *cursor;
WT_SESSION_IMPL *session;
@@ -72,11 +72,25 @@ __cursor_page_pinned(WT_CURSOR_BTREE *cbt)
}
/*
- * Check if the key references the page. When returning from search, the page is active and the
- * key is internal. After the application sets a key, the key is external, and the page is
- * useless.
+ * Check if the key references an item on a page. When returning from search, the page is pinned
+ * and the key is internal. After the application sets a key, the key becomes external. For the
+ * search and search-near operations, we assume locality and check any pinned page first on each
+ * new search operation. For operations other than search and search-near, check if we have an
+ * internal key. If the page is pinned and we're pointing into the page, we don't need to search
+ * at all, we can proceed with the operation. However, if the key has been set, that is, it's an
+ * external key, we're going to have to do a full search.
*/
- if (!F_ISSET(cursor, WT_CURSTD_KEY_INT))
+ if (!search_operation && !F_ISSET(cursor, WT_CURSTD_KEY_INT))
+ return (false);
+
+ /*
+ * XXX No fast-path searches at read-committed isolation. Underlying transactional functions
+ * called by the fast and slow path search code handle transaction IDs differently, resulting in
+ * different search results at read-committed isolation. This makes no difference for the update
+ * functions, but in the case of a search, we will see different results based on the cursor's
+ * initial location. See WT-5134 for the details.
+ */
+ if (search_operation && session->txn.isolation == WT_ISO_READ_COMMITTED)
return (false);
/*
@@ -541,7 +555,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt)
* pinned page doesn't find an exact match, search from the root.
*/
valid = false;
- if (__cursor_page_pinned(cbt)) {
+ if (__cursor_page_pinned(cbt, true)) {
__wt_txn_cursor_op(session);
WT_ERR(btree->type == BTREE_ROW ? __cursor_row_search(session, cbt, cbt->ref, false) :
@@ -642,7 +656,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp)
* existing record.
*/
valid = false;
- if (btree->type == BTREE_ROW && __cursor_page_pinned(cbt)) {
+ if (btree->type == BTREE_ROW && __cursor_page_pinned(cbt, true)) {
__wt_txn_cursor_op(session);
WT_ERR(__cursor_row_search(session, cbt, cbt->ref, true));
@@ -793,7 +807,7 @@ __wt_btcur_insert(WT_CURSOR_BTREE *cbt)
* because the cursor may not be positioned to the correct record in the
* case of implicit records in the append list.
*/
- if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt) &&
+ if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt, false) &&
F_ISSET(cursor, WT_CURSTD_OVERWRITE) && !append_key) {
WT_ERR(__wt_txn_autocommit_check(session));
/*
@@ -1019,7 +1033,7 @@ __wt_btcur_remove(WT_CURSOR_BTREE *cbt, bool positioned)
* because the cursor may not be positioned to the correct record in the
* case of implicit records in the append list.
*/
- if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt)) {
+ if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt, false)) {
WT_ERR(__wt_txn_autocommit_check(session));
/*
@@ -1201,7 +1215,7 @@ __btcur_update(WT_CURSOR_BTREE *cbt, WT_ITEM *value, u_int modify_type)
* because the cursor may not be positioned to the correct record in the
* case of implicit records in the append list.
*/
- if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt)) {
+ if (btree->type != BTREE_COL_FIX && __cursor_page_pinned(cbt, false)) {
WT_ERR(__wt_txn_autocommit_check(session));
/*
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index 141eb78d8b4..ee373192a40 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -837,7 +837,6 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new, uint32_t
/* Free the backing block and address. */
WT_TRET(__wt_ref_block_free(session, next_ref));
- WT_ASSERT(session, __wt_hazard_check_assert(session, next_ref, false));
WT_TRET(__split_safe_free(session, split_gen, exclusive, next_ref, sizeof(WT_REF)));
parent_decr += sizeof(WT_REF);
}
diff --git a/src/third_party/wiredtiger/src/cache/cache_las.c b/src/third_party/wiredtiger/src/cache/cache_las.c
index aa05724b406..20a8f3df3b6 100644
--- a/src/third_party/wiredtiger/src/cache/cache_las.c
+++ b/src/third_party/wiredtiger/src/cache/cache_las.c
@@ -502,6 +502,7 @@ __las_remove_block(WT_CURSOR *cursor, uint64_t pageid, bool lock_wait, uint64_t
bool local_txn;
*remove_cntp = 0;
+ saved_isolation = 0; /*[-Wconditional-uninitialized] */
session = (WT_SESSION_IMPL *)cursor->session;
conn = S2C(session);
@@ -513,8 +514,8 @@ __las_remove_block(WT_CURSOR *cursor, uint64_t pageid, bool lock_wait, uint64_t
else
WT_RET(__wt_try_writelock(session, &conn->cache->las_sweepwalk_lock));
- __las_set_isolation(session, &saved_isolation);
WT_ERR(__wt_txn_begin(session, NULL));
+ __las_set_isolation(session, &saved_isolation);
local_txn = true;
/*
@@ -539,9 +540,9 @@ err:
ret = __wt_txn_commit(session, NULL);
else
WT_TRET(__wt_txn_rollback(session, NULL));
+ __las_restore_isolation(session, saved_isolation);
}
- __las_restore_isolation(session, saved_isolation);
__wt_writeunlock(session, &conn->cache->las_sweepwalk_lock);
return (ret);
}
@@ -628,6 +629,7 @@ __wt_las_insert_block(
session = (WT_SESSION_IMPL *)cursor->session;
conn = S2C(session);
WT_CLEAR(las_value);
+ saved_isolation = 0; /*[-Wconditional-uninitialized] */
insert_cnt = prepared_insert_cnt = 0;
btree_id = btree->id;
local_txn = false;
@@ -649,8 +651,8 @@ __wt_las_insert_block(
#endif
/* Wrap all the updates in a transaction. */
- __las_set_isolation(session, &saved_isolation);
WT_ERR(__wt_txn_begin(session, NULL));
+ __las_set_isolation(session, &saved_isolation);
local_txn = true;
/* Enter each update in the boundary's list into the lookaside store. */
@@ -775,6 +777,7 @@ err:
ret = __wt_txn_commit(session, NULL);
else
WT_TRET(__wt_txn_rollback(session, NULL));
+ __las_restore_isolation(session, saved_isolation);
/* Adjust the entry count. */
if (ret == 0) {
@@ -784,8 +787,6 @@ err:
}
}
- __las_restore_isolation(session, saved_isolation);
-
if (ret == 0 && insert_cnt > 0) {
multi->page_las.las_pageid = las_pageid;
multi->page_las.has_prepares = prepared_insert_cnt > 0;
@@ -1039,6 +1040,7 @@ __wt_las_sweep(WT_SESSION_IMPL *session)
cache = S2C(session)->cache;
cursor = NULL;
sweep_key = &cache->las_sweep_key;
+ saved_isolation = 0; /*[-Wconditional-uninitialized] */
remove_cnt = 0;
session_flags = 0; /* [-Werror=maybe-uninitialized] */
local_txn = locked = removing_key_block = false;
@@ -1058,8 +1060,8 @@ __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));
+ __las_set_isolation(session, &saved_isolation);
local_txn = true;
/* Encourage a race */
@@ -1241,11 +1243,11 @@ err:
ret = __wt_txn_commit(session, NULL);
else
WT_TRET(__wt_txn_rollback(session, NULL));
+ __las_restore_isolation(session, saved_isolation);
if (ret == 0)
(void)__wt_atomic_add64(&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/gcc.h b/src/third_party/wiredtiger/src/include/gcc.h
index 052fb35d3a7..184d08c01d6 100644
--- a/src/third_party/wiredtiger/src/include/gcc.h
+++ b/src/third_party/wiredtiger/src/include/gcc.h
@@ -180,6 +180,21 @@ WT_ATOMIC_FUNC(size, size_t, size_t *vp, size_t v)
#define WT_READ_BARRIER() WT_FULL_BARRIER()
#define WT_WRITE_BARRIER() WT_FULL_BARRIER()
+#elif defined(__mips64el__) || defined(__mips__) || defined(__mips64__) || defined(__mips64)
+#define WT_PAUSE() __asm__ volatile("pause\n" ::: "memory")
+#define WT_FULL_BARRIER() \
+ do { \
+ __asm__ volatile("sync; ld $0, %0" ::"m"(*(long *)0xffffffff80000000) : "memory"); \
+ } while (0)
+#define WT_READ_BARRIER() \
+ do { \
+ __asm__ volatile("sync; ld $0, %0" ::"m"(*(long *)0xffffffff80000000) : "memory"); \
+ } while (0)
+#define WT_WRITE_BARRIER() \
+ do { \
+ __asm__ volatile("sync; ld $0, %0" ::"m"(*(long *)0xffffffff80000000) : "memory"); \
+ } while (0)
+
#elif defined(__PPC64__) || defined(PPC64)
/* ori 0,0,0 is the PPC64 noop instruction */
#define WT_PAUSE() __asm__ volatile("ori 0,0,0" ::: "memory")
diff --git a/src/third_party/wiredtiger/src/include/time.i b/src/third_party/wiredtiger/src/include/time.i
index bad2f0417ad..0dd6781216e 100644
--- a/src/third_party/wiredtiger/src/include/time.i
+++ b/src/third_party/wiredtiger/src/include/time.i
@@ -161,6 +161,14 @@ static inline void
__wt_op_timer_start(WT_SESSION_IMPL *session)
{
session->operation_start_us = session->operation_timeout_us == 0 ? 0 : __wt_clock(session);
+#ifdef HAVE_DIAGNOSTIC
+ /*
+ * This is called at the beginning of each API call. We need to clear out any old values from
+ * this debugging field so that we don't leave a stale value in there that may then give a false
+ * positive.
+ */
+ session->op_5043_seconds = 0;
+#endif
}
/*
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
index 0b2ec12a47a..7b6463f6f2e 100644
--- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
+++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
@@ -432,9 +432,8 @@ __txn_rollback_to_stable_check(WT_SESSION_IMPL *session)
conn = S2C(session);
txn_global = &conn->txn_global;
- if (!txn_global->has_stable_timestamp || txn_global->last_ckpt_timestamp == WT_TS_NONE)
- WT_RET_MSG(
- session, EINVAL, "rollback_to_stable requires a checkpoint with a stable timestamp");
+ if (!txn_global->has_stable_timestamp)
+ WT_RET_MSG(session, EINVAL, "rollback_to_stable requires a stable timestamp");
/*
* Help the user comply with the requirement that there are no concurrent operations. Protect
diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml
index c6131ac0e77..578bddc84b7 100755
--- a/src/third_party/wiredtiger/test/evergreen.yml
+++ b/src/third_party/wiredtiger/test/evergreen.yml
@@ -1320,7 +1320,7 @@ buildvariants:
- name: little-endian
display_name: Little-endian (x86)
run_on:
- - ubuntu1404-test
+ - ubuntu1804-test
batchtime: 10080 # 7 days
expansions:
smp_command: -j $(grep -c ^processor /proc/cpuinfo)
diff --git a/src/third_party/wiredtiger/test/suite/test_txn20.py b/src/third_party/wiredtiger/test/suite/test_txn20.py
index 381435ff472..f824d85ff45 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn20.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn20.py
@@ -83,10 +83,5 @@ class test_txn20(wttest.WiredTigerTestCase):
# 'read-uncommitted' will still see the new value.
self.assertEqual(cursor[self.key], self.new_value)
- # Cleanup.
- self.session.close()
- s.rollback_transaction()
- s.close()
-
if __name__ == '__main__':
wttest.run()