diff options
author | Luke Chen <luke.chen@mongodb.com> | 2020-06-02 17:19:42 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-02 07:32:33 +0000 |
commit | cf4ac31b51ab7619294bc6576301703777cb5efb (patch) | |
tree | 29b409ece8abe978e01092b6b95cc90076c93771 /src/third_party/wiredtiger/test | |
parent | 4f159ce5c2ad81ba40bccc88881eac4fff9ddb02 (diff) | |
download | mongo-cf4ac31b51ab7619294bc6576301703777cb5efb.tar.gz |
Import wiredtiger: cc2458c2c238b08db817161915d00d7e19c6ba29 from branch mongodb-4.4
ref: 943d9cdd2a..cc2458c2c2
for: 4.4.0-rc8
WT-6295 Aggregate time windows in salvage
WT-6297 Increase data size for test_checkpoint04.py
WT-6301 Add shorter running stress jobs
WT-6323 Increase cache size in prepare unit tests to avoid rollback errors
WT-6329 Add stats to track number of entries skipped by cursor next and prev
WT-6332 Don't configure HS cursor walk with test/format in-memory configuration
WT-6333 Fix memory leak in hs_cursor
WT-6334 Coverity: Use return value when closing incremental backup cursor
WT-6335 Formatting cleanups for history-store modify records
WT-6336 Minor cleanup in test/format buffer handling
WT-6337 Temporarily disable format's history store cursor scan
WT-6338 Retrieve at least one key to ensure it's valid for HS cursor scan
WT-6347 Don't reset transaction ids when evicting mixed mode tombstones and clear history store contents for mixed mode updates
WT-6350 Immediately evict the pages that are read by rollback to stable
WT-6352 Remove obsolete options from the wt verify API
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.c | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.h | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/format.h | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/hs.c | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/ops.c | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/salvage.c | 6 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/format/smoke.sh | 20 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/t.c | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/wts.c | 4 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/suite/test_checkpoint04.py | 123 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_hs11.py | 30 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_prepare08.py | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_prepare10.py | 6 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/suite/test_timestamp19.py | 113 |
14 files changed, 131 insertions, 221 deletions
diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c index b48bc0e18a2..dffde8eb25a 100644 --- a/src/third_party/wiredtiger/test/format/config.c +++ b/src/third_party/wiredtiger/test/format/config.c @@ -656,6 +656,8 @@ config_in_memory(void) return; if (config_is_perm("logging")) return; + if (config_is_perm("ops.hs_cursor")) + return; if (config_is_perm("ops.rebalance")) return; if (config_is_perm("ops.salvage")) @@ -685,6 +687,8 @@ config_in_memory_reset(void) config_single("checkpoint=off", false); if (!config_is_perm("btree.compression")) config_single("btree.compression=none", false); + if (!config_is_perm("ops.hs_cursor")) + config_single("ops.hs_cursor=off", false); if (!config_is_perm("logging")) config_single("logging=off", false); if (!config_is_perm("ops.rebalance")) diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h index 3ad4571d41f..80d2ab99cd4 100644 --- a/src/third_party/wiredtiger/test/format/config.h +++ b/src/third_party/wiredtiger/test/format/config.h @@ -228,8 +228,8 @@ static CONFIG c[] = { {"ops.compaction", "if compaction is running", C_BOOL, 10, 0, 0, &g.c_compact, NULL}, /* 50% */ - {"ops.history_store", "if history store cursor reads configured", C_BOOL, 50, 0, 0, - &g.c_hs_cursor, NULL}, + {"ops.hs_cursor", "if history store cursor reads configured", C_BOOL, 50, 0, 0, &g.c_hs_cursor, + NULL}, {"ops.pct.delete", "percent operations that are deletes", C_IGNORE, 0, 0, 100, &g.c_delete_pct, NULL}, diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h index 93e3ab54003..c8bafaaafd8 100644 --- a/src/third_party/wiredtiger/test/format/format.h +++ b/src/third_party/wiredtiger/test/format/format.h @@ -340,8 +340,6 @@ typedef struct { uint64_t insert_list[256]; /* column-store inserted records */ u_int insert_list_cnt; - WT_ITEM *tbuf, _tbuf; /* temporary buffer */ - #define TINFO_RUNNING 1 /* Running */ #define TINFO_COMPLETE 2 /* Finished */ #define TINFO_JOINED 3 /* Resolved */ @@ -403,6 +401,6 @@ void wts_rebalance(void); void wts_reopen(void); void wts_salvage(void); void wts_stats(void); -void wts_verify(const char *); +void wts_verify(WT_CONNECTION *, const char *); #include "format.i" diff --git a/src/third_party/wiredtiger/test/format/hs.c b/src/third_party/wiredtiger/test/format/hs.c index e5d40e6256b..55b298f20e7 100644 --- a/src/third_party/wiredtiger/test/format/hs.c +++ b/src/third_party/wiredtiger/test/format/hs.c @@ -38,7 +38,7 @@ hs_cursor(void *arg) WT_CONNECTION *conn; WT_CURSOR *cursor; WT_DECL_RET; - WT_ITEM hs_key, hs_value; + WT_ITEM hs_key, hs_value, key; WT_SESSION *session; wt_timestamp_t hs_durable_timestamp, hs_start_ts, hs_stop_durable_ts; uint64_t hs_counter, hs_upd_type; @@ -61,6 +61,7 @@ hs_cursor(void *arg) memset(&hs_key, 0, sizeof(hs_key)); memset(&hs_value, 0, sizeof(hs_value)); + memset(&key, 0, sizeof(key)); hs_start_ts = 0; /* [-Wconditional-uninitialized] */ hs_counter = 0; /* [-Wconditional-uninitialized] */ hs_btree_id = 0; /* [-Wconditional-uninitialized] */ @@ -81,13 +82,16 @@ hs_cursor(void *arg) /* Search to the last-known location. */ if (!restart) { - cursor->set_key(cursor, hs_btree_id, &hs_key, hs_start_ts, hs_counter); + cursor->set_key(cursor, hs_btree_id, &key, hs_start_ts, hs_counter); ret = cursor->search_near(cursor, &exact); testutil_assert(ret == 0 || ret == WT_NOTFOUND); } - /* Get some more key/value pairs. */ - for (i = mmrand(NULL, 0, 1000); i > 0; --i) { + /* + * Get some more key/value pairs. Always retrieve at least one key, that ensures we have a + * valid key when we copy it to start the next run. + */ + for (i = mmrand(NULL, 1, 1000); i > 0; --i) { if ((ret = cursor->next(cursor)) == 0) { testutil_check( cursor->get_key(cursor, &hs_btree_id, &hs_key, &hs_start_ts, &hs_counter)); @@ -104,7 +108,7 @@ hs_cursor(void *arg) * Otherwise, reset so we'll start over. */ if (ret == 0) { - testutil_check(__wt_buf_grow(CUR2S(cursor), &hs_key, hs_key.size)); + testutil_check(__wt_buf_set(CUR2S(cursor), &key, hs_key.data, hs_key.size)); restart = false; } else restart = true; @@ -118,6 +122,7 @@ hs_cursor(void *arg) break; } + __wt_buf_free(CUR2S(cursor), &key); testutil_check(session->close(session, NULL)); return (WT_THREAD_RET_VALUE); diff --git a/src/third_party/wiredtiger/test/format/ops.c b/src/third_party/wiredtiger/test/format/ops.c index ac77565170e..82aa22d5f40 100644 --- a/src/third_party/wiredtiger/test/format/ops.c +++ b/src/third_party/wiredtiger/test/format/ops.c @@ -628,7 +628,6 @@ ops(void *arg) val_gen_init(tinfo->value); tinfo->lastkey = &tinfo->_lastkey; key_gen_init(tinfo->lastkey); - tinfo->tbuf = &tinfo->_tbuf; /* Set the first operation where we'll create sessions and cursors. */ cursor = NULL; @@ -1008,7 +1007,6 @@ rollback: key_gen_teardown(tinfo->key); val_gen_teardown(tinfo->value); key_gen_teardown(tinfo->lastkey); - free(tinfo->tbuf->mem); tinfo->state = TINFO_COMPLETE; return (WT_THREAD_RET_VALUE); @@ -1249,16 +1247,13 @@ order_error_col: goto order_error_row; if (!record_gaps) { /* - * Convert the keys to record numbers and then compare less-than-or-equal. (Not + * Convert the keys to record numbers and then compare less-than-or-equal. (It's not * less-than, row-store inserts new rows in-between rows by appending a new suffix - * to the row's key.) + * to the row's key.) Keys are strings with terminating '/' values, so absent key + * corruption, we can simply do the underlying string conversion on the key string. */ - testutil_check(__wt_buf_fmt(CUR2S(cursor), tinfo->tbuf, "%.*s", - (int)tinfo->key->size, (char *)tinfo->key->data)); - keyno_prev = strtoul(tinfo->tbuf->data, NULL, 10); - testutil_check(__wt_buf_fmt( - CUR2S(cursor), tinfo->tbuf, "%.*s", (int)key.size, (char *)key.data)); - keyno = strtoul(tinfo->tbuf->data, NULL, 10); + keyno_prev = strtoul(tinfo->key->data, NULL, 10); + keyno = strtoul(key.data, NULL, 10); if (incrementing) { if (keyno_prev != keyno && keyno_prev + 1 != keyno) goto order_error_row; diff --git a/src/third_party/wiredtiger/test/format/salvage.c b/src/third_party/wiredtiger/test/format/salvage.c index 8f8d3c12786..0e922a71627 100644 --- a/src/third_party/wiredtiger/test/format/salvage.c +++ b/src/third_party/wiredtiger/test/format/salvage.c @@ -139,16 +139,14 @@ wts_salvage(void) /* Salvage, then verify. */ wts_open(g.home, &conn, &session, true); testutil_check(session->salvage(session, g.uri, "force=true")); - -#if 0 - wts_verify("post-salvage verify"); -#endif + wts_verify(conn, "post-salvage verify"); wts_close(&conn, &session); /* Corrupt the file randomly, salvage, then verify. */ if (corrupt()) { wts_open(g.home, &conn, &session, false); testutil_check(session->salvage(session, g.uri, "force=true")); + wts_verify(conn, "post-corrupt-salvage verify"); wts_close(&conn, &session); } } diff --git a/src/third_party/wiredtiger/test/format/smoke.sh b/src/third_party/wiredtiger/test/format/smoke.sh index 067ef8e2589..de46580c078 100755 --- a/src/third_party/wiredtiger/test/format/smoke.sh +++ b/src/third_party/wiredtiger/test/format/smoke.sh @@ -3,7 +3,6 @@ set -e # Smoke-test format as part of running "make check". -args="-1 -c . " args="$args btree.compression=none " args="$args logging_compression=none" args="$args runs.ops=50000 " @@ -11,11 +10,18 @@ args="$args runs.rows=10000 " args="$args runs.source=table " args="$args runs.threads=4 " +# Locate format.sh from home directory. +FORMAT_SCRIPT=$(git rev-parse --show-toplevel)/test/format/format.sh + # Temporarily disabled -# $TEST_WRAPPER ./t $args runs.type=fix -# $TEST_WRAPPER ./t $args runs.type=row runs.source=lsm -# $TEST_WRAPPER ./t $args runs.type=var +# $FORMAT_SCRIPT -t 2 $args runs.type=fix +# $FORMAT_SCRIPT -t 2 $args runs.type=row runs.source=lsm +# $FORMAT_SCRIPT -t 2 $args runs.type=var + +# Run the format script for 10 minutues, distribute it across the number +# of different test arguments. + +# This will run the test/format binary for 5 minutes each. +$FORMAT_SCRIPT -t 5 $args runs.type=row -$TEST_WRAPPER ./t $args runs.type=row -# Force a rebalance to occur with statistics logging to test the utility -$TEST_WRAPPER ./t $args runs.type=row statistics.server=1 ops.rebalance=1 +$FORMAT_SCRIPT -t 5 $args runs.type=row statistics.server=1 ops.rebalance=1 diff --git a/src/third_party/wiredtiger/test/format/t.c b/src/third_party/wiredtiger/test/format/t.c index d363c037ae7..de329749335 100644 --- a/src/third_party/wiredtiger/test/format/t.c +++ b/src/third_party/wiredtiger/test/format/t.c @@ -274,7 +274,7 @@ main(int argc, char *argv[]) trace_init(); TIMED_MAJOR_OP(wts_load()); /* Load and verify initial records */ - TIMED_MAJOR_OP(wts_verify("post-bulk verify")); + TIMED_MAJOR_OP(wts_verify(g.wts_conn, "post-bulk verify")); } TIMED_MAJOR_OP(wts_read_scan()); @@ -292,7 +292,7 @@ main(int argc, char *argv[]) * Verify the objects. Verify closes the underlying handle and discards the statistics, read * them first. */ - TIMED_MAJOR_OP(wts_verify("post-ops verify")); + TIMED_MAJOR_OP(wts_verify(g.wts_conn, "post-ops verify")); track("shutting down", 0ULL, NULL); wts_close(&g.wts_conn, NULL); diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c index 91b8c5051aa..f822a6e8bea 100644 --- a/src/third_party/wiredtiger/test/format/wts.c +++ b/src/third_party/wiredtiger/test/format/wts.c @@ -487,16 +487,14 @@ wts_close(WT_CONNECTION **connp, WT_SESSION **sessionp) } void -wts_verify(const char *tag) +wts_verify(WT_CONNECTION *conn, const char *tag) { - WT_CONNECTION *conn; WT_DECL_RET; WT_SESSION *session; if (g.c_verify == 0) return; - conn = g.wts_conn; track("verify", 0ULL, NULL); testutil_check(conn->open_session(conn, NULL, NULL, &session)); diff --git a/src/third_party/wiredtiger/test/suite/test_checkpoint04.py b/src/third_party/wiredtiger/test/suite/test_checkpoint04.py index b2af62ce4a1..710025067f7 100755 --- a/src/third_party/wiredtiger/test/suite/test_checkpoint04.py +++ b/src/third_party/wiredtiger/test/suite/test_checkpoint04.py @@ -68,63 +68,72 @@ class test_checkpoint04(wttest.WiredTigerTestCase): def test_checkpoint_stats(self): nrows = 100 - ntables = 5 - - # 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) - - # Perform a checkpoint. - self.session.checkpoint() - - # Update the tables. - value = "tiger" * 100 - tables = self.create_tables(ntables) - for uri, ds in tables.items(): - self.add_updates(uri, ds, value, nrows) - - # Perform a checkpoint. - self.session.checkpoint() - - # Check the statistics. - # 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) + ntables = 10 + multiplier = 1 + + # Run the loop and increase the value size with each iteration until + # the test passes. + while True: + # Create many tables and perform many updates so our checkpoint stats are populated. + value = "wired" * 100 * multiplier + tables = self.create_tables(ntables) + for uri, ds in tables.items(): + self.add_updates(uri, ds, value, nrows) + + # Perform a checkpoint. + self.session.checkpoint() + + # Update the tables. + value = "tiger" * 100 * multiplier + tables = self.create_tables(ntables) + for uri, ds in tables.items(): + self.add_updates(uri, ds, value, nrows) + + # Perform a checkpoint. + self.session.checkpoint() + + # Check the statistics. + # 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 * multiplier) + self.assertEqual(running, 0) + self.assertEqual(prep_running, 0) + # Assert if this loop continues for more than 100 iterations. + self.assertLess(multiplier, 100) + + # This condition is mainly to confirm that prep's stats time are always less than time's stats time. + # Run the loop again if any of the below condition fails and exit if the test passes. + if prep_min < time_min and prep_max < time_max and prep_recent < time_recent and prep_total < time_total: + break + else: + multiplier += 1 if __name__ == '__main__': wttest.run() diff --git a/src/third_party/wiredtiger/test/suite/test_hs11.py b/src/third_party/wiredtiger/test/suite/test_hs11.py index efc9d02401c..f7d31c6796f 100644 --- a/src/third_party/wiredtiger/test/suite/test_hs11.py +++ b/src/third_party/wiredtiger/test/suite/test_hs11.py @@ -32,13 +32,12 @@ def timestamp_str(t): return '%x' % t # test_hs11.py -# Ensure that when we delete a key due to a tombstone being globally visible, we delete its -# associated history store content. +# Ensure that mixed mode updates clear the history store records. class test_hs11(wttest.WiredTigerTestCase): conn_config = 'cache_size=50MB' session_config = 'isolation=snapshot' - def test_key_deletion_clears_hs(self): + def run_test(self, update_type): uri = 'table:test_hs11' create_params = 'key_format=S,value_format=S' self.session.create(uri, create_params) @@ -58,14 +57,16 @@ class test_hs11(wttest.WiredTigerTestCase): # Reconcile and flush versions 1-3 to the history store. self.session.checkpoint() - # Apply a non-timestamped tombstone. When the pages get evicted, the keys will get deleted - # since the tombstone is globally visible. + # Apply a mixed mode update. for i in range(1, 10000): if i % 2 == 0: - cursor.set_key(str(i)) - cursor.remove() + if update_type == 'deletion': + cursor.set_key(str(i)) + cursor.remove() + else: + cursor[str(i)] = value2 - # Now apply an update at timestamp 10 to recreate each key. + # Now apply an update at timestamp 10. for i in range(1, 10000): self.session.begin_transaction() cursor[str(i)] = value2 @@ -76,8 +77,17 @@ class test_hs11(wttest.WiredTigerTestCase): self.session.begin_transaction('read_timestamp=' + timestamp_str(ts)) for i in range(1, 10000): if i % 2 == 0: - cursor.set_key(str(i)) - self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND) + if update_type == 'deletion': + cursor.set_key(str(i)) + self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND) + else: + self.assertEqual(cursor[str(i)], value2) else: self.assertEqual(cursor[str(i)], value1) self.session.rollback_transaction() + + def test_key_deletion_clears_hs(self): + self.run_test('deletion') + + def test_key_update_clears_hs(self): + self.run_test('update') diff --git a/src/third_party/wiredtiger/test/suite/test_prepare08.py b/src/third_party/wiredtiger/test/suite/test_prepare08.py index 0ebcec952ce..f3eb9d12881 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare08.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare08.py @@ -37,9 +37,9 @@ def timestamp_str(t): # test_prepare07.py # Test to ensure prepared tombstones are properly aborted even when they are written # to the data store. -class test_prepare07(wttest.WiredTigerTestCase): +class test_prepare08(wttest.WiredTigerTestCase): # Force a small cache. - conn_config = 'cache_size=1MB' + conn_config = 'cache_size=2MB' def updates(self, ds, uri, nrows, value, ts): cursor = self.session.open_cursor(uri) diff --git a/src/third_party/wiredtiger/test/suite/test_prepare10.py b/src/third_party/wiredtiger/test/suite/test_prepare10.py index 7df96ffd2c0..ba1a29718ed 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare10.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare10.py @@ -34,12 +34,12 @@ from wtdataset import SimpleDataSet def timestamp_str(t): return '%x' % t -# test_prepare07.py +# test_prepare10.py # Test to ensure prepared tombstones are properly aborted even when they are written # to the data store. -class test_prepare07(wttest.WiredTigerTestCase): +class test_prepare10(wttest.WiredTigerTestCase): # Force a small cache. - conn_config = 'cache_size=1MB' + conn_config = 'cache_size=2MB' session_config = 'isolation=snapshot' def updates(self, ds, uri, nrows, value, ts): diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp19.py b/src/third_party/wiredtiger/test/suite/test_timestamp19.py deleted file mode 100755 index bb28dce6703..00000000000 --- a/src/third_party/wiredtiger/test/suite/test_timestamp19.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -# -# Public Domain 2014-2020 MongoDB, Inc. -# Public Domain 2008-2014 WiredTiger, Inc. -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# test_timestamp19.py -# Use the oldest checkpoint timestamp in the history store as the minimum valid oldest -# timestamp on restart. -# - -import wiredtiger, wttest -from wtdataset import SimpleDataSet - -def timestamp_str(t): - return '%x' % t - -class test_timestamp19(wttest.WiredTigerTestCase): - conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)' - session_config = 'isolation=snapshot' - - def updates(self, uri, value, ds, nrows, commit_ts): - session = self.session - cursor = session.open_cursor(uri) - for i in range(0, nrows): - session.begin_transaction() - cursor[ds.key(i)] = value - session.commit_transaction('commit_timestamp=' + timestamp_str(commit_ts)) - cursor.close() - - def test_timestamp(self): - uri = "table:test_timestamp19" - create_params = 'value_format=S,key_format=i' - self.session.create(uri, create_params) - - ds = SimpleDataSet( - self, uri, 0, key_format="i", value_format="S", config='log=(enabled=false)') - ds.populate() - - nrows = 1000 - value_x = 'x' * 1000 - value_y = 'y' * 1000 - value_z = 'z' * 1000 - - # Set the oldest and stable timestamps to 10. - self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10) + - ', stable_timestamp=' + timestamp_str(10)) - - # Insert values with varying timestamps. - self.updates(uri, value_x, ds, nrows, 20) - self.updates(uri, value_y, ds, nrows, 30) - self.updates(uri, value_z, ds, nrows, 40) - - # Perform a checkpoint. - self.session.checkpoint('use_timestamp=true') - - # Move the oldest and stable timestamps to 40. - self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(40) + - ', stable_timestamp=' + timestamp_str(40)) - - # Update values. - self.updates(uri, value_z, ds, nrows, 50) - self.updates(uri, value_x, ds, nrows, 60) - self.updates(uri, value_y, ds, nrows, 70) - - # Perform a checkpoint. - self.session.checkpoint('use_timestamp=true') - - # Close and reopen the connection. - self.close_conn() - self.conn = self.setUpConnectionOpen('.') - self.session = self.setUpSessionOpen(self.conn) - - # The oldest timestamp on recovery is 40. Trying to set it earlier is a no-op. - self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(10)) - self.assertTimestampsEqual(self.conn.query_timestamp('get=oldest'), timestamp_str(40)) - - # Trying to set an earlier stable timestamp is an error. - self.assertRaisesWithMessage(wiredtiger.WiredTigerError, - lambda: self.conn.set_timestamp('stable_timestamp=' + timestamp_str(10)), - '/oldest timestamp \(0, 40\) must not be later than stable timestamp \(0, 10\)/') - self.assertTimestampsEqual(self.conn.query_timestamp('get=stable'), timestamp_str(40)) - - # Move the oldest and stable timestamps to 70. - self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(70) + - ', stable_timestamp=' + timestamp_str(70)) - self.assertTimestampsEqual(self.conn.query_timestamp('get=oldest'), timestamp_str(70)) - self.assertTimestampsEqual(self.conn.query_timestamp('get=stable'), timestamp_str(70)) - -if __name__ == '__main__': - wttest.run() |