diff options
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.c | 124 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.sh | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config_def.c | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/format.h | 8 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/format/smoke.sh | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/wts.c | 38 |
7 files changed, 101 insertions, 91 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 5e22f5226ec..9b255e56575 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": "57cbf83a794976ed443d0f0a493147fe7d70800c" + "commit": "0dc9874b5d7ae1ba790b81b02660afe5e76f1a59" } diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c index 66021d15858..f4db1e8a6c6 100644 --- a/src/third_party/wiredtiger/test/format/config.c +++ b/src/third_party/wiredtiger/test/format/config.c @@ -47,6 +47,7 @@ static void config_lsm_reset(TABLE *); static void config_map_backup_incr(const char *, u_int *); static void config_map_checkpoint(const char *, u_int *); static void config_map_file_type(const char *, u_int *); +static void config_off(TABLE *, const char *); static void config_pct(TABLE *); static void config_transaction(void); @@ -292,7 +293,7 @@ config_table(TABLE *table, void *arg) /* Only row-store tables support a collation order. */ if (table->type != ROW) - config_single(table, "btree.reverse=off", false); + config_off(table, "btree.reverse"); /* Give LSM a final review and flag if there's at least one LSM data source. */ if (DATASOURCE(table, "lsm")) { @@ -366,7 +367,7 @@ static void config_backup_incr(void) { if (GV(BACKUP) == 0) { - config_single(NULL, "backup.incremental=off", false); + config_off(NULL, "backup.incremental"); return; } @@ -390,14 +391,14 @@ config_backup_incr(void) case 1: /* 30% full backup only */ case 2: case 3: - config_single(NULL, "backup.incremental=off", false); + config_off(NULL, "backup.incremental"); break; case 4: /* 30% log based incremental */ case 5: case 6: if (!GV(LOGGING_ARCHIVE) || !config_explicit(NULL, "logging.archive")) { if (GV(LOGGING_ARCHIVE)) - config_single(NULL, "logging.archive=0", false); + config_off(NULL, "logging.archive"); config_single(NULL, "backup.incremental=log", false); break; } @@ -470,7 +471,7 @@ config_backward_compatible_table(TABLE *table, void *arg) if (TV(flag)) { \ if (config_explicit(table, name)) \ testutil_die(EINVAL, "%s not supported in backward compatibility mode", name); \ - config_single(table, name "=off", false); \ + config_off(table, name); \ } BC_CHECK("btree.prefix_len", BTREE_PREFIX_LEN); } @@ -487,7 +488,7 @@ config_backward_compatible(void) if (GV(flag)) { \ if (config_explicit(NULL, name)) \ testutil_die(EINVAL, "%s not supported in backward compatibility mode", name); \ - config_single(NULL, name "=off", false); \ + config_off(NULL, name); \ } BC_CHECK("disk.mmap_all", DISK_MMAP_ALL); @@ -594,7 +595,7 @@ config_checkpoint(void) config_single(NULL, "checkpoint=wiredtiger", false); break; case 5: /* 5 % */ - config_single(NULL, "checkpoint=off", false); + config_off(NULL, "checkpoint"); break; default: /* 75% */ config_single(NULL, "checkpoint=on", false); @@ -619,7 +620,7 @@ config_checksum(TABLE *table) config_single(table, "disk.checksum=on", false); break; case 5: /* 10% */ - config_single(table, "disk.checksum=off", false); + config_off(table, "disk.checksum"); break; case 6: /* 10% */ config_single(table, "disk.checksum=uncompressed", false); @@ -642,18 +643,18 @@ config_compression(TABLE *table, const char *conf_name) /* Ignore logging compression if we're not doing logging. */ if (strcmp(conf_name, "logging.compression") == 0 && GV(LOGGING) == 0) { - config_single(NULL, "logging.compression=none", false); + config_off(NULL, "logging.compression"); return; } /* Return if already specified and it's a current compression engine. */ if (config_explicit(table, conf_name)) { - cstr = "none"; + cstr = "off"; if (strcmp(conf_name, "logging.compression") == 0) cstr = GVS(LOGGING_COMPRESSION); - if (strcmp(conf_name, "btree.compression") == 0) + else if (strcmp(conf_name, "btree.compression") == 0) cstr = TVS(BTREE_COMPRESSION); - if (cstr == NULL || memcmp(cstr, "bzip", strlen("bzip")) != 0) + if (memcmp(cstr, "bzip", strlen("bzip")) != 0) return; WARN("%s: bzip compression no longer supported", conf_name); } @@ -662,7 +663,7 @@ config_compression(TABLE *table, const char *conf_name) * Select a compression type from the list of built-in engines. Listed percentages are only * correct if all of the possible engines are compiled in. */ - cstr = "none"; + cstr = "off"; switch (mmrand(NULL, 1, 20)) { #ifdef HAVE_BUILTIN_EXTENSION_LZ4 case 1: @@ -729,10 +730,10 @@ config_directio(void) if (GV(flag)) { \ if (config_explicit(NULL, name)) { \ WARN("%s not supported with direct I/O, turning off direct I/O", name); \ - config_single(NULL, "disk.direct_io=off", false); \ + config_off(NULL, "disk.direct_io"); \ return; \ } \ - config_single(NULL, name "=off", false); \ + config_off(NULL, name); \ } /* @@ -767,31 +768,15 @@ config_directio(void) static void config_encryption(void) { - const char *cstr; - - /* - * Encryption: choose something if encryption wasn't specified. - */ - if (!config_explicit(NULL, "disk.encryption")) { - cstr = "disk.encryption=none"; - switch (mmrand(NULL, 1, 10)) { - case 1: - case 2: - case 3: - case 4: - case 5: /* 70% no encryption */ - case 6: - case 7: - break; - case 8: - case 9: - case 10: /* 30% rotn */ - cstr = "disk.encryption=rotn-7"; - break; - } + /* Encryption: choose something if encryption wasn't specified. */ + if (config_explicit(NULL, "disk.encryption")) + return; - config_single(NULL, cstr, false); - } + /* 70% no encryption, 30% rotn */ + if (mmrand(NULL, 1, 10) < 8) + config_off(NULL, "disk.encryption"); + else + config_single(NULL, "disk.encryption=rotn-7", false); } /* @@ -850,23 +835,23 @@ config_in_memory_reset(void) { /* Turn off a lot of stuff. */ if (!config_explicit(NULL, "backup")) - config_single(NULL, "backup=off", false); + config_off(NULL, "backup"); if (!config_explicit(NULL, "btree.compression")) - config_single(NULL, "btree.compression=none", false); + config_off(NULL, "btree.compression"); if (!config_explicit(NULL, "checkpoint")) - config_single(NULL, "checkpoint=off", false); + config_off(NULL, "checkpoint"); if (!config_explicit(NULL, "import")) - config_single(NULL, "import=off", false); + config_off(NULL, "import"); if (!config_explicit(NULL, "logging")) - config_single(NULL, "logging=off", false); + config_off(NULL, "logging"); if (!config_explicit(NULL, "ops.alter")) - config_single(NULL, "ops.alter=off", false); + config_off(NULL, "ops.alter"); if (!config_explicit(NULL, "ops.hs_cursor")) - config_single(NULL, "ops.hs_cursor=off", false); + config_off(NULL, "ops.hs_cursor"); if (!config_explicit(NULL, "ops.salvage")) - config_single(NULL, "ops.salvage=off", false); + config_off(NULL, "ops.salvage"); if (!config_explicit(NULL, "ops.verify")) - config_single(NULL, "ops.verify=off", false); + config_off(NULL, "ops.verify"); /* * Keep keys/values small, overflow items aren't an issue for in-memory configurations and it @@ -894,7 +879,7 @@ config_backup_incr_log_compatibility_check(void) "backup.incremental=log is incompatible with logging.archive, turning off " "logging.archive"); if (GV(LOGGING_ARCHIVE)) - config_single(NULL, "logging.archive=0", false); + config_off(NULL, "logging.archive"); } /* @@ -911,7 +896,7 @@ config_lsm_reset(TABLE *table) if (config_explicit(table, "ops.truncate")) { if (DATASOURCE(table, "lsm")) testutil_die(EINVAL, "LSM (currently) incompatible with truncate configurations"); - config_single(table, "ops.truncate=off", false); + config_off(table, "ops.truncate"); } /* @@ -921,10 +906,10 @@ config_lsm_reset(TABLE *table) */ if (config_explicit(NULL, "ops.prepare")) testutil_die(EINVAL, "LSM (currently) incompatible with prepare configurations"); - config_single(NULL, "ops.prepare=off", false); + config_off(NULL, "ops.prepare"); if (config_explicit(NULL, "transaction.timestamps")) testutil_die(EINVAL, "LSM (currently) incompatible with timestamp configurations"); - config_single(NULL, "transaction.timestamps=off", false); + config_off(NULL, "transaction.timestamps"); /* * LSM does not work with block-based incremental backup, change the incremental backup @@ -1068,22 +1053,22 @@ config_transaction(void) */ if (GV(OPS_PREPARE)) { if (!config_explicit(NULL, "logging")) - config_single(NULL, "logging=off", false); + config_off(NULL, "logging"); if (!config_explicit(NULL, "transaction.timestamps")) config_single(NULL, "transaction.timestamps=on", false); } if (GV(TRANSACTION_TIMESTAMPS)) { if (!config_explicit(NULL, "transaction.implicit")) - config_single(NULL, "transaction.implicit=0", false); + config_off(NULL, "transaction.implicit"); if (!config_explicit(NULL, "ops.salvage")) - config_single(NULL, "ops.salvage=off", false); + config_off(NULL, "ops.salvage"); } if (GV(LOGGING)) - config_single(NULL, "ops.prepare=off", false); + config_off(NULL, "ops.prepare"); if (GV(TRANSACTION_IMPLICIT)) - config_single(NULL, "transaction.timestamps=off", false); + config_off(NULL, "transaction.timestamps"); if (GV(OPS_SALVAGE)) - config_single(NULL, "transaction.timestamps=off", false); + config_off(NULL, "transaction.timestamps"); /* Transaction timestamps configures format behavior, flag it. */ if (GV(TRANSACTION_TIMESTAMPS)) @@ -1328,6 +1313,22 @@ config_find(const char *s, size_t len, bool fatal) } /* + * config_off -- + * Turn a configuration value off. + */ +static void +config_off(TABLE *table, const char *s) +{ + CONFIG *cp; + char buf[100]; + + cp = config_find(s, strlen(s), true); + testutil_check( + __wt_snprintf(buf, sizeof(buf), "%s=%s", s, F_ISSET(cp, C_BOOL | C_STRING) ? "off" : "0")); + config_single(table, buf, false); +} + +/* * config_value -- * String to long helper function. */ @@ -1448,6 +1449,13 @@ config_single(TABLE *table, const char *s, bool explicit) v = &table->v[cp->off]; if (F_ISSET(cp, C_STRING)) { + /* + * Historically, both "none" and "off" were used for turning off string configurations, now + * we only use "off". + */ + if (strcmp(equalp, "none") == 0) + equalp = "off"; + if (strncmp(s, "backup.incremental", strlen("backup.incremental")) == 0) config_map_backup_incr(equalp, &g.backup_incr_flag); else if (strncmp(s, "checkpoint", strlen("checkpoint")) == 0) diff --git a/src/third_party/wiredtiger/test/format/config.sh b/src/third_party/wiredtiger/test/format/config.sh index dce73364530..3dee4973714 100644 --- a/src/third_party/wiredtiger/test/format/config.sh +++ b/src/third_party/wiredtiger/test/format/config.sh @@ -77,7 +77,7 @@ CONFIG configuration_list[] = { {"backup", "configure backups", C_BOOL, 20, 0, 0} -{"backup.incremental", "backup type (block | log | off)", C_IGNORE | C_STRING, 0, 0, 0} +{"backup.incremental", "backup type (off | block | log)", C_IGNORE | C_STRING, 0, 0, 0} {"backup.incr_granularity", "incremental backup block granularity (KB)", 0x0, 4, 16384, 16384} @@ -91,7 +91,7 @@ CONFIG configuration_list[] = { {"btree.bitcnt", "fixed-length column-store object size (number of bits)", C_TABLE | C_TYPE_FIX, 1, 8, 8} -{"btree.compression", "data compression (none | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING | C_TABLE, 0, 0, 0} +{"btree.compression", "data compression (off | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING | C_TABLE, 0, 0, 0} {"btree.dictionary", "configure dictionary compressed values", C_BOOL | C_TABLE | C_TYPE_ROW | C_TYPE_VAR, 20, 0, 0} @@ -143,7 +143,7 @@ CONFIG configuration_list[] = { {"disk.direct_io", "configure direct I/O for data objects", C_BOOL | C_IGNORE, 0, 0, 1} -{"disk.encryption", "encryption type (none | rotn-7)", C_IGNORE | C_STRING, 0, 0, 0} +{"disk.encryption", "encryption type (off | rotn-7)", C_IGNORE | C_STRING, 0, 0, 0} {"disk.firstfit", "configure first-fit allocation", C_BOOL | C_TABLE, 10, 0, 0} @@ -168,7 +168,7 @@ CONFIG configuration_list[] = { {"logging.archive", "configure log file archival", C_BOOL, 50, 0, 0} -{"logging.compression", "logging compression (none | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING, 0, 0, 0} +{"logging.compression", "logging compression (off | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING, 0, 0, 0} {"logging.file_max", "maximum log file size (KB)", 0x0, 100, 512000, 2097152} diff --git a/src/third_party/wiredtiger/test/format/config_def.c b/src/third_party/wiredtiger/test/format/config_def.c index 22d650f9326..91aa3970823 100644 --- a/src/third_party/wiredtiger/test/format/config_def.c +++ b/src/third_party/wiredtiger/test/format/config_def.c @@ -12,7 +12,7 @@ CONFIG configuration_list[] = { {"backup", "configure backups", C_BOOL, 20, 0, 0, V_GLOBAL_BACKUP}, - {"backup.incremental", "backup type (block | log | off)", + {"backup.incremental", "backup type (off | block | log)", C_IGNORE | C_STRING, 0, 0, 0, V_GLOBAL_BACKUP_INCREMENTAL}, {"backup.incr_granularity", "incremental backup block granularity (KB)", @@ -33,7 +33,7 @@ CONFIG configuration_list[] = { {"btree.bitcnt", "fixed-length column-store object size (number of bits)", C_TABLE | C_TYPE_FIX, 1, 8, 8, V_TABLE_BTREE_BITCNT}, - {"btree.compression", "data compression (none | lz4 | snappy | zlib | zstd)", + {"btree.compression", "data compression (off | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING | C_TABLE, 0, 0, 0, V_TABLE_BTREE_COMPRESSION}, {"btree.dictionary", "configure dictionary compressed values", @@ -111,7 +111,7 @@ CONFIG configuration_list[] = { {"disk.direct_io", "configure direct I/O for data objects", C_BOOL | C_IGNORE, 0, 0, 1, V_GLOBAL_DISK_DIRECT_IO}, - {"disk.encryption", "encryption type (none | rotn-7)", + {"disk.encryption", "encryption type (off | rotn-7)", C_IGNORE | C_STRING, 0, 0, 0, V_GLOBAL_DISK_ENCRYPTION}, {"disk.firstfit", "configure first-fit allocation", @@ -146,7 +146,7 @@ CONFIG configuration_list[] = { {"logging.archive", "configure log file archival", C_BOOL, 50, 0, 0, V_GLOBAL_LOGGING_ARCHIVE}, - {"logging.compression", "logging compression (none | lz4 | snappy | zlib | zstd)", + {"logging.compression", "logging compression (off | lz4 | snappy | zlib | zstd)", C_IGNORE | C_STRING, 0, 0, 0, V_GLOBAL_LOGGING_COMPRESSION}, {"logging.file_max", "maximum log file size (KB)", diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h index 79cacfc988f..e6bdfc17e43 100644 --- a/src/third_party/wiredtiger/test/format/format.h +++ b/src/third_party/wiredtiger/test/format/format.h @@ -159,12 +159,14 @@ extern u_int ntables; * Global and table-specific macros to retrieve configuration information. All of the tables contain * all of the possible configuration entries, but the first table slot contains all of the global * configuration information. The offset names a prefixed with "V_GLOBAL" and "V_TABLE" to reduce - * the chance of a coding error retrieving the wrong configuration item. + * the chance of a coding error retrieving the wrong configuration item. If returning string values, + * convert NULL, where a configuration has never been set, to "off" for consistency. */ #define GV(off) (tables[0]->v[V_GLOBAL_##off].v) -#define GVS(off) (tables[0]->v[V_GLOBAL_##off].vstr) +#define GVS(off) \ + (tables[0]->v[V_GLOBAL_##off].vstr == NULL ? "off" : tables[0]->v[V_GLOBAL_##off].vstr) #define TV(off) (table->v[V_TABLE_##off].v) -#define TVS(off) (table->v[V_TABLE_##off].vstr) +#define TVS(off) (table->v[V_TABLE_##off].vstr == NULL ? "off" : table->v[V_TABLE_##off].vstr) #define DATASOURCE(table, ds) (strcmp((table)->v[V_TABLE_RUNS_SOURCE].vstr, ds) == 0) diff --git a/src/third_party/wiredtiger/test/format/smoke.sh b/src/third_party/wiredtiger/test/format/smoke.sh index ab2096dcd12..af63df24a0a 100755 --- a/src/third_party/wiredtiger/test/format/smoke.sh +++ b/src/third_party/wiredtiger/test/format/smoke.sh @@ -4,9 +4,9 @@ set -e # Smoke-test format as part of running "make check". args="-c . " -args="$args btree.compression=none " +args="$args btree.compression=off " args="$args cache.minimum=40 " -args="$args logging_compression=none" +args="$args logging_compression=off" args="$args runs.rows=100000 " args="$args runs.source=table " args="$args runs.tables=3 " diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c index 5dc7847fa53..72b27983f8d 100644 --- a/src/third_party/wiredtiger/test/format/wts.c +++ b/src/third_party/wiredtiger/test/format/wts.c @@ -37,11 +37,10 @@ static void create_object(TABLE *, void *); static const char * encryptor(void) { - char *s; - const char *p; + const char *p, *s; s = GVS(DISK_ENCRYPTION); - if (strcmp(s, "none") == 0) + if (strcmp(s, "off") == 0) p = "none"; else if (strcmp(s, "rotn-7") == 0) p = "rotn,keyid=7"; @@ -49,6 +48,8 @@ encryptor(void) p = "sodium,secretkey=" SODIUM_TESTKEY; else testutil_die(EINVAL, "illegal encryption configuration: %s", s); + + /* Returns "none" or the name of an encryptor. */ return (p); } @@ -61,11 +62,10 @@ encryptor(void) static const char * encryptor_at_open(void) { - char *s; - const char *p; + const char *p, *s; s = GVS(DISK_ENCRYPTION); - if (strcmp(s, "none") == 0) + if (strcmp(s, "off") == 0) p = NULL; else if (strcmp(s, "rotn-7") == 0) p = NULL; @@ -73,6 +73,8 @@ encryptor_at_open(void) p = "sodium,secretkey=" SODIUM_TESTKEY; else testutil_die(EINVAL, "illegal encryption configuration: %s", s); + + /* Returns NULL or the name of an encryptor. */ return (p); } @@ -194,8 +196,8 @@ create_database(const char *home, WT_CONNECTION **connp) { WT_CONNECTION *conn; size_t max; - char config[8 * 1024], *p, *s; - const char *enc; + char config[8 * 1024], *p; + const char *s; p = config; max = sizeof(config); @@ -243,13 +245,11 @@ create_database(const char *home, WT_CONNECTION **connp) CONFIG_APPEND(p, ",log=(enabled=true,archive=%d,prealloc=%d,file_max=%" PRIu32 ",compressor=\"%s\")", GV(LOGGING_ARCHIVE) ? 1 : 0, GV(LOGGING_PREALLOC) ? 1 : 0, KILOBYTE(GV(LOGGING_FILE_MAX)), - s == NULL ? "none" : s); + strcmp(s, "off") == 0 ? "none" : s); } /* Encryption. */ - enc = encryptor(); - if (enc != NULL) - CONFIG_APPEND(p, ",encryption=(name=%s)", enc); + CONFIG_APPEND(p, ",encryption=(name=%s)", encryptor()); /* Miscellaneous. */ #ifdef HAVE_POSIX_MEMALIGN @@ -296,7 +296,7 @@ create_database(const char *home, WT_CONNECTION **connp) * options at the end. Do this so they override the standard configuration. */ s = GVS(WIREDTIGER_CONFIG); - if (s != NULL) + if (strcmp(s, "off") != 0) CONFIG_APPEND(p, ",%s", s); if (g.config_open != NULL) CONFIG_APPEND(p, ",%s", g.config_open); @@ -320,7 +320,8 @@ create_object(TABLE *table, void *arg) WT_SESSION *session; size_t max; uint32_t maxintlkey, maxleafkey, maxleafvalue; - char config[4096], *p, *s; + char config[4096], *p; + const char *s; conn = (WT_CONNECTION *)arg; p = config; @@ -368,12 +369,11 @@ create_object(TABLE *table, void *arg) } /* Configure checksums. */ - if ((s = TVS(DISK_CHECKSUM)) != NULL) - CONFIG_APPEND(p, ",checksum=\"%s\"", s); + CONFIG_APPEND(p, ",checksum=\"%s\"", TVS(DISK_CHECKSUM)); /* Configure compression. */ - if ((s = TVS(BTREE_COMPRESSION)) != NULL) - CONFIG_APPEND(p, ",block_compressor=\"%s\"", s); + s = TVS(BTREE_COMPRESSION); + CONFIG_APPEND(p, ",block_compressor=\"%s\"", strcmp(s, "off") == 0 ? "none" : s); /* Configure Btree. */ CONFIG_APPEND( @@ -475,7 +475,7 @@ wts_open(const char *home, WT_CONNECTION **connp, WT_SESSION **sessionp, bool al if (enc != NULL) CONFIG_APPEND(p, ",encryption=(name=%s)", enc); - CONFIG_APPEND(p, "error_prefix=\"%s\"", progname); + CONFIG_APPEND(p, ",error_prefix=\"%s\"", progname); /* Optional timing stress. */ configure_timing_stress(p, max); |