diff options
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r-- | src/third_party/wiredtiger/test/format/compact.c | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.c | 54 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/config.h | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/format.h | 11 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/ops.c | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/wts.c | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_las.py | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/utility/misc.c | 7 |
8 files changed, 97 insertions, 24 deletions
diff --git a/src/third_party/wiredtiger/test/format/compact.c b/src/third_party/wiredtiger/test/format/compact.c index 8a558d2b35b..c1a73bea64b 100644 --- a/src/third_party/wiredtiger/test/format/compact.c +++ b/src/third_party/wiredtiger/test/format/compact.c @@ -64,11 +64,11 @@ compact(void *arg) break; /* - * Compact can return EBUSY if concurrent with alter. + * Compact can return EBUSY if concurrent with alter or if there + * is eviction pressure, or we collide with checkpoints. */ - while ((ret = session->compact(session, g.uri, NULL)) == EBUSY) - __wt_yield(); - if (ret != 0 && ret != WT_ROLLBACK) + ret = session->compact(session, g.uri, NULL); + if (ret != 0 && ret != EBUSY && ret != WT_ROLLBACK) testutil_die(ret, "session.compact"); } diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c index df5dc3e5378..049a655cb79 100644 --- a/src/third_party/wiredtiger/test/format/config.c +++ b/src/third_party/wiredtiger/test/format/config.c @@ -29,6 +29,7 @@ #include "format.h" #include "config.h" +static void config_checkpoint(void); static void config_checksum(void); static void config_compression(const char *); static void config_encryption(void); @@ -39,6 +40,7 @@ static void config_in_memory_reset(void); static int config_is_perm(const char *); static void config_isolation(void); static void config_lrt(void); +static void config_map_checkpoint(const char *, u_int *); static void config_map_checksum(const char *, u_int *); static void config_map_compression(const char *, u_int *); static void config_map_encryption(const char *, u_int *); @@ -159,6 +161,7 @@ config_setup(void) if (!g.replay && g.run_cnt % 20 == 19 && !config_is_perm("threads")) g.c_threads = 1; + config_checkpoint(); config_checksum(); config_compression("compression"); config_compression("logging_compression"); @@ -234,6 +237,28 @@ config_setup(void) } /* + * config_checkpoint -- + * Checkpoint configuration. + */ +static void +config_checkpoint(void) +{ + /* Choose a checkpoint mode if nothing was specified. */ + if (!config_is_perm("checkpoints")) + switch (mmrand(NULL, 1, 20)) { + case 1: case 2: case 3: case 4: /* 20% */ + config_single("checkpoints=wiredtiger", 0); + break; + case 5: /* 5 % */ + config_single("checkpoints=off", 0); + break; + default: /* 75% */ + config_single("checkpoints=on", 0); + break; + } +} + +/* * config_checksum -- * Checksum configuration. */ @@ -823,7 +848,10 @@ config_single(const char *s, int perm) *cp->vstr = NULL; } - if (strncmp(s, "checksum", strlen("checksum")) == 0) { + if (strncmp(s, "checkpoints", strlen("checkpoints")) == 0) { + config_map_checkpoint(ep, &g.c_checkpoint_flag); + *cp->vstr = dstrdup(ep); + } else if (strncmp(s, "checksum", strlen("checksum")) == 0) { config_map_checksum(ep, &g.c_checksum_flag); *cp->vstr = dstrdup(ep); } else if (strncmp( @@ -834,12 +862,12 @@ config_single(const char *s, int perm) s, "encryption", strlen("encryption")) == 0) { config_map_encryption(ep, &g.c_encryption_flag); *cp->vstr = dstrdup(ep); - } else if (strncmp(s, "isolation", strlen("isolation")) == 0) { - config_map_isolation(ep, &g.c_isolation_flag); - *cp->vstr = dstrdup(ep); } else if (strncmp(s, "file_type", strlen("file_type")) == 0) { config_map_file_type(ep, &g.type); *cp->vstr = dstrdup(config_file_type(g.type)); + } else if (strncmp(s, "isolation", strlen("isolation")) == 0) { + config_map_isolation(ep, &g.c_isolation_flag); + *cp->vstr = dstrdup(ep); } else if (strncmp(s, "logging_compression", strlen("logging_compression")) == 0) { config_map_compression(ep, @@ -905,6 +933,24 @@ config_map_file_type(const char *s, u_int *vp) } /* + * config_map_checkpoint -- + * Map a checkpoint configuration to a flag. + */ +static void +config_map_checkpoint(const char *s, u_int *vp) +{ + /* Checkpoint configuration used to be 1/0, let it continue to work. */ + if (strcmp(s, "on") == 0 || strcmp(s, "1") == 0) + *vp = CHECKPOINT_ON; + else if (strcmp(s, "off") == 0 || strcmp(s, "0") == 0) + *vp = CHECKPOINT_OFF; + else if (strcmp(s, "wiredtiger") == 0) + *vp = CHECKPOINT_WIREDTIGER; + else + testutil_die(EINVAL, "illegal checkpoint configuration: %s", s); +} + +/* * config_map_checksum -- * Map a checksum configuration to a flag. */ diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h index 7ac71d7877b..6fb4071074d 100644 --- a/src/third_party/wiredtiger/test/format/config.h +++ b/src/third_party/wiredtiger/test/format/config.h @@ -102,8 +102,16 @@ static CONFIG c[] = { 0x0, 1, 100, 100 * 1024, &g.c_cache, NULL }, { "checkpoints", - "if periodic checkpoints are done", /* 95% */ - C_BOOL, 95, 0, 0, &g.c_checkpoints, NULL }, + "type of checkpoints (on | off | wiredtiger)", + C_IGNORE|C_STRING, 0, 0, 0, NULL, &g.c_checkpoint}, + + { "checkpoint_log_size", + "MB of log to wait if wiredtiger checkpoints configured", + 0x0, 20, 200, 1024, &g.c_checkpoint_log_size, NULL}, + + { "checkpoint_wait", + "seconds to wait if wiredtiger checkpoints configured", + 0x0, 5, 100, 3600, &g.c_checkpoint_wait, NULL}, { "checksum", "type of checksums (on | off | uncompressed)", @@ -222,6 +230,10 @@ static CONFIG c[] = { "type of logging compression " COMPRESSION_LIST, C_IGNORE|C_STRING, 0, 0, 0, NULL, &g.c_logging_compression }, + { "logging_file_max", + "maximum log file size in KB", + 0x0, 100, 512000, 2097152, &g.c_logging_file_max, NULL }, + { "logging_prealloc", "if log file pre-allocation configured", /* 50% */ C_BOOL, 50, 0, 0, &g.c_logging_prealloc, NULL }, diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h index f35e71f58aa..96e1a0fe335 100644 --- a/src/third_party/wiredtiger/test/format/format.h +++ b/src/third_party/wiredtiger/test/format/format.h @@ -119,7 +119,6 @@ typedef struct { bool workers_finished; /* Operations completed */ pthread_rwlock_t backup_lock; /* Backup running */ - pthread_rwlock_t checkpoint_lock; /* Checkpoint running */ WT_RAND_STATE rnd; /* Global RNG state */ @@ -151,7 +150,9 @@ typedef struct { uint32_t c_bloom_hash_count; uint32_t c_bloom_oldest; uint32_t c_cache; - uint32_t c_checkpoints; + char *c_checkpoint; + uint32_t c_checkpoint_log_size; + uint32_t c_checkpoint_wait; char *c_checksum; uint32_t c_chunk_size; uint32_t c_compact; @@ -182,6 +183,7 @@ typedef struct { uint32_t c_logging; uint32_t c_logging_archive; char *c_logging_compression; + uint32_t c_logging_file_max; uint32_t c_logging_prealloc; uint32_t c_long_running_txn; uint32_t c_lsm_worker_threads; @@ -216,6 +218,11 @@ typedef struct { #define VAR 3 u_int type; /* File type's flag value */ +#define CHECKPOINT_OFF 1 +#define CHECKPOINT_ON 2 +#define CHECKPOINT_WIREDTIGER 3 + u_int c_checkpoint_flag; /* Checkpoint flag value */ + #define CHECKSUM_OFF 1 #define CHECKSUM_ON 2 #define CHECKSUM_UNCOMPRESSED 3 diff --git a/src/third_party/wiredtiger/test/format/ops.c b/src/third_party/wiredtiger/test/format/ops.c index 4fed18d12b4..607dd43a8f3 100644 --- a/src/third_party/wiredtiger/test/format/ops.c +++ b/src/third_party/wiredtiger/test/format/ops.c @@ -175,7 +175,7 @@ wts_ops(int lastrun) if (g.c_backups) testutil_check( __wt_thread_create(NULL, &backup_tid, backup, NULL)); - if (g.c_checkpoints) + if (g.c_checkpoint_flag == CHECKPOINT_ON) testutil_check(__wt_thread_create( NULL, &checkpoint_tid, checkpoint, NULL)); if (g.c_compact) @@ -252,7 +252,7 @@ wts_ops(int lastrun) testutil_check(__wt_thread_join(NULL, alter_tid)); if (g.c_backups) testutil_check(__wt_thread_join(NULL, backup_tid)); - if (g.c_checkpoints) + if (g.c_checkpoint_flag == CHECKPOINT_ON) testutil_check(__wt_thread_join(NULL, checkpoint_tid)); if (g.c_compact) testutil_check(__wt_thread_join(NULL, compact_tid)); @@ -988,8 +988,8 @@ read_row(WT_CURSOR *cursor, WT_ITEM *key, WT_ITEM *value, uint64_t keyno) { static int sn = 0; WT_SESSION *session; - int exact, ret; uint8_t bitfield; + int exact, ret; session = cursor->session; diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c index 30493a41912..ddcd14cfd55 100644 --- a/src/third_party/wiredtiger/test/format/wts.c +++ b/src/third_party/wiredtiger/test/format/wts.c @@ -185,6 +185,12 @@ wts_open(const char *home, bool set_api, WT_CONNECTION **connp) if (DATASOURCE("lsm") || g.c_cache < 20) CONFIG_APPEND(p, ",eviction_dirty_trigger=95"); + /* Checkpoints. */ + if (g.c_checkpoint_flag == CHECKPOINT_WIREDTIGER) + CONFIG_APPEND(p, + ",checkpoint=(wait=%" PRIu32 ",log_size=%" PRIu32 ")", + g.c_checkpoint_wait, MEGABYTE(g.c_checkpoint_log_size)); + /* Eviction worker configuration. */ if (g.c_evict_max != 0) CONFIG_APPEND(p, @@ -193,12 +199,14 @@ wts_open(const char *home, bool set_api, WT_CONNECTION **connp) /* Logging configuration. */ if (g.c_logging) CONFIG_APPEND(p, - ",log=(enabled=true,archive=%d,prealloc=%d" - ",compressor=\"%s\")", + ",log=(enabled=true,archive=%d," + "prealloc=%d,file_max=%" PRIu32 ",compressor=\"%s\")", g.c_logging_archive ? 1 : 0, g.c_logging_prealloc ? 1 : 0, + KILOBYTE(g.c_logging_file_max), compressor(g.c_logging_compression_flag)); + /* Encryption. */ if (g.c_encryption) CONFIG_APPEND(p, ",encryption=(name=%s)", encryptor(g.c_encryption_flag)); diff --git a/src/third_party/wiredtiger/test/suite/test_las.py b/src/third_party/wiredtiger/test/suite/test_las.py index 52a0b2d7300..07938c6d80b 100644 --- a/src/third_party/wiredtiger/test/suite/test_las.py +++ b/src/third_party/wiredtiger/test/suite/test_las.py @@ -38,13 +38,13 @@ def timestamp_str(t): class test_las(wttest.WiredTigerTestCase): # Force a small cache. def conn_config(self): - return 'cache_size=1GB' + return 'cache_size=50MB' def large_updates(self, session, uri, value, ds, nrows, timestamp=False): # Insert a large number of records, we'll hang if the lookaside table # isn't doing its thing. cursor = session.open_cursor(uri) - for i in range(1, 1000000): + for i in range(1, 10000): if timestamp == True: session.begin_transaction() cursor.set_key(ds.key(nrows + i)) @@ -73,7 +73,6 @@ class test_las(wttest.WiredTigerTestCase): session.close() conn.close() - @wttest.longtest('lookaside table smoke test') def test_las(self): # Create a small table. uri = "table:test_las" @@ -84,7 +83,7 @@ class test_las(wttest.WiredTigerTestCase): # Initially load huge data cursor = self.session.open_cursor(uri) - for i in range(1, 1000000): + for i in range(1, 10000): cursor.set_key(ds.key(nrows + i)) cursor.set_value(bigvalue) self.assertEquals(cursor.insert(), 0) diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c index 0d751cd0df8..9d8fa28d3d7 100644 --- a/src/third_party/wiredtiger/test/utility/misc.c +++ b/src/third_party/wiredtiger/test/utility/misc.c @@ -31,8 +31,8 @@ void (*custom_die)(void) = NULL; const char *progname = "program name not set"; /* - * die -- - * Report an error and quit. + * testutil_die -- + * Report an error and abort. */ void testutil_die(int e, const char *fmt, ...) @@ -53,8 +53,9 @@ testutil_die(int e, const char *fmt, ...) if (e != 0) fprintf(stderr, ": %s", wiredtiger_strerror(e)); fprintf(stderr, "\n"); + fprintf(stderr, "process aborting\n"); - exit(EXIT_FAILURE); + abort(); } /* |