summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2022-11-02 11:57:11 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-02 02:00:19 +0000
commit9cec07e2c0ca6d5a8e7cc71da82c8c9abb420f86 (patch)
tree61b7bf4f37341f3118c52425cb015e574e3293d1
parent4d509d921dac2738a4673c69a40385ecef2b126d (diff)
downloadmongo-9cec07e2c0ca6d5a8e7cc71da82c8c9abb420f86.tar.gz
Import wiredtiger: 63e42104c5319d64992ecf73d09e03e221b1b62b from branch mongodb-master
ref: b95995c695..63e42104c5 for: 6.2.0-rc0 WT-9871 schema_abort : Parse tiered_storage config and move other common config options to test_util
-rw-r--r--src/third_party/wiredtiger/dist/s_string.ok1
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/test/csuite/random_abort/main.c6
-rw-r--r--src/third_party/wiredtiger/test/csuite/random_directio/main.c3
-rw-r--r--src/third_party/wiredtiger/test/csuite/schema_abort/main.c97
-rw-r--r--src/third_party/wiredtiger/test/csuite/tiered_abort/main.c4
-rw-r--r--src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c4
-rw-r--r--src/third_party/wiredtiger/test/csuite/truncated_log/main.c4
-rw-r--r--src/third_party/wiredtiger/test/csuite/wt6616_checkpoint_oldest_ts/main.c5
-rw-r--r--src/third_party/wiredtiger/test/csuite/wt8246_compact_rts_data_correctness/main.c4
-rw-r--r--src/third_party/wiredtiger/test/utility/misc.c16
-rw-r--r--src/third_party/wiredtiger/test/utility/parse_opts.c22
-rw-r--r--src/third_party/wiredtiger/test/utility/test_util.h14
13 files changed, 96 insertions, 86 deletions
diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok
index 3e322bb6772..7e8eafdbc0e 100644
--- a/src/third_party/wiredtiger/dist/s_string.ok
+++ b/src/third_party/wiredtiger/dist/s_string.ok
@@ -92,6 +92,7 @@ Checksum
Checksums
CityHash
CloseHandle
+CmPTh
Cmvz
Collet
Comparator
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 651542a9e1a..3f6f20d87f2 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-master",
- "commit": "b95995c695679af17767e64261031e02bcad31fb"
+ "commit": "63e42104c5319d64992ecf73d09e03e221b1b62b"
}
diff --git a/src/third_party/wiredtiger/test/csuite/random_abort/main.c b/src/third_party/wiredtiger/test/csuite/random_abort/main.c
index a3a4e35f997..ff06a4bb6bc 100644
--- a/src/third_party/wiredtiger/test/csuite/random_abort/main.c
+++ b/src/third_party/wiredtiger/test/csuite/random_abort/main.c
@@ -61,14 +61,12 @@ static bool inmem;
#define MODIFY_RECORD_FILE_ID 2
#define MAX_RECORD_FILES 3
-#define ENV_CONFIG_COMPAT ",compatibility=(release=\"2.9\")"
#define ENV_CONFIG_DEF \
"create,log=(file_max=10M,enabled),statistics=(all),statistics_log=(json,on_close,wait=1)"
#define ENV_CONFIG_TXNSYNC \
"create,log=(file_max=10M,enabled)," \
"transaction_sync=(enabled,method=none),statistics=(all),statistics_log=(json,on_close,wait=" \
"1)"
-#define ENV_CONFIG_REC "log=(recover=on),statistics=(all),statistics_log=(json,on_close,wait=1)"
/*
* A minimum width of 10, along with zero filling, means that all the keys sort according to their
@@ -326,7 +324,7 @@ fill_db(uint32_t nth)
else
strcpy(envconf, ENV_CONFIG_TXNSYNC);
if (compat)
- strcat(envconf, ENV_CONFIG_COMPAT);
+ strcat(envconf, TESTUTIL_ENV_CONFIG_COMPAT);
testutil_check(wiredtiger_open(NULL, NULL, envconf, &conn));
testutil_check(conn->open_session(conn, NULL, NULL, &session));
@@ -396,7 +394,7 @@ recover_and_verify(uint32_t nthreads)
bool columnar_table, fatal;
printf("Open database, run recovery and verify content\n");
- testutil_check(wiredtiger_open(NULL, NULL, ENV_CONFIG_REC, &conn));
+ testutil_check(wiredtiger_open(NULL, NULL, TESTUTIL_ENV_CONFIG_REC, &conn));
testutil_check(conn->open_session(conn, NULL, NULL, &session));
testutil_check(session->open_cursor(session, col_uri, NULL, NULL, &col_cursor));
testutil_check(session->open_cursor(session, uri, NULL, NULL, &row_cursor));
diff --git a/src/third_party/wiredtiger/test/csuite/random_directio/main.c b/src/third_party/wiredtiger/test/csuite/random_directio/main.c
index 25b968d35fe..7e39b504967 100644
--- a/src/third_party/wiredtiger/test/csuite/random_directio/main.c
+++ b/src/third_party/wiredtiger/test/csuite/random_directio/main.c
@@ -107,7 +107,6 @@ static const char *const uri_rev = "table:rev";
#define ENV_CONFIG_TIER_EXT \
",extensions=(%s../../../ext/storage_sources/dir_store/" \
"libwiredtiger_dir_store.so=(early_load=true))"
-#define ENV_CONFIG_REC "log=(recover=on),statistics=(all),statistics_log=(json,on_close,wait=1)"
/* 64 spaces */
#define SPACES " "
@@ -934,7 +933,7 @@ check_db(uint32_t nth, uint32_t datasize, pid_t pid, bool directio, uint32_t fla
copy_directory(checkdir, savedir, false);
printf("Open database, run recovery and verify content\n");
- testutil_check(__wt_snprintf(envconf, sizeof(envconf), ENV_CONFIG_REC));
+ testutil_check(__wt_snprintf(envconf, sizeof(envconf), TESTUTIL_ENV_CONFIG_REC));
if (LF_ISSET(TEST_TIERED)) {
testutil_check(__wt_snprintf(tierconf, sizeof(tierconf), ENV_CONFIG_TIER_EXT, ""));
strcat(envconf, tierconf);
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 90aab3a072c..090a3190bcb 100644
--- a/src/third_party/wiredtiger/test/csuite/schema_abort/main.c
+++ b/src/third_party/wiredtiger/test/csuite/schema_abort/main.c
@@ -76,7 +76,7 @@ static const char *const uri_collection = "table:collection";
static const char *const ckpt_file = "checkpoint_done";
-static bool compat, inmem, tiered, use_columns, use_ts, use_txn;
+static bool tiered, use_columns, use_ts, use_txn;
static volatile bool stable_set;
static volatile uint64_t global_ts = 1;
static volatile uint64_t uid = 1;
@@ -86,23 +86,17 @@ typedef struct {
} THREAD_TS;
static volatile THREAD_TS th_ts[MAX_TH];
-#define ENV_CONFIG_COMPAT ",compatibility=(release=\"2.9\")"
+static TEST_OPTS *opts, _opts;
+
#define ENV_CONFIG_DEF \
"create," \
"eviction_updates_trigger=95,eviction_updates_target=80," \
"log=(enabled,file_max=10M,remove=false),statistics=(all),statistics_log=(json,on_close,wait=" \
"1)"
-#define ENV_CONFIG_TIER \
- ",tiered_storage=(bucket=./" \
- "bucket,bucket_prefix=pfx-,local_retention=2,name=dir_store)"
-#define ENV_CONFIG_TIER_EXT \
- ",extensions=(../../../../ext/storage_sources/dir_store/" \
- "libwiredtiger_dir_store.so=(early_load=true))"
+
#define ENV_CONFIG_TXNSYNC \
ENV_CONFIG_DEF \
",transaction_sync=(enabled,method=none)"
-#define ENV_CONFIG_REC \
- "log=(recover=on,remove=false),statistics=(all),statistics_log=(json,on_close,wait=1)"
/*
* A minimum width of 10, along with zero filling, means that all the keys sort according to their
@@ -830,18 +824,14 @@ run_workload(uint32_t nth)
stable_set = false;
if (chdir(home) != 0)
testutil_die(errno, "Child chdir: %s", home);
- if (inmem)
+ if (opts->inmem)
strcpy(envconf, ENV_CONFIG_DEF);
else
strcpy(envconf, ENV_CONFIG_TXNSYNC);
- if (compat)
- strcat(envconf, ENV_CONFIG_COMPAT);
- if (tiered) {
- strcat(envconf, ENV_CONFIG_TIER_EXT);
- strcat(envconf, ENV_CONFIG_TIER);
- }
- testutil_check(wiredtiger_open(NULL, &event_handler, envconf, &conn));
+ /* Open WiredTiger without recovery. */
+ testutil_wiredtiger_open(opts, envconf, &event_handler, &conn, false);
+
testutil_check(conn->open_session(conn, NULL, NULL, &session));
/*
* Create all the tables.
@@ -964,12 +954,14 @@ main(int argc, char *argv[])
int ch, status;
char buf[1024], statname[1024];
char fname[64], kname[64];
- const char *working_dir;
- bool fatal, preserve, rand_th, rand_time, verify_only;
+ bool fatal, rand_th, rand_time, verify_only;
(void)testutil_set_progname(argv);
- compat = inmem = tiered = false;
+ buf[0] = '\0';
+ opts = &_opts;
+ memset(opts, 0, sizeof(*opts));
+ tiered = false;
use_ts = true;
/*
* Setting this to false forces us to use internal library code. Allow an override but default
@@ -977,33 +969,21 @@ main(int argc, char *argv[])
*/
use_txn = false;
nth = MIN_TH;
- preserve = false;
rand_th = rand_time = true;
timeout = MIN_TIME;
verify_only = false;
- working_dir = "WT_TEST.schema-abort";
- while ((ch = __wt_getopt(progname, argc, argv, "BCch:mpT:t:vxz")) != EOF)
+ testutil_parse_begin_opt(argc, argv, "b:CmPTh:pv", opts);
+
+ while ((ch = __wt_getopt(progname, argc, argv, "BCch:mpP:T:t:vxz")) != EOF)
switch (ch) {
case 'B':
tiered = true;
break;
- 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;
- case 'm':
- inmem = true;
- break;
- case 'p':
- preserve = true;
- break;
case 'T':
rand_th = false;
nth = (uint32_t)atoi(__wt_optarg);
@@ -1022,13 +1002,19 @@ main(int argc, char *argv[])
use_ts = false;
break;
default:
- usage();
+ /* The option is either one that we're asking testutil to support, or illegal. */
+ if (testutil_parse_single_opt(opts, ch) != 0) {
+ usage();
+ }
}
argc -= __wt_optind;
if (argc != 0)
usage();
- testutil_work_dir_from_path(home, sizeof(home), working_dir);
+ testutil_parse_end_opt(opts);
+
+ testutil_work_dir_from_path(home, sizeof(home), opts->home);
+
/*
* If the user wants to verify they need to tell us how many threads there were so we can find
* the old record files.
@@ -1039,7 +1025,7 @@ main(int argc, char *argv[])
}
if (!verify_only) {
testutil_make_work_dir(home);
- if (tiered) {
+ if (opts->tiered_storage) {
testutil_check(__wt_snprintf(buf, sizeof(buf), "%s/bucket", home));
testutil_make_work_dir(buf);
}
@@ -1059,12 +1045,12 @@ main(int argc, char *argv[])
printf(
"Parent: compatibility: %s, in-mem log sync: %s, timestamp in use: %s, tiered in use: "
"%s\n",
- compat ? "true" : "false", inmem ? "true" : "false", use_ts ? "true" : "false",
- tiered ? "true" : "false");
+ opts->compat ? "true" : "false", opts->inmem ? "true" : "false",
+ use_ts ? "true" : "false", opts->tiered_storage ? "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" : "", tiered ? " -B" : "", !use_ts ? " -z" : "",
- working_dir, nth, timeout);
+ opts->compat ? " -C" : "", opts->inmem ? " -m" : "", opts->tiered_storage ? " -B" : "",
+ !use_ts ? " -z" : "", opts->home, 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.
@@ -1114,15 +1100,11 @@ main(int argc, char *argv[])
testutil_copy_data(home);
printf("Open database, run recovery and verify content\n");
- strcpy(buf, ENV_CONFIG_REC);
- if (tiered) {
- strcat(buf, ENV_CONFIG_TIER_EXT);
- strcat(buf, ENV_CONFIG_TIER);
- }
/*
* Open the connection which forces recovery to be run.
*/
- testutil_check(wiredtiger_open(NULL, &event_handler, buf, &conn));
+ testutil_wiredtiger_open(opts, buf, &event_handler, &conn, true);
+
testutil_check(conn->open_session(conn, NULL, NULL, &session));
/*
* Open a cursor on all the tables.
@@ -1204,7 +1186,7 @@ main(int argc, char *argv[])
* If we don't find a record, the stable timestamp written to our file better be
* larger than the saved one.
*/
- if (!inmem && stable_fp != 0 && stable_fp <= stable_val) {
+ if (!opts->inmem && stable_fp != 0 && stable_fp <= stable_val) {
printf("%s: COLLECTION no record with key %" PRIu64 " record ts %" PRIu64
" <= stable ts %" PRIu64 "\n",
fname, key, stable_fp, stable_val);
@@ -1220,7 +1202,7 @@ main(int argc, char *argv[])
*/
c_rep[i].exist_key = key;
fatal = true;
- } else if (!inmem && stable_fp != 0 && stable_fp > stable_val) {
+ } else if (!opts->inmem && stable_fp != 0 && stable_fp > stable_val) {
/*
* If we found a record, the stable timestamp written to our file better be no
* larger than the checkpoint one.
@@ -1236,7 +1218,7 @@ main(int argc, char *argv[])
if ((ret = cur_local->search(cur_local)) != 0) {
if (ret != WT_NOTFOUND)
testutil_die(ret, "search");
- if (!inmem)
+ if (!opts->inmem)
printf("%s: LOCAL no record with key %" PRIu64 "\n", fname, key);
absent_local++;
if (l_rep[i].first_miss == INVALID_KEY)
@@ -1255,7 +1237,7 @@ main(int argc, char *argv[])
if ((ret = cur_oplog->search(cur_oplog)) != 0) {
if (ret != WT_NOTFOUND)
testutil_die(ret, "search");
- if (!inmem)
+ if (!opts->inmem)
printf("%s: OPLOG no record with key %" PRIu64 "\n", fname, key);
absent_oplog++;
if (o_rep[i].first_miss == INVALID_KEY)
@@ -1278,27 +1260,28 @@ main(int argc, char *argv[])
print_missing(&o_rep[i], fname, "OPLOG");
}
testutil_check(conn->close(conn, NULL));
- if (!inmem && absent_coll) {
+ if (!opts->inmem && absent_coll) {
printf("COLLECTION: %" PRIu64 " record(s) absent from %" PRIu64 "\n", absent_coll, count);
fatal = true;
}
- if (!inmem && absent_local) {
+ if (!opts->inmem && absent_local) {
printf("LOCAL: %" PRIu64 " record(s) absent from %" PRIu64 "\n", absent_local, count);
fatal = true;
}
- if (!inmem && absent_oplog) {
+ if (!opts->inmem && absent_oplog) {
printf("OPLOG: %" PRIu64 " record(s) absent from %" PRIu64 "\n", absent_oplog, count);
fatal = true;
}
if (fatal)
return (EXIT_FAILURE);
printf("%" PRIu64 " records verified\n", count);
- if (!preserve) {
+ if (!opts->preserve) {
testutil_clean_test_artifacts(home);
/* At this point $PATH is inside `home`, which we intend to delete. cd to the parent dir. */
if (chdir("../") != 0)
testutil_die(errno, "root chdir: %s", home);
testutil_clean_work_dir(home);
}
+ testutil_cleanup(opts);
return (EXIT_SUCCESS);
}
diff --git a/src/third_party/wiredtiger/test/csuite/tiered_abort/main.c b/src/third_party/wiredtiger/test/csuite/tiered_abort/main.c
index c188603f513..dae2aeb9799 100644
--- a/src/third_party/wiredtiger/test/csuite/tiered_abort/main.c
+++ b/src/third_party/wiredtiger/test/csuite/tiered_abort/main.c
@@ -109,7 +109,7 @@ static uint32_t flush_calls = 1;
",eviction_dirty_target=20,eviction_dirty_trigger=90" \
",transaction_sync=(enabled,method=none)"
/* Set the flush_checkpoint debug mode so that the parent can call flush_tier alone. */
-#define ENV_CONFIG_REC \
+#define ENV_CONFIG_ADD_REC \
"log=(recover=on,remove=false),debug_mode=(flush_checkpoint),statistics=(all),statistics_log=" \
"(json,on_close,wait=1)"
@@ -802,7 +802,7 @@ main(int argc, char *argv[])
printf("Open database, run recovery and verify content\n");
/* Open the connection which forces recovery to be run. */
- testutil_check(__wt_snprintf(envconf, sizeof(envconf), ENV_CONFIG_REC));
+ testutil_check(__wt_snprintf(envconf, sizeof(envconf), ENV_CONFIG_ADD_REC));
testutil_check(__wt_snprintf(extconf, sizeof(extconf), ",extensions=(%s/%s=(early_load=true))",
build_dir, WT_STORAGE_LIB));
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 4c68871b04c..d91be97c5a2 100644
--- a/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c
+++ b/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c
@@ -105,8 +105,6 @@ static uint64_t global_ts = 1;
#define ENV_CONFIG_TXNSYNC \
ENV_CONFIG_DEF \
",transaction_sync=(enabled,method=none)"
-#define ENV_CONFIG_REC \
- "log=(recover=on,remove=false),statistics=(all),statistics_log=(json,on_close,wait=1)"
/*
* A minimum width of 10, along with zero filling, means that all the keys sort according to their
@@ -905,7 +903,7 @@ main(int argc, char *argv[])
/*
* Open the connection which forces recovery to be run.
*/
- testutil_check(wiredtiger_open(NULL, &my_event, ENV_CONFIG_REC, &conn));
+ testutil_check(wiredtiger_open(NULL, &my_event, TESTUTIL_ENV_CONFIG_REC, &conn));
printf("Connection open and recovery complete. Verify content\n");
/* Sleep to guarantee the statistics thread has enough time to run. */
usleep(USEC_STAT + 10);
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 568c7ba0f0a..5774ff17d23 100644
--- a/src/third_party/wiredtiger/test/csuite/truncated_log/main.c
+++ b/src/third_party/wiredtiger/test/csuite/truncated_log/main.c
@@ -40,7 +40,7 @@ static bool use_columns = false;
"create,log=(enabled,file_max=100K,remove=false)," \
"transaction_sync=(enabled,method=none),statistics=(all),statistics_log=(json,on_close,wait=" \
"1)"
-#define ENV_CONFIG_REC "log=(recover=on),statistics=(all),statistics_log=(json,on_close,wait=1)"
+#define ENV_CONFIG_ADD_REC "log=(recover=on),statistics=(all),statistics_log=(json,on_close,wait=1)"
#define LOG_FILE_1 "WiredTigerLog.0000000001"
@@ -319,7 +319,7 @@ main(int argc, char *argv[])
if (truncate(LOG_FILE_1, (wt_off_t)new_offset) != 0)
testutil_die(errno, "truncate");
- testutil_check(wiredtiger_open(NULL, NULL, ENV_CONFIG_REC, &conn));
+ testutil_check(wiredtiger_open(NULL, NULL, ENV_CONFIG_ADD_REC, &conn));
testutil_check(conn->open_session(conn, NULL, NULL, &session));
testutil_check(session->open_cursor(session, uri, NULL, NULL, &cursor));
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 129ccd3f022..cc240fe1453 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
@@ -68,9 +68,6 @@ static const char *const ckpt_file = "checkpoint_done";
"statistics=(all),statistics_log=(json,on_close,wait=1)," \
"timing_stress_for_test=[checkpoint_slow]"
-#define ENV_CONFIG_REC \
- "log=(recover=on,remove=false),statistics=(all),statistics_log=(json,on_close,wait=1)"
-
static void handler(int) WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn));
static void usage(void) WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn));
@@ -368,7 +365,7 @@ main(int argc, char *argv[])
printf("Open database and run recovery\n");
/* Open the connection which forces recovery to be run. */
- testutil_check(wiredtiger_open(NULL, NULL, ENV_CONFIG_REC, &conn));
+ testutil_check(wiredtiger_open(NULL, NULL, TESTUTIL_ENV_CONFIG_REC, &conn));
testutil_check(conn->open_session(conn, NULL, NULL, &session));
/* Get the stable timestamp from the stable timestamp of the last successful checkpoint. */
diff --git a/src/third_party/wiredtiger/test/csuite/wt8246_compact_rts_data_correctness/main.c b/src/third_party/wiredtiger/test/csuite/wt8246_compact_rts_data_correctness/main.c
index 64f9270b370..ab43a5415ba 100644
--- a/src/third_party/wiredtiger/test/csuite/wt8246_compact_rts_data_correctness/main.c
+++ b/src/third_party/wiredtiger/test/csuite/wt8246_compact_rts_data_correctness/main.c
@@ -33,8 +33,6 @@
#define NUM_RECORDS 800000
-#define ENV_CONFIG_REC \
- "log=(recover=on,remove=false),statistics=(all),statistics_log=(json,on_close,wait=1)"
/* Constants and variables declaration. */
/*
* You may want to add "verbose=[compact,compact_progress]" to the connection config string to get
@@ -182,7 +180,7 @@ run_test(bool column_store, const char *uri, bool preserve)
printf("Open database and run recovery\n");
/* Open the connection which forces recovery to be run. */
- testutil_check(wiredtiger_open(home, NULL, ENV_CONFIG_REC, &conn));
+ testutil_check(wiredtiger_open(home, NULL, TESTUTIL_ENV_CONFIG_REC, &conn));
testutil_check(conn->open_session(conn, NULL, NULL, &session));
/*
diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c
index 896efe68aff..eeb6b1d5cbb 100644
--- a/src/third_party/wiredtiger/test/utility/misc.c
+++ b/src/third_party/wiredtiger/test/utility/misc.c
@@ -358,6 +358,22 @@ testutil_print_command_line(int argc, char *const *argv)
printf("\n");
}
+/*
+ * testutil_wiredtiger_open --
+ * Call wiredtiger_open with the tiered storage configuration if enabled.
+ */
+void
+testutil_wiredtiger_open(TEST_OPTS *opts, const char *config, WT_EVENT_HANDLER *event_handler,
+ WT_CONNECTION **connectionp, bool rerun)
+{
+ char buf[1024];
+
+ testutil_check(__wt_snprintf(buf, sizeof(buf), "%s%s%s%s", config,
+ (rerun ? TESTUTIL_ENV_CONFIG_REC : ""), (opts->compat ? TESTUTIL_ENV_CONFIG_COMPAT : ""),
+ (opts->tiered_storage ? TESTUTIL_ENV_CONFIG_TIERED_EXT TESTUTIL_ENV_CONFIG_TIERED : "")));
+ testutil_check(wiredtiger_open(NULL, event_handler, buf, connectionp));
+}
+
#ifndef _WIN32
/*
* testutil_sleep_wait --
diff --git a/src/third_party/wiredtiger/test/utility/parse_opts.c b/src/third_party/wiredtiger/test/utility/parse_opts.c
index e8d5b9a18c7..faee1f15de3 100644
--- a/src/third_party/wiredtiger/test/utility/parse_opts.c
+++ b/src/third_party/wiredtiger/test/utility/parse_opts.c
@@ -50,7 +50,7 @@ extern int __wt_optreset;
* parse_tiered_opt --
* Parse a command line option for the tiered storage configurations.
*/
-static inline void
+static void
parse_tiered_opt(TEST_OPTS *opts)
{
switch (*__wt_optarg++) {
@@ -91,14 +91,14 @@ testutil_parse_begin_opt(int argc, char *const *argv, const char *getopts_string
#define USAGE_STR(ch, usage) ((strchr(getopts_string, (ch)) == NULL) ? "" : (usage))
- testutil_check(__wt_snprintf(opts->usage, sizeof(opts->usage), "%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ testutil_check(__wt_snprintf(opts->usage, sizeof(opts->usage), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
USAGE_STR('A', " [-A append thread count]"), USAGE_STR('b', " [-b build directory]"),
- USAGE_STR('d', " [-d add data]"), USAGE_STR('h', " [-h home]"),
- USAGE_STR('n', " [-n record count]"), USAGE_STR('o', " [-o op count]"),
- USAGE_STR('P', " [-PT] [-Po storage source]"), USAGE_STR('p', " [-p]"),
- USAGE_STR('R', " [-R read thread count]"), USAGE_STR('T', " [-T thread count]"),
- USAGE_STR('t', " [-t c|f|r table type]"), USAGE_STR('v', " [-v]"),
- USAGE_STR('W', " [-W write thread count]")));
+ USAGE_STR('C', " [-C]"), USAGE_STR('d', " [-d add data]"), USAGE_STR('h', " [-h home]"),
+ USAGE_STR('m', " [-m]"), USAGE_STR('n', " [-n record count]"),
+ USAGE_STR('o', " [-o op count]"), USAGE_STR('P', " [-PT] [-Po storage source]"),
+ USAGE_STR('p', " [-p]"), USAGE_STR('R', " [-R read thread count]"),
+ USAGE_STR('T', " [-T thread count]"), USAGE_STR('t', " [-t c|f|r table type]"),
+ USAGE_STR('v', " [-v]"), USAGE_STR('W', " [-W write thread count]")));
}
/*
@@ -153,12 +153,18 @@ testutil_parse_single_opt(TEST_OPTS *opts, int ch)
case 'b': /* Build directory */
opts->build_dir = dstrdup(__wt_optarg);
break;
+ case 'C': /* Compatibility */
+ opts->compat = true;
+ break;
case 'd': /* Use data in multi-threaded test programs */
opts->do_data_ops = true;
break;
case 'h': /* Home directory */
opts->home = dstrdup(__wt_optarg);
break;
+ case 'm': /* In-memory */
+ opts->inmem = true;
+ break;
case 'n': /* Number of records */
opts->nrecords = (uint64_t)atoll(__wt_optarg);
break;
diff --git a/src/third_party/wiredtiger/test/utility/test_util.h b/src/third_party/wiredtiger/test/utility/test_util.h
index a0a9cae3efa..73ab9ed4427 100644
--- a/src/third_party/wiredtiger/test/utility/test_util.h
+++ b/src/third_party/wiredtiger/test/utility/test_util.h
@@ -49,6 +49,16 @@
#include "windows_shim.h"
#endif
+#define TESTUTIL_ENV_CONFIG_TIERED \
+ ",tiered_storage=(bucket=./" \
+ "bucket,bucket_prefix=pfx-,local_retention=2,name=dir_store)"
+#define TESTUTIL_ENV_CONFIG_TIERED_EXT \
+ ",extensions=(../../../../ext/storage_sources/dir_store/" \
+ "libwiredtiger_dir_store.so=(early_load=true))"
+#define TESTUTIL_ENV_CONFIG_REC \
+ ",log=(recover=on,remove=false),statistics=(all),statistics_log=(json,on_close,wait=1)"
+#define TESTUTIL_ENV_CONFIG_COMPAT ",compatibility=(release=\"2.9\")"
+
/* Generic option parsing structure shared by all test cases. */
typedef struct {
char *home;
@@ -69,7 +79,9 @@ typedef struct {
FILE *progress_fp; /* Progress tracking file */
char *progress_file_name;
+ bool compat; /* Compatibility */
bool do_data_ops; /* Have schema ops use data */
+ bool inmem; /* In-memory */
bool preserve; /* Don't remove files on exit */
bool tiered_storage; /* Configure tiered storage */
bool verbose; /* Run in verbose mode */
@@ -391,6 +403,8 @@ void testutil_progress(TEST_OPTS *, const char *);
#ifndef _WIN32
void testutil_sleep_wait(uint32_t, pid_t);
#endif
+void testutil_wiredtiger_open(
+ TEST_OPTS *, const char *, WT_EVENT_HANDLER *, WT_CONNECTION **, bool);
void testutil_tiered_begin(TEST_OPTS *);
void testutil_tiered_flush_complete(TEST_OPTS *, WT_SESSION *, void *);
void testutil_tiered_sleep(TEST_OPTS *, WT_SESSION *, uint32_t, bool *);