summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2020-05-15 16:48:50 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-15 07:00:38 +0000
commitfdec072643698b8c42ab4a753cc778f1f6f6236b (patch)
treea4ed115b286d9424a4ebac391da6d340bf71bcd1 /src/third_party/wiredtiger/test
parente7c558b548982400d2a320c99a99634d24aba9a4 (diff)
downloadmongo-fdec072643698b8c42ab4a753cc778f1f6f6236b.tar.gz
Import wiredtiger: 90a2282276ccc25fcc662e6ebef6fbc91d0ff0af from branch mongodb-4.4
ref: 4cf221a61f..90a2282276 for: 4.4.0-rc7 WT-6042 Changes to checkpoint04 to remove or debug failures on Windows WT-6165 Fix cursor operation hung on WT_PREPARE_CONFLICT WT-6173 Change __wt_time_window_ functions to macros WT-6174 Fix dhandle->session_inuse counter leak in __evict_walk WT-6195 Ensure that we don't perform rollback to stable without a history store WT-6214 format.sh must disassociate from the child process
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r--src/third_party/wiredtiger/test/format/format.i34
-rwxr-xr-xsrc/third_party/wiredtiger/test/format/format.sh10
-rwxr-xr-xsrc/third_party/wiredtiger/test/suite/test_checkpoint04.py59
3 files changed, 76 insertions, 27 deletions
diff --git a/src/third_party/wiredtiger/test/format/format.i b/src/third_party/wiredtiger/test/format/format.i
index 661dd096ae9..e1634ff13d3 100644
--- a/src/third_party/wiredtiger/test/format/format.i
+++ b/src/third_party/wiredtiger/test/format/format.i
@@ -34,27 +34,53 @@ static inline int
read_op(WT_CURSOR *cursor, read_operation op, int *exactp)
{
WT_DECL_RET;
+ uint64_t start, now;
/*
* Read operations wait out prepare-conflicts. (As part of the snapshot isolation checks, we
* repeat reads that succeeded before, they should be repeatable.)
*/
+ __wt_seconds(NULL, &start);
switch (op) {
case NEXT:
- while ((ret = cursor->next(cursor)) == WT_PREPARE_CONFLICT)
+ while ((ret = cursor->next(cursor)) == WT_PREPARE_CONFLICT) {
__wt_yield();
+
+ /* Ignore clock reset. */
+ __wt_seconds(NULL, &now);
+ testutil_assertfmt(now < start || now - start < 60,
+ "%s: timed out with prepare-conflict", "WT_CURSOR.next");
+ }
break;
case PREV:
- while ((ret = cursor->prev(cursor)) == WT_PREPARE_CONFLICT)
+ while ((ret = cursor->prev(cursor)) == WT_PREPARE_CONFLICT) {
__wt_yield();
+
+ /* Ignore clock reset. */
+ __wt_seconds(NULL, &now);
+ testutil_assertfmt(now < start || now - start < 60,
+ "%s: timed out with prepare-conflict", "WT_CURSOR.prev");
+ }
break;
case SEARCH:
- while ((ret = cursor->search(cursor)) == WT_PREPARE_CONFLICT)
+ while ((ret = cursor->search(cursor)) == WT_PREPARE_CONFLICT) {
__wt_yield();
+
+ /* Ignore clock reset. */
+ __wt_seconds(NULL, &now);
+ testutil_assertfmt(now < start || now - start < 60,
+ "%s: timed out with prepare-conflict", "WT_CURSOR.search");
+ }
break;
case SEARCH_NEAR:
- while ((ret = cursor->search_near(cursor, exactp)) == WT_PREPARE_CONFLICT)
+ while ((ret = cursor->search_near(cursor, exactp)) == WT_PREPARE_CONFLICT) {
__wt_yield();
+
+ /* Ignore clock reset. */
+ __wt_seconds(NULL, &now);
+ testutil_assertfmt(now < start || now - start < 60,
+ "%s: timed out with prepare-conflict", "WT_CURSOR.search_near");
+ }
break;
}
return (ret);
diff --git a/src/third_party/wiredtiger/test/format/format.sh b/src/third_party/wiredtiger/test/format/format.sh
index 0919eab9b03..7f853819471 100755
--- a/src/third_party/wiredtiger/test/format/format.sh
+++ b/src/third_party/wiredtiger/test/format/format.sh
@@ -78,7 +78,6 @@ timing_stress_split_test=0
total_jobs=0
verbose=0
format_binary="./t"
-env_var=""
while :; do
case "$1" in
@@ -92,7 +91,7 @@ while :; do
config="$2"
shift ; shift ;;
-e)
- env_var="$2"
+ export "$2"
shift ; shift ;;
-E)
skip_errors=1
@@ -448,10 +447,11 @@ format()
# continue to run.
# Run format in its own session so child processes are in their own process gorups
# and we can individually terminate (and clean up) running jobs and their children.
- eval $env_var setsid $cmd > $log 2>&1 &
+ nohup setsid $cmd > $log 2>&1 &
- # Check for setsid command failed execution, and forcibly quit.
- # The RUNDIR is not successfully created in this failure type.
+ # Check for setsid command failed execution, and forcibly quit (setsid exits 0 if the
+ # command execution fails so we can't check the exit status). The RUNDIR directory is
+ # not created in this failure type, check the log file explicitly.
sleep 1
grep -E -i 'setsid: failed to execute' $log > /dev/null && {
failure=$(($failure + 1))
diff --git a/src/third_party/wiredtiger/test/suite/test_checkpoint04.py b/src/third_party/wiredtiger/test/suite/test_checkpoint04.py
index eb6f0313d61..b2af62ce4a1 100755
--- a/src/third_party/wiredtiger/test/suite/test_checkpoint04.py
+++ b/src/third_party/wiredtiger/test/suite/test_checkpoint04.py
@@ -50,13 +50,14 @@ class test_checkpoint04(wttest.WiredTigerTestCase):
tables[uri] = ds
return tables
- def add_updates(self, uri, ds, value, nrows, ts):
+ def add_updates(self, uri, ds, value, nrows):
session = self.session
cursor = session.open_cursor(uri)
+ self.pr('update: ' + uri + ' for ' + str(nrows) + ' rows')
for i in range(0, nrows):
session.begin_transaction()
cursor[ds.key(i)] = value
- session.commit_transaction('commit_timestamp=' + timestamp_str(ts))
+ session.commit_transaction()
cursor.close()
def get_stat(self, stat):
@@ -69,14 +70,11 @@ class test_checkpoint04(wttest.WiredTigerTestCase):
nrows = 100
ntables = 5
- self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10) +
- ',stable_timestamp=' + timestamp_str(10))
-
# Create many tables and perform many updates so our checkpoint stats are populated.
value = "wired" * 100
tables = self.create_tables(ntables)
for uri, ds in tables.items():
- self.add_updates(uri, ds, value, nrows, 20)
+ self.add_updates(uri, ds, value, nrows)
# Perform a checkpoint.
self.session.checkpoint()
@@ -85,23 +83,48 @@ class test_checkpoint04(wttest.WiredTigerTestCase):
value = "tiger" * 100
tables = self.create_tables(ntables)
for uri, ds in tables.items():
- self.add_updates(uri, ds, value, nrows, 30)
+ self.add_updates(uri, ds, value, nrows)
# Perform a checkpoint.
self.session.checkpoint()
# Check the statistics.
- self.assertEqual(self.get_stat(stat.conn.txn_checkpoint), 2)
- self.assertEqual(self.get_stat(stat.conn.txn_checkpoint_running), 0)
- self.assertEqual(self.get_stat(stat.conn.txn_checkpoint_prep_running), 0)
- self.assertLess(self.get_stat(stat.conn.txn_checkpoint_prep_min),
- self.get_stat(stat.conn.txn_checkpoint_time_min))
- self.assertLess(self.get_stat(stat.conn.txn_checkpoint_prep_max),
- self.get_stat(stat.conn.txn_checkpoint_time_max))
- self.assertLess(self.get_stat(stat.conn.txn_checkpoint_prep_recent),
- self.get_stat(stat.conn.txn_checkpoint_time_recent))
- self.assertLess(self.get_stat(stat.conn.txn_checkpoint_prep_total),
- self.get_stat(stat.conn.txn_checkpoint_time_total))
+ # Set them into a variable so that we can print them all out. We've had a failure
+ # on Windows that is very difficult to reproduce so collect what info we can.
+ num_ckpt = self.get_stat(stat.conn.txn_checkpoint)
+ self.pr('txn_checkpoint, number of checkpoints ' + str(num_ckpt))
+ running = self.get_stat(stat.conn.txn_checkpoint_running)
+ self.pr('txn_checkpoint_running ' + str(running))
+ prep_running = self.get_stat(stat.conn.txn_checkpoint_prep_running)
+ self.pr('txn_checkpoint_prep_running ' + str(prep_running))
+
+ prep_min = self.get_stat(stat.conn.txn_checkpoint_prep_min)
+ self.pr('txn_checkpoint_prep_min ' + str(prep_min))
+ time_min = self.get_stat(stat.conn.txn_checkpoint_time_min)
+ self.pr('txn_checkpoint_time_min ' + str(time_min))
+
+ prep_max = self.get_stat(stat.conn.txn_checkpoint_prep_max)
+ self.pr('txn_checkpoint_prep_max ' + str(prep_max))
+ time_max = self.get_stat(stat.conn.txn_checkpoint_time_max)
+ self.pr('txn_checkpoint_time_max ' + str(time_max))
+
+ prep_recent = self.get_stat(stat.conn.txn_checkpoint_prep_recent)
+ self.pr('txn_checkpoint_prep_recent ' + str(prep_recent))
+ time_recent = self.get_stat(stat.conn.txn_checkpoint_time_recent)
+ self.pr('txn_checkpoint_time_recent ' + str(time_recent))
+
+ prep_total = self.get_stat(stat.conn.txn_checkpoint_prep_total)
+ self.pr('txn_checkpoint_prep_total ' + str(prep_total))
+ time_total = self.get_stat(stat.conn.txn_checkpoint_time_total)
+ self.pr('txn_checkpoint_time_total ' + str(time_total))
+
+ self.assertEqual(num_ckpt, 2)
+ self.assertEqual(running, 0)
+ self.assertEqual(prep_running, 0)
+ self.assertLess(prep_min, time_min)
+ self.assertLess(prep_max, time_max)
+ self.assertLess(prep_recent, time_recent)
+ self.assertLess(prep_total, time_total)
if __name__ == '__main__':
wttest.run()