summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/csuite/schema_abort/main.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-08-26 17:32:33 +1000
committerLuke Chen <luke.chen@mongodb.com>2021-08-26 17:32:33 +1000
commit371b4370c9eb8e60bd1e54c159d052ae1382e7ec (patch)
tree3f512bd2b78526dd7e4e2cd07facf2336adaac80 /src/third_party/wiredtiger/test/csuite/schema_abort/main.c
parentf14ddbe7ba60ad3d15485838ad4696c78de98ef4 (diff)
downloadmongo-371b4370c9eb8e60bd1e54c159d052ae1382e7ec.tar.gz
Import wiredtiger: b85c4b8a97b80cd0eb5e71843fdd12c0b905c5a7 from branch mongodb-4.4
ref: 27d10c3362..b85c4b8a97 for: 4.4.9 WT-6908 Write "cache" subpage for Architecture Guide WT-6911 Write "block manager" subpage for Architecture Guide WT-7005 Write "session" subpage for Architecture Guide WT-7006 Write Connection subpage for Architecture Guide WT-7905 Fix incorrect builtin behaviour for builds in CMake WT-7909 Create a new method to check for running user transactions before starting rollback-to-stable operation WT-7917 Add evergreen validation to s_all WT-7931 Evicting modifies using the evict cursor in test_multiple_older_readers_with_multiple_mixed_mode() to ensure that eviction happens. WT-7941 Add an Evergreen task to test abort/recovery using test/format WT-7964 Fix rollback to stable incorrectly not rolling back updates at snap_max WT-7965 Update connection base write generation number at the end of recovery checkpoint WT-7970 Set the stable timestamp before starting the checkpointer and clock threads WT-7974 More column-store fixes and tests WT-7984 Fix a bug that could cause a checkpoint to omit a page of data WT-7995 Fix the global visibility that it cannot go beyond checkpoint visibility WT-7998 Minor fixes on Cache subpage of Architecture Guide
Diffstat (limited to 'src/third_party/wiredtiger/test/csuite/schema_abort/main.c')
-rw-r--r--src/third_party/wiredtiger/test/csuite/schema_abort/main.c54
1 files changed, 37 insertions, 17 deletions
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.
*/