diff options
Diffstat (limited to 'src/third_party/wiredtiger/test/format')
-rw-r--r-- | src/third_party/wiredtiger/test/format/backup.c | 87 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/checkpoint.c | 11 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/format/format.sh | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/ops.c | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/format/t.c | 2 |
5 files changed, 68 insertions, 58 deletions
diff --git a/src/third_party/wiredtiger/test/format/backup.c b/src/third_party/wiredtiger/test/format/backup.c index 5ad1cfe65dc..9e959dcd823 100644 --- a/src/third_party/wiredtiger/test/format/backup.c +++ b/src/third_party/wiredtiger/test/format/backup.c @@ -217,54 +217,57 @@ static void copy_blocks(WT_SESSION *session, WT_CURSOR *bkup_c, const char *name) { WT_CURSOR *incr_cur; + WT_DECL_RET; size_t len, tmp_sz; ssize_t rdsize; - uint64_t offset, type; - u_int size; - int ret, rfd, wfd1, wfd2; - char buf[512], config[512], *first, *second, *tmp; + uint64_t offset, size, type; + int rfd, wfd1, wfd2; + char config[512], *tmp; bool first_pass; - /* - * We need to prepend the home directory name here because we are not using the WiredTiger - * internal functions that would prepend it for us. - */ - len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10; - first = dmalloc(len); - - /* - * Save another copy of the original file to make debugging recovery errors easier. - */ - len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10; - second = dmalloc(len); - testutil_check(__wt_snprintf(config, sizeof(config), "incremental=(file=%s)", name)); - - /* Open the duplicate incremental backup cursor with the file name given. */ tmp_sz = 0; tmp = NULL; first_pass = true; rfd = wfd1 = wfd2 = -1; + + /* Open the duplicate incremental backup cursor with the file name given. */ + testutil_check(__wt_snprintf(config, sizeof(config), "incremental=(file=%s)", name)); testutil_check(session->open_cursor(session, NULL, bkup_c, config, &incr_cur)); while ((ret = incr_cur->next(incr_cur)) == 0) { - testutil_check(incr_cur->get_key(incr_cur, &offset, (uint64_t *)&size, &type)); + testutil_check(incr_cur->get_key(incr_cur, &offset, &size, &type)); if (type == WT_BACKUP_RANGE) { /* * Since we are using system calls below instead of a WiredTiger function, we have to * prepend the home directory to the file names ourselves. */ - testutil_check(__wt_snprintf(first, len, "%s/BACKUP/%s", g.home, name)); - testutil_check(__wt_snprintf(second, len, "%s/BACKUP.copy/%s", g.home, name)); + if (first_pass) { + len = strlen(g.home) + strlen(name) + 10; + tmp = dmalloc(len); + testutil_check(__wt_snprintf(tmp, len, "%s/%s", g.home, name)); + error_sys_check(rfd = open(tmp, O_RDONLY, 0)); + free(tmp); + tmp = NULL; + + len = strlen(g.home) + strlen("BACKUP") + strlen(name) + 10; + tmp = dmalloc(len); + testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP/%s", g.home, name)); + error_sys_check(wfd1 = open(tmp, O_WRONLY | O_CREAT, 0)); + free(tmp); + tmp = NULL; + + len = strlen(g.home) + strlen("BACKUP.copy") + strlen(name) + 10; + tmp = dmalloc(len); + testutil_check(__wt_snprintf(tmp, len, "%s/BACKUP.copy/%s", g.home, name)); + error_sys_check(wfd2 = open(tmp, O_WRONLY | O_CREAT, 0)); + free(tmp); + tmp = NULL; + + first_pass = false; + } if (tmp_sz < size) { tmp = drealloc(tmp, size); tmp_sz = size; } - if (first_pass) { - testutil_check(__wt_snprintf(buf, sizeof(buf), "%s/%s", g.home, name)); - error_sys_check(rfd = open(buf, O_RDONLY, 0)); - error_sys_check(wfd1 = open(first, O_WRONLY | O_CREAT, 0)); - error_sys_check(wfd2 = open(second, O_WRONLY | O_CREAT, 0)); - first_pass = false; - } error_sys_check(lseek(rfd, (wt_off_t)offset, SEEK_SET)); error_sys_check(rdsize = read(rfd, tmp, size)); error_sys_check(lseek(wfd1, (wt_off_t)offset, SEEK_SET)); @@ -273,17 +276,27 @@ copy_blocks(WT_SESSION *session, WT_CURSOR *bkup_c, const char *name) error_sys_check(write(wfd1, tmp, (size_t)rdsize)); error_sys_check(write(wfd2, tmp, (size_t)rdsize)); } else { + testutil_assert(type == WT_BACKUP_FILE); + testutil_assert(first_pass == true); + testutil_assert(rfd == -1); + /* * These operations are using a WiredTiger function so it will prepend the home * directory to the name for us. */ - testutil_check(__wt_snprintf(first, len, "BACKUP/%s", name)); - testutil_check(__wt_snprintf(second, len, "BACKUP.copy/%s", name)); - testutil_assert(type == WT_BACKUP_FILE); - testutil_assert(rfd == -1); - testutil_assert(first_pass == true); - testutil_check(__wt_copy_and_sync(session, name, first)); - testutil_check(__wt_copy_and_sync(session, first, second)); + len = strlen("BACKUP") + strlen(name) + 10; + tmp = dmalloc(len); + testutil_check(__wt_snprintf(tmp, len, "BACKUP/%s", name)); + testutil_check(__wt_copy_and_sync(session, name, tmp)); + free(tmp); + tmp = NULL; + + len = strlen("BACKUP.copy") + strlen(name) + 10; + tmp = dmalloc(len); + testutil_check(__wt_snprintf(tmp, len, "BACKUP.copy/%s", name)); + testutil_check(__wt_copy_and_sync(session, name, tmp)); + free(tmp); + tmp = NULL; } } testutil_check(incr_cur->close(incr_cur)); @@ -292,8 +305,6 @@ copy_blocks(WT_SESSION *session, WT_CURSOR *bkup_c, const char *name) error_sys_check(close(wfd1)); error_sys_check(close(wfd2)); } - free(first); - free(second); free(tmp); } /* diff --git a/src/third_party/wiredtiger/test/format/checkpoint.c b/src/third_party/wiredtiger/test/format/checkpoint.c index 36e70ae3125..9131e920231 100644 --- a/src/third_party/wiredtiger/test/format/checkpoint.c +++ b/src/third_party/wiredtiger/test/format/checkpoint.c @@ -37,6 +37,17 @@ wts_checkpoints(void) { char config[1024]; + /* + * Configuring WiredTiger library checkpoints is done separately, rather than as part of the + * original database open because format tests small caches and you can get into cache stuck + * trouble during the initial load (where bulk load isn't configured). There's a single thread + * doing lots of inserts and creating huge leaf pages. Those pages can't be evicted if there's a + * checkpoint running in the tree, and the cache can get stuck. That workload is unlikely enough + * we're not going to fix it in the library, so configure it away by delaying checkpoint start. + */ + if (g.c_checkpoint_flag != CHECKPOINT_WIREDTIGER) + return; + testutil_check( __wt_snprintf(config, sizeof(config), ",checkpoint=(wait=%" PRIu32 ",log_size=%" PRIu32 ")", g.c_checkpoint_wait, MEGABYTE(g.c_checkpoint_log_size))); diff --git a/src/third_party/wiredtiger/test/format/format.sh b/src/third_party/wiredtiger/test/format/format.sh index 19f5df8ede4..b02a58abfb0 100755 --- a/src/third_party/wiredtiger/test/format/format.sh +++ b/src/third_party/wiredtiger/test/format/format.sh @@ -214,14 +214,11 @@ skip_known_errors() log=$1 - # Define each array with multi-signature matching for a single known error - # and append it to the skip_error_list - err_1=("heap-buffer-overflow" "__split_parent") # Delete this error line post WT-5518 fix - err_2=("heap-use-after-free" "__wt_btcur_next_random") # Delete this error line post WT-5552 fix - - # skip_error_list is the list of errors to skip, and each error could - # have multiple signatures to be able to reach a finer match - skip_error_list=( err_1[@] err_2[@] ) + # skip_error_list is a list of errors to skip. Each array entry can have multiple signatures + # for finger-grained matching. For example: + # + # err_1=("heap-buffer-overflow" "__split_parent") + skip_error_list=( err_1[@] ) # Loop through the skip list and search in the log file. err_count=${#skip_error_list[@]} @@ -249,12 +246,11 @@ report_failure() log="$dir.log" # DO NOT CURRENTLY SKIP ANY ERRORS. - skip_ret=0 #skip_known_errors $log #skip_ret=$? echo "$name: failure status reported" > $dir/$status - [[ $skip_ret -ne 0 ]] && failure=$(($failure + 1)) + failure=$(($failure + 1)) # Forcibly quit if first-failure configured. [[ $first_failure -ne 0 ]] && force_quit=1 diff --git a/src/third_party/wiredtiger/test/format/ops.c b/src/third_party/wiredtiger/test/format/ops.c index ef3a79e7b53..b38c7b721bc 100644 --- a/src/third_party/wiredtiger/test/format/ops.c +++ b/src/third_party/wiredtiger/test/format/ops.c @@ -204,16 +204,6 @@ operations(u_int ops_seconds, bool lastrun) if (g.c_txn_timestamps) testutil_check(__wt_thread_create(NULL, ×tamp_tid, timestamp, tinfo_list)); - /* - * Configuring WiredTiger library checkpoints is done separately, rather than as part of the - * original database open because format tests small caches and you can get into cache stuck - * trouble during the initial load (where bulk load isn't configured). There's a single thread - * doing lots of inserts and creating huge leaf pages. Those pages can't be evicted if there's a - * checkpoint running in the tree, and the cache can get stuck. That workload is unlikely enough - * we're not going to fix it in the library, so configure it away by delaying checkpoint start. - */ - if (g.c_checkpoint_flag == CHECKPOINT_WIREDTIGER) - wts_checkpoints(); if (g.c_checkpoint_flag == CHECKPOINT_ON) testutil_check(__wt_thread_create(NULL, &checkpoint_tid, checkpoint, NULL)); diff --git a/src/third_party/wiredtiger/test/format/t.c b/src/third_party/wiredtiger/test/format/t.c index b596124087b..5e68d4c524b 100644 --- a/src/third_party/wiredtiger/test/format/t.c +++ b/src/third_party/wiredtiger/test/format/t.c @@ -287,6 +287,8 @@ main(int argc, char *argv[]) TIMED_MAJOR_OP(wts_read_scan()); + wts_checkpoints(); + /* Operations. */ for (reps = 1; reps <= FORMAT_OPERATION_REPS; ++reps) operations(ops_seconds, reps == FORMAT_OPERATION_REPS); |