diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-08-20 16:08:24 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-20 06:33:00 +0000 |
commit | 75d04d3757a9cea8e0d712e05afa6174b5df4892 (patch) | |
tree | eedb3d7dcfffb46791bfd8e61255ea029ad7ed4a /src/third_party/wiredtiger/test/csuite | |
parent | b6ead6db6ea45e5b9b6a549edc9dae1ae20011bc (diff) | |
download | mongo-75d04d3757a9cea8e0d712e05afa6174b5df4892.tar.gz |
Import wiredtiger: b77c2015c6c7a98cf06f7cef7e11bd1bbe686142 from branch mongodb-master
ref: 73489047a5..b77c2015c6
for: 5.1.0
WT-7965 Update connection base write generation number at the end of recovery checkpoint
Diffstat (limited to 'src/third_party/wiredtiger/test/csuite')
11 files changed, 256 insertions, 73 deletions
diff --git a/src/third_party/wiredtiger/test/csuite/Makefile.am b/src/third_party/wiredtiger/test/csuite/Makefile.am index f5c3eaed361..f5da81e75ed 100644 --- a/src/third_party/wiredtiger/test/csuite/Makefile.am +++ b/src/third_party/wiredtiger/test/csuite/Makefile.am @@ -37,7 +37,7 @@ all_TESTS += timestamp_abort/smoke.sh test_truncated_log_SOURCES = truncated_log/main.c noinst_PROGRAMS += test_truncated_log -all_TESTS += test_truncated_log +all_TESTS += truncated_log/smoke.sh test_wt1965_col_efficiency_SOURCES = wt1965_col_efficiency/main.c noinst_PROGRAMS += test_wt1965_col_efficiency @@ -49,8 +49,7 @@ all_TESTS += test_wt2403_lsm_workload test_wt2246_col_append_SOURCES = wt2246_col_append/main.c noinst_PROGRAMS += test_wt2246_col_append -# Temporarily disabled (WT-5790) -# all_TESTS += test_wt2246_col_append +all_TESTS += test_wt2246_col_append test_wt2323_join_visibility_SOURCES = wt2323_join_visibility/main.c noinst_PROGRAMS += test_wt2323_join_visibility @@ -146,11 +145,11 @@ all_TESTS += test_wt4891_meta_ckptlist_get_alloc test_wt6185_modify_ts_SOURCES = wt6185_modify_ts/main.c noinst_PROGRAMS += test_wt6185_modify_ts -all_TESTS += test_wt6185_modify_ts +all_TESTS += wt6185_modify_ts/smoke.sh test_wt6616_checkpoint_oldest_ts_SOURCES = wt6616_checkpoint_oldest_ts/main.c noinst_PROGRAMS += test_wt6616_checkpoint_oldest_ts -all_TESTS += test_wt6616_checkpoint_oldest_ts +all_TESTS += wt6616_checkpoint_oldest_ts/smoke.sh # Run this during a "make check" smoke test. TESTS = $(all_TESTS) diff --git a/src/third_party/wiredtiger/test/csuite/schema_abort/main.c b/src/third_party/wiredtiger/test/csuite/schema_abort/main.c index e16c7d7e79e..acf14348c0a 100644 --- a/src/third_party/wiredtiger/test/csuite/schema_abort/main.c +++ b/src/third_party/wiredtiger/test/csuite/schema_abort/main.c @@ -75,7 +75,7 @@ static const char *const uri_collection = "table:collection"; static const char *const ckpt_file = "checkpoint_done"; -static bool compat, inmem, stable_set, use_ts, use_txn; +static bool compat, inmem, stable_set, use_columns, use_ts, use_txn; static volatile uint64_t global_ts = 1; static volatile uint64_t uid = 1; typedef struct { @@ -96,9 +96,10 @@ static volatile THREAD_TS th_ts[MAX_TH]; /* * A minimum width of 10, along with zero filling, means that all the keys sort according to their - * integer value, making each thread's key space distinct. + * integer value, making each thread's key space distinct. For column-store we just use the integer + * values and that has the same effect. */ -#define KEY_FORMAT ("%010" PRIu64) +#define ROW_KEY_FORMAT ("%010" PRIu64) typedef struct { uint64_t absent_key; /* Last absent key */ @@ -670,14 +671,20 @@ thread_run(void *arg) } if (use_ts) stable_ts = __wt_atomic_addv64(&global_ts, 1); - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, i)); testutil_check(session->begin_transaction(session, NULL)); if (use_prep) testutil_check(oplog_session->begin_transaction(oplog_session, NULL)); - cur_coll->set_key(cur_coll, kname); - cur_local->set_key(cur_local, kname); - cur_oplog->set_key(cur_oplog, kname); + if (use_columns) { + cur_coll->set_key(cur_coll, i + 1); + cur_local->set_key(cur_local, i + 1); + cur_oplog->set_key(cur_oplog, i + 1); + } else { + testutil_check(__wt_snprintf(kname, sizeof(kname), ROW_KEY_FORMAT, i)); + cur_coll->set_key(cur_coll, kname); + cur_local->set_key(cur_local, kname); + cur_oplog->set_key(cur_oplog, kname); + } /* * Put an informative string into the value so that it can be viewed well in a binary dump. */ @@ -764,7 +771,7 @@ run_workload(uint32_t nth) THREAD_DATA *td; wt_thread_t *thr; uint32_t ckpt_id, i, ts_id; - char envconf[512]; + char envconf[512], tableconf[128]; thr = dcalloc(nth + 2, sizeof(*thr)); td = dcalloc(nth + 2, sizeof(THREAD_DATA)); @@ -783,10 +790,13 @@ run_workload(uint32_t nth) /* * Create all the tables. */ - testutil_check( - session->create(session, uri_collection, "key_format=S,value_format=u,log=(enabled=false)")); - testutil_check(session->create(session, uri_local, "key_format=S,value_format=u")); - testutil_check(session->create(session, uri_oplog, "key_format=S,value_format=u")); + testutil_check(__wt_snprintf(tableconf, sizeof(tableconf), + "key_format=%s,value_format=u,log=(enabled=false)", use_columns ? "r" : "S")); + testutil_check(session->create(session, uri_collection, tableconf)); + testutil_check(__wt_snprintf( + tableconf, sizeof(tableconf), "key_format=%s,value_format=u", use_columns ? "r" : "S")); + testutil_check(session->create(session, uri_local, tableconf)); + testutil_check(session->create(session, uri_oplog, tableconf)); /* * Don't log the stable timestamp table so that we know what timestamp was stored at the * checkpoint. @@ -909,11 +919,15 @@ main(int argc, char *argv[]) verify_only = false; working_dir = "WT_TEST.schema-abort"; - while ((ch = __wt_getopt(progname, argc, argv, "Ch:mT:t:vxz")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "Cch:mT:t:vxz")) != EOF) switch (ch) { case 'C': compat = true; break; + case 'c': + /* Variable-length columns only; fixed would require considerable changes */ + use_columns = true; + break; case 'h': working_dir = __wt_optarg; break; @@ -1087,10 +1101,16 @@ main(int argc, char *argv[]) key, last_key); break; } - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, key)); - cur_coll->set_key(cur_coll, kname); - cur_local->set_key(cur_local, kname); - cur_oplog->set_key(cur_oplog, kname); + if (use_columns) { + cur_coll->set_key(cur_coll, key + 1); + cur_local->set_key(cur_local, key + 1); + cur_oplog->set_key(cur_oplog, key + 1); + } else { + testutil_check(__wt_snprintf(kname, sizeof(kname), ROW_KEY_FORMAT, key)); + cur_coll->set_key(cur_coll, kname); + cur_local->set_key(cur_local, kname); + cur_oplog->set_key(cur_oplog, kname); + } /* * The collection table should always only have the data as of the checkpoint. */ diff --git a/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh b/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh index 5e82ae180bc..e7d21ec30e6 100755 --- a/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh @@ -21,6 +21,14 @@ $TEST_WRAPPER $test_bin -t 10 -T 5 $TEST_WRAPPER $test_bin -m -t 10 -T 5 $TEST_WRAPPER $test_bin -C -t 10 -T 5 $TEST_WRAPPER $test_bin -C -m -t 10 -T 5 + +$TEST_WRAPPER $test_bin -c -t 10 -T 5 +$TEST_WRAPPER $test_bin -c -m -t 10 -T 5 +$TEST_WRAPPER $test_bin -c -C -t 10 -T 5 +$TEST_WRAPPER $test_bin -c -C -m -t 10 -T 5 + # FIXME: In WT-6116 the test is failing if timestamps are turned off. #$TEST_WRAPPER $test_bin -m -t 10 -T 5 -z +#$TEST_WRAPPER $test_bin -c -m -t 10 -T 5 -z $TEST_WRAPPER $test_bin -m -t 10 -T 5 -x +$TEST_WRAPPER $test_bin -c -m -t 10 -T 5 -x diff --git a/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c b/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c index 6fa41f0d82c..1d59222104b 100644 --- a/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c +++ b/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c @@ -79,7 +79,7 @@ static const char *const uri_shadow = "shadow"; static const char *const ckpt_file = "checkpoint_done"; -static bool compat, inmem, stress, use_ts; +static bool columns, compat, inmem, stress, use_ts; static volatile uint64_t global_ts = 1; /* @@ -107,9 +107,10 @@ static volatile uint64_t global_ts = 1; /* * A minimum width of 10, along with zero filling, means that all the keys sort according to their - * integer value, making each thread's key space distinct. + * integer value, making each thread's key space distinct. For column-store we just use the integer + * values and that has the same effect. */ -#define KEY_FORMAT ("%010" PRIu64) +#define KEY_STRINGFORMAT ("%010" PRIu64) typedef struct { uint64_t absent_key; /* Last absent key */ @@ -334,8 +335,6 @@ thread_run(void *arg) printf("Thread %" PRIu32 " starts at %" PRIu64 "\n", td->info, td->start); active_ts = 0; for (i = td->start;; ++i) { - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, i)); - testutil_check(session->begin_transaction(session, NULL)); if (use_prep) testutil_check(prepared_session->begin_transaction(prepared_session, NULL)); @@ -354,10 +353,18 @@ thread_run(void *arg) testutil_check(pthread_rwlock_unlock(&ts_lock)); } - cur_coll->set_key(cur_coll, kname); - cur_local->set_key(cur_local, kname); - cur_oplog->set_key(cur_oplog, kname); - cur_shadow->set_key(cur_shadow, kname); + if (columns) { + cur_coll->set_key(cur_coll, i + 1); + cur_local->set_key(cur_local, i + 1); + cur_oplog->set_key(cur_oplog, i + 1); + cur_shadow->set_key(cur_shadow, i + 1); + } else { + testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_STRINGFORMAT, i)); + cur_coll->set_key(cur_coll, kname); + cur_local->set_key(cur_local, kname); + cur_oplog->set_key(cur_oplog, kname); + cur_shadow->set_key(cur_shadow, kname); + } /* * Put an informative string into the value so that it can be viewed well in a binary dump. */ @@ -459,6 +466,7 @@ run_workload(uint32_t nth) wt_thread_t *thr; uint32_t cache_mb, ckpt_id, i, ts_id; char envconf[512], uri[128]; + const char *table_config, *table_config_nolog; thr = dcalloc(nth + 2, sizeof(*thr)); td = dcalloc(nth + 2, sizeof(THREAD_DATA)); @@ -495,19 +503,25 @@ run_workload(uint32_t nth) printf("wiredtiger_open configuration: %s\n", envconf); testutil_check(wiredtiger_open(NULL, NULL, envconf, &conn)); testutil_check(conn->open_session(conn, NULL, NULL, &session)); + /* * Create all the tables. */ + if (columns) { + table_config_nolog = "key_format=r,value_format=u,log=(enabled=false)"; + table_config = "key_format=r,value_format=u"; + } else { + table_config_nolog = "key_format=S,value_format=u,log=(enabled=false)"; + table_config = "key_format=S,value_format=u"; + } testutil_check(__wt_snprintf(uri, sizeof(uri), "%s:%s", table_pfx, uri_collection)); - testutil_check( - session->create(session, uri, "key_format=S,value_format=u,log=(enabled=false)")); + testutil_check(session->create(session, uri, table_config_nolog)); testutil_check(__wt_snprintf(uri, sizeof(uri), "%s:%s", table_pfx, uri_shadow)); - testutil_check( - session->create(session, uri, "key_format=S,value_format=u,log=(enabled=false)")); + testutil_check(session->create(session, uri, table_config_nolog)); testutil_check(__wt_snprintf(uri, sizeof(uri), "%s:%s", table_pfx, uri_local)); - testutil_check(session->create(session, uri, "key_format=S,value_format=u")); + testutil_check(session->create(session, uri, table_config)); testutil_check(__wt_snprintf(uri, sizeof(uri), "%s:%s", table_pfx, uri_oplog)); - testutil_check(session->create(session, uri, "key_format=S,value_format=u")); + testutil_check(session->create(session, uri, table_config)); /* * Don't log the stable timestamp table so that we know what timestamp was stored at the * checkpoint. @@ -616,7 +630,7 @@ main(int argc, char *argv[]) (void)testutil_set_progname(argv); - compat = inmem = stress = false; + columns = compat = inmem = stress = false; use_ts = true; nth = MIN_TH; rand_th = rand_time = true; @@ -624,11 +638,15 @@ main(int argc, char *argv[]) verify_only = false; working_dir = "WT_TEST.timestamp-abort"; - while ((ch = __wt_getopt(progname, argc, argv, "Ch:LmsT:t:vz")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "Cch:LmsT:t:vz")) != EOF) switch (ch) { case 'C': compat = true; break; + case 'c': + /* Variable-length columns only (for now) */ + columns = true; + break; case 'h': working_dir = __wt_optarg; break; @@ -699,9 +717,9 @@ main(int argc, char *argv[]) compat ? "true" : "false", inmem ? "true" : "false", stress ? "true" : "false", use_ts ? "true" : "false"); printf("Parent: Create %" PRIu32 " threads; sleep %" PRIu32 " seconds\n", nth, timeout); - printf("CONFIG: %s%s%s%s%s -h %s -T %" PRIu32 " -t %" PRIu32 "\n", progname, - compat ? " -C" : "", inmem ? " -m" : "", stress ? " -s" : "", !use_ts ? " -z" : "", - working_dir, nth, timeout); + printf("CONFIG: %s%s%s%s%s%s -h %s -T %" PRIu32 " -t %" PRIu32 "\n", progname, + compat ? " -C" : "", columns ? " -c" : "", inmem ? " -m" : "", stress ? " -s" : "", + !use_ts ? " -z" : "", working_dir, nth, timeout); /* * Fork a child to insert as many items. We will then randomly kill the child, run recovery * and make sure all items we wrote exist after recovery runs. @@ -823,11 +841,20 @@ main(int argc, char *argv[]) key, last_key); break; } - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, key)); - cur_coll->set_key(cur_coll, kname); - cur_local->set_key(cur_local, kname); - cur_oplog->set_key(cur_oplog, kname); - cur_shadow->set_key(cur_shadow, kname); + + if (columns) { + cur_coll->set_key(cur_coll, key + 1); + cur_local->set_key(cur_local, key + 1); + cur_oplog->set_key(cur_oplog, key + 1); + cur_shadow->set_key(cur_shadow, key + 1); + } else { + testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_STRINGFORMAT, key)); + cur_coll->set_key(cur_coll, kname); + cur_local->set_key(cur_local, kname); + cur_oplog->set_key(cur_oplog, kname); + cur_shadow->set_key(cur_shadow, kname); + } + /* * The collection table should always only have the data as of the checkpoint. The * shadow table should always have the exact same data (or not) as the collection table, diff --git a/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh b/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh index 18d7f9b8dae..b2c70340f4c 100755 --- a/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh @@ -23,8 +23,12 @@ then fi $TEST_WRAPPER $test_bin $default_test_args +$TEST_WRAPPER $test_bin $default_test_args -c #$TEST_WRAPPER $test_bin $default_test_args -L $TEST_WRAPPER $test_bin -m $default_test_args +$TEST_WRAPPER $test_bin -m $default_test_args -c #$TEST_WRAPPER $test_bin -m $default_test_args -L $TEST_WRAPPER $test_bin -C $default_test_args +$TEST_WRAPPER $test_bin -C $default_test_args -c $TEST_WRAPPER $test_bin -C -m $default_test_args +$TEST_WRAPPER $test_bin -C -m $default_test_args -c diff --git a/src/third_party/wiredtiger/test/csuite/truncated_log/main.c b/src/third_party/wiredtiger/test/csuite/truncated_log/main.c index d46b75d48c9..fa45e573781 100644 --- a/src/third_party/wiredtiger/test/csuite/truncated_log/main.c +++ b/src/third_party/wiredtiger/test/csuite/truncated_log/main.c @@ -32,6 +32,7 @@ static char home[1024]; /* Program working dir */ static const char *const uri = "table:main"; +static bool use_columns = false; #define RECORDS_FILE "records" @@ -128,8 +129,14 @@ fill_db(void) WT_SESSION *session; uint32_t i, max_key, min_key, units, unused; char k[K_SIZE], v[V_SIZE]; + const char *table_config; bool first; + if (use_columns) + table_config = "key_format=r,value_format=S"; + else + table_config = "key_format=S,value_format=S"; + /* * Run in the home directory so that the records file is in there too. */ @@ -137,7 +144,7 @@ fill_db(void) testutil_die(errno, "chdir: %s", home); testutil_check(wiredtiger_open(NULL, NULL, ENV_CONFIG, &conn)); testutil_check(conn->open_session(conn, NULL, NULL, &session)); - testutil_check(session->create(session, uri, "key_format=S,value_format=S")); + testutil_check(session->create(session, uri, table_config)); testutil_check(session->open_cursor(session, uri, NULL, NULL, &cursor)); /* @@ -164,10 +171,14 @@ fill_db(void) max_key = min_key * 2; first = true; for (i = 0; i < max_key; ++i) { - testutil_check(__wt_snprintf(k, sizeof(k), "key%03d", (int)i)); + if (use_columns) + cursor->set_key(cursor, i + 1); + else { + testutil_check(__wt_snprintf(k, sizeof(k), "key%03" PRIu32, i)); + cursor->set_key(cursor, k); + } testutil_check( - __wt_snprintf(v, sizeof(v), "value%0*d", (int)(V_SIZE - (strlen("value") + 1)), (int)i)); - cursor->set_key(cursor, k); + __wt_snprintf(v, sizeof(v), "value%0*" PRIu32, (int)(V_SIZE - (strlen("value") + 1)), i)); cursor->set_value(cursor, v); testutil_check(cursor->insert(cursor)); @@ -230,8 +241,12 @@ main(int argc, char *argv[]) (void)testutil_set_progname(argv); working_dir = "WT_TEST.truncated-log"; - while ((ch = __wt_getopt(progname, argc, argv, "h:")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "ch:")) != EOF) switch (ch) { + case 'c': + /* Variable-length columns only (for now) */ + use_columns = true; + break; case 'h': working_dir = __wt_optarg; break; diff --git a/src/third_party/wiredtiger/test/csuite/truncated_log/smoke.sh b/src/third_party/wiredtiger/test/csuite/truncated_log/smoke.sh new file mode 100755 index 00000000000..0079adf0340 --- /dev/null +++ b/src/third_party/wiredtiger/test/csuite/truncated_log/smoke.sh @@ -0,0 +1,20 @@ +#! /bin/sh + +set -e + +# Smoke-test truncated_log as part of running "make check". + +if [ -n "$1" ] +then + # If the test binary is passed in manually. + test_bin=$1 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_truncated_log +fi + +$TEST_WRAPPER $test_bin +$TEST_WRAPPER $test_bin -c diff --git a/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/main.c b/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/main.c index 1f2e824047b..02205c88429 100644 --- a/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/main.c @@ -50,7 +50,10 @@ static u_int tnext; static uint64_t ts; /* Current timestamp. */ -static char key[100], modify_repl[256], tmp[4 * 1024]; +static char keystr[100], modify_repl[256], tmp[4 * 1024]; +static uint64_t keyrecno; + +static bool use_columns = false; /* * trace -- @@ -117,6 +120,32 @@ mmrand(u_int min, u_int max) } /* + * change_key -- + * Switch to a different key. + */ +static void +change_key(u_int n) +{ + if (use_columns) + keyrecno = n + 1; + else + testutil_check(__wt_snprintf(keystr, sizeof(keystr), "%010u.key", n)); +} + +/* + * set_key -- + * Set the current key in the cursor. + */ +static void +set_key(WT_CURSOR *c) +{ + if (use_columns) + c->set_key(c, keyrecno); + else + c->set_key(c, keystr); +} + +/* * modify_repl_init -- * Initialize the replacement information. */ @@ -181,13 +210,13 @@ modify(WT_SESSION *session, WT_CURSOR *c) for (cnt = loop = 1; loop < 5; ++cnt, ++loop) if (mmrand(1, 10) <= 8) { modify_build(entries, &nentries, cnt); - c->set_key(c, key); + set_key(c); testutil_check(c->modify(c, entries, nentries)); } /* Commit 90% of the time, else rollback. */ if (mmrand(1, 10) != 1) { - c->set_key(c, key); + set_key(c); testutil_check(c->search(c)); testutil_check(c->get_value(c, &v)); free(list[lnext].v); @@ -223,7 +252,7 @@ repeat(WT_SESSION *session, WT_CURSOR *c) testutil_check(__wt_snprintf(tmp, sizeof(tmp), "read_timestamp=%" PRIx64, list[i].ts)); testutil_check(session->timestamp_transaction(session, tmp)); - c->set_key(c, key); + set_key(c); testutil_check(c->search(c)); testutil_check(c->get_value(c, &v)); @@ -246,7 +275,7 @@ evict(WT_CURSOR *c) { trace("%s", "eviction"); - c->set_key(c, key); + set_key(c); testutil_check(c->search(c)); F_SET(c, WT_CURSTD_DEBUG_RESET_EVICT); testutil_check(c->reset(c)); @@ -286,7 +315,7 @@ main(int argc, char *argv[]) WT_SESSION *session; u_int i, j; int ch; - char path[1024], value[VALUE_SIZE]; + char path[1024], table_config[128], value[VALUE_SIZE]; const char *home, *v; bool no_checkpoint, no_eviction; @@ -298,8 +327,12 @@ main(int argc, char *argv[]) no_checkpoint = no_eviction = false; home = "WT_TEST.wt6185_modify_ts"; - while ((ch = __wt_getopt(progname, argc, argv, "ceh:S:")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "Cceh:S:")) != EOF) switch (ch) { + case 'C': + /* Variable-length columns only (for now anyway) */ + use_columns = true; + break; case 'c': no_checkpoint = true; break; @@ -322,14 +355,17 @@ main(int argc, char *argv[]) testutil_work_dir_from_path(path, sizeof(path), home); testutil_make_work_dir(path); + testutil_check(__wt_snprintf( + table_config, sizeof(table_config), "key_format=%s,value_format=S", use_columns ? "r" : "S")); + /* Load 100 records. */ testutil_check(wiredtiger_open(path, NULL, "create", &conn)); testutil_check(conn->open_session(conn, NULL, NULL, &session)); - testutil_check(session->create(session, "file:xxx", "key_format=S,value_format=S")); + testutil_check(session->create(session, "file:xxx", table_config)); testutil_check(session->open_cursor(session, "file:xxx", NULL, NULL, &c)); for (i = 0; i <= 100; ++i) { - testutil_check(__wt_snprintf(key, sizeof(key), "%010u.key", i)); - c->set_key(c, key); + change_key(i); + set_key(c); SET_VALUE(i, value); c->set_value(c, value); testutil_check(c->insert(c)); @@ -341,8 +377,8 @@ main(int argc, char *argv[]) testutil_check(conn->open_session(conn, NULL, NULL, &session)); testutil_check(session->create(session, "file:xxx", NULL)); testutil_check(session->open_cursor(session, "file:xxx", NULL, NULL, &c)); - testutil_check(__wt_snprintf(key, sizeof(key), "%010d.key", KEYNO)); - c->set_key(c, key); + change_key(KEYNO); + set_key(c); testutil_check(c->search(c)); testutil_check(c->get_value(c, &v)); SET_VALUE(KEYNO, value); diff --git a/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/smoke.sh b/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/smoke.sh new file mode 100755 index 00000000000..b317eeeb2ed --- /dev/null +++ b/src/third_party/wiredtiger/test/csuite/wt6185_modify_ts/smoke.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +set -e + +# Smoke-test wt6185_modify_ts as part of running "make check". + +if [ -n "$1" ] +then + # If the test binary is passed in manually. + test_bin=$1 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_wt6185_modify_ts +fi + +$TEST_WRAPPER $test_bin +$TEST_WRAPPER $test_bin -C + diff --git a/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/main.c b/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/main.c index 5a75777aa78..2e9648efea0 100644 --- a/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/main.c @@ -32,6 +32,7 @@ #include <signal.h> static char home[1024]; /* Program working dir */ +static bool use_columns = false; /* * Spin up a child process to do operations and checkpoint. For each set of operations on a key, @@ -48,7 +49,7 @@ static char home[1024]; /* Program working dir */ * recovery by reading without a timestamp. Whether it is possible to read historical versions based * on timestamps from a logged table after recovery is not defined and implemented yet. */ -#define KEY_FORMAT ("%010" PRIu64) +#define ROW_KEY_FORMAT ("%010" PRIu64) #define MAX_CKPT_INVL 5 /* Maximum interval between checkpoints */ #define MAX_DATA 1000 @@ -147,11 +148,14 @@ thread_run(void *arg) /* Insert and then delete the keys until we're killed. */ printf("Worker thread started.\n"); for (oldest_ts = 0, ts = 1;; ++ts) { - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, ts)); + testutil_check(__wt_snprintf(kname, sizeof(kname), ROW_KEY_FORMAT, ts)); /* Insert the same value for key and value. */ testutil_check(session->begin_transaction(session, NULL)); - cursor->set_key(cursor, kname); + if (use_columns) + cursor->set_key(cursor, ts); + else + cursor->set_key(cursor, kname); data.data = kname; data.size = sizeof(kname); cursor->set_value(cursor, &data); @@ -193,7 +197,7 @@ run_workload(void) WT_SESSION *session; wt_thread_t *thr; uint32_t i; - char envconf[512]; + char envconf[512], tableconf[512]; thr = dcalloc(2, sizeof(*thr)); @@ -206,8 +210,9 @@ run_workload(void) testutil_check(conn->open_session(conn, NULL, NULL, &session)); /* Create the table. */ - testutil_check( - session->create(session, uri, "key_format=S,value_format=u,log=(enabled=false)")); + testutil_check(__wt_snprintf(tableconf, sizeof(tableconf), + "key_format=%s,value_format=u,log=(enabled=false)", use_columns ? "r" : "S")); + testutil_check(session->create(session, uri, tableconf)); testutil_check(session->close(session, NULL)); /* The checkpoint thread is added at the end. */ @@ -268,8 +273,12 @@ main(int argc, char *argv[]) timeout = MIN_TIME; working_dir = "WT_TEST.wt6616-checkpoint-oldest-ts"; - while ((ch = __wt_getopt(progname, argc, argv, "h:t:")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "ch:t:")) != EOF) switch (ch) { + case 'c': + /* Variable-length columns only (for now) */ + use_columns = true; + break; case 'h': working_dir = __wt_optarg; break; @@ -363,8 +372,11 @@ main(int argc, char *argv[]) for (ts = oldest_ts; ts <= stable_ts; ++ts) { testutil_check(__wt_snprintf(tscfg, sizeof(tscfg), "read_timestamp=%" PRIx64, ts)); testutil_check(session->begin_transaction(session, tscfg)); - testutil_check(__wt_snprintf(kname, sizeof(kname), KEY_FORMAT, ts)); - cursor->set_key(cursor, kname); + testutil_check(__wt_snprintf(kname, sizeof(kname), ROW_KEY_FORMAT, ts)); + if (use_columns) + cursor->set_key(cursor, ts); + else + cursor->set_key(cursor, kname); ret = cursor->search(cursor); if (ret == WT_NOTFOUND) { fatal = true; diff --git a/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/smoke.sh b/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/smoke.sh new file mode 100755 index 00000000000..9b9cc997026 --- /dev/null +++ b/src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/smoke.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +set -e + +# Smoke-test wt6616_checkpoint_oldest_ts as part of running "make check". + +if [ -n "$1" ] +then + # If the test binary is passed in manually. + test_bin=$1 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_wt6616_checkpoint_oldest_ts +fi + +$TEST_WRAPPER $test_bin +$TEST_WRAPPER $test_bin -c + |