From c9c3724c0358605804d0bb73991bc6b67ac6c97a Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Thu, 21 Nov 2019 02:52:36 +0000 Subject: Import wiredtiger: 8124d929c48ae8e4c0b1311374ea69b6ae4c48c5 from branch mongodb-4.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: d44b1af8a8..8124d929c4 for: 4.3.2 WT-4995 Migrate Jenkins “wiredtiger-test-wtperf” job to Evergreen WT-5048 wiredtiger_open with a corrupted meta file should always return WT_TRY_SALVAGE WT-5169 WT_REF_LIMBO pages cannot support fast (leaf-page only) searches WT-5211 Print mismatch information before dumping page and LAS WT-5247 Ensure that only idempotent modify operations are logged WT-5251 Increase frequency for Linux syscall test WT-5252 Fix Ubuntu 18.04 PPC and zSeries unit-test failure in Evergreen --- src/third_party/wiredtiger/.clang-format | 8 ++-- src/third_party/wiredtiger/dist/s_funcs.list | 1 + src/third_party/wiredtiger/dist/s_string.ok | 1 + src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/block/block_open.c | 5 ++- src/third_party/wiredtiger/src/btree/bt_cursor.c | 19 ++++----- src/third_party/wiredtiger/src/btree/bt_debug.c | 22 ++++++++++ src/third_party/wiredtiger/src/conn/conn_api.c | 28 +++++++++++++ src/third_party/wiredtiger/src/conn/conn_dhandle.c | 5 +++ src/third_party/wiredtiger/src/include/extern.h | 4 ++ src/third_party/wiredtiger/src/meta/meta_turtle.c | 2 +- src/third_party/wiredtiger/src/support/modify.c | 39 ++++++++++++++--- src/third_party/wiredtiger/src/txn/txn_log.c | 16 ++++++- src/third_party/wiredtiger/test/evergreen.yml | 46 ++++++++++++++------ src/third_party/wiredtiger/test/format/format.h | 1 + src/third_party/wiredtiger/test/format/snap.c | 49 +++++++++++++++------- src/third_party/wiredtiger/test/format/util.c | 5 +++ .../wiredtiger/test/suite/test_txn19.py | 6 +-- 18 files changed, 202 insertions(+), 57 deletions(-) (limited to 'src/third_party/wiredtiger') diff --git a/src/third_party/wiredtiger/.clang-format b/src/third_party/wiredtiger/.clang-format index 5cd39db2e69..573572df901 100644 --- a/src/third_party/wiredtiger/.clang-format +++ b/src/third_party/wiredtiger/.clang-format @@ -49,14 +49,16 @@ ForEachMacros: - Q_FOREACH - BOOST_FOREACH - TAILQ_FOREACH + - WT_CELL_FOREACH_BEGIN + - WT_CELL_FOREACH_VRFY - WT_CKPT_FOREACH + - WT_COL_FOREACH - WT_EXT_FOREACH - WT_EXT_FOREACH_OFF - WT_FIX_FOREACH - - WT_CELL_FOREACH_BEGIN - - WT_CELL_FOREACH_VRFY - - WT_COL_FOREACH - WT_INTL_FOREACH_BEGIN + - WT_MODIFY_FOREACH_BEGIN + - WT_MODIFY_FOREACH_REVERSE - WT_ROW_FOREACH - WT_SKIP_FOREACH IncludeCategories: diff --git a/src/third_party/wiredtiger/dist/s_funcs.list b/src/third_party/wiredtiger/dist/s_funcs.list index bcedc19a459..0218937fffc 100644 --- a/src/third_party/wiredtiger/dist/s_funcs.list +++ b/src/third_party/wiredtiger/dist/s_funcs.list @@ -16,6 +16,7 @@ __wt_config_getone __wt_cursor_get_raw_value __wt_debug_addr __wt_debug_addr_print +__wt_debug_cursor_las __wt_debug_cursor_page __wt_debug_offset __wt_debug_set_verbose diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok index e770694e17c..66480a55eec 100644 --- a/src/third_party/wiredtiger/dist/s_string.ok +++ b/src/third_party/wiredtiger/dist/s_string.ok @@ -210,6 +210,7 @@ Kanowski's Kounavis LANGID LAS +LASdump LF LLLLLL LLLLLLL diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index fb4ca494875..d88e2d1b501 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "d44b1af8a84ef93d9857432c9af5ef3b3adc8bdd", + "commit": "8124d929c48ae8e4c0b1311374ea69b6ae4c48c5", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.4" diff --git a/src/third_party/wiredtiger/src/block/block_open.c b/src/third_party/wiredtiger/src/block/block_open.c index ba32bce74bc..868d7c5d149 100644 --- a/src/third_party/wiredtiger/src/block/block_open.c +++ b/src/third_party/wiredtiger/src/block/block_open.c @@ -345,8 +345,11 @@ __desc_read(WT_SESSION_IMPL *session, uint32_t allocsize, WT_BLOCK *block) * without some reason to believe they are WiredTiger files. The user may have entered the wrong * file name, and is now frantically pounding their interrupt key. */ - if (desc->magic != WT_BLOCK_MAGIC || !checksum_matched) + if (desc->magic != WT_BLOCK_MAGIC || !checksum_matched) { + if (strcmp(block->name, WT_METAFILE) == 0) + WT_ERR_MSG(session, WT_TRY_SALVAGE, "%s is corrupted", block->name); WT_ERR_MSG(session, WT_ERROR, "%s does not appear to be a WiredTiger file", block->name); + } if (desc->majorv > WT_BLOCK_MAJOR_VERSION || (desc->majorv == WT_BLOCK_MAJOR_VERSION && desc->minorv > WT_BLOCK_MINOR_VERSION)) diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c index 4e85f1528a8..11201846a38 100644 --- a/src/third_party/wiredtiger/src/btree/bt_cursor.c +++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c @@ -101,17 +101,16 @@ __cursor_page_pinned(WT_CURSOR_BTREE *cbt, bool search_operation) return (false); /* - * If we are doing an update, we need a page with history, release the page so we get it again - * with history if required. Eviction may be locking the page, wait until we see a "normal" - * state and then test against that state (eviction may have already locked the page again). + * We need a page with history: updates need complete update lists and a read might be based on + * a different timestamp than the one that brought the page into memory. Release the page and + * read it again with history if required. Eviction may be locking the page, wait until we see a + * "normal" state and then test against that state (eviction may have already locked the page + * again). */ - if (F_ISSET(&session->txn, WT_TXN_UPDATE)) { - while ((current_state = cbt->ref->state) == WT_REF_LOCKED) - __wt_yield(); - return (current_state == WT_REF_MEM); - } - - return (true); + while ((current_state = cbt->ref->state) == WT_REF_LOCKED) + __wt_yield(); + WT_ASSERT(session, current_state == WT_REF_LIMBO || current_state == WT_REF_MEM); + return (current_state == WT_REF_MEM); } /* diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c index f971de0e4f0..d4babb1df7c 100644 --- a/src/third_party/wiredtiger/src/btree/bt_debug.c +++ b/src/third_party/wiredtiger/src/btree/bt_debug.c @@ -697,6 +697,28 @@ __wt_debug_cursor_page(void *cursor_arg, const char *ofile) return (__wt_debug_page(cursor->session, cbt->btree, cbt->ref, ofile)); } +/* + * __wt_debug_cursor_las -- + * Dump the LAS tree given a user cursor. + */ +int +__wt_debug_cursor_las(void *cursor_arg, const char *ofile) + WT_GCC_FUNC_ATTRIBUTE((visibility("default"))) +{ + WT_CONNECTION_IMPL *conn; + WT_CURSOR *cursor; + WT_CURSOR_BTREE *cbt; + WT_SESSION_IMPL *las_session; + + cursor = cursor_arg; + conn = S2C((WT_SESSION_IMPL *)cursor->session); + las_session = conn->cache->las_session[0]; + if (las_session == NULL) + return (0); + cbt = (WT_CURSOR_BTREE *)las_session->las_cursor; + return (__wt_debug_tree_all(las_session, cbt->btree, NULL, ofile)); +} + /* * __debug_tree -- * Dump the in-memory information for a tree. diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index 56b3febfeb1..462e096263e 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -1441,6 +1441,16 @@ __conn_config_file( err: WT_TRET(__wt_close(session, &fh)); + + /** + * Encountering an invalid configuration string from the base configuration file suggests + * that there is corruption present in the file. + */ + if (!is_user && ret == EINVAL) { + F_SET(S2C(session), WT_CONN_DATA_CORRUPTION); + return (WT_ERROR); + } + return (ret); } @@ -1641,6 +1651,20 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) bytelock = false; ret = 0; } + + /** + * The WiredTiger lock file will not be created if the WiredTiger file does not exist in the + * directory, suggesting possible corruption if the WiredTiger file was deleted. Suggest running + * salvage. + */ + if (ret == ENOENT) { + WT_ERR(__wt_fs_exist(session, WT_WIREDTIGER, &exist)); + if (!exist) { + F_SET(conn, WT_CONN_DATA_CORRUPTION); + WT_ERR(WT_ERROR); + } + } + WT_ERR(ret); if (bytelock) { /* @@ -1683,6 +1707,10 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) ret = 0; WT_ERR(ret); } else { + if (ret == ENOENT) { + F_SET(conn, WT_CONN_DATA_CORRUPTION); + WT_ERR(WT_ERROR); + } WT_ERR(ret); /* * Lock the WiredTiger file (for backward compatibility reasons as described above). diff --git a/src/third_party/wiredtiger/src/conn/conn_dhandle.c b/src/third_party/wiredtiger/src/conn/conn_dhandle.c index cc7f37bc7f0..c947954e75c 100644 --- a/src/third_party/wiredtiger/src/conn/conn_dhandle.c +++ b/src/third_party/wiredtiger/src/conn/conn_dhandle.c @@ -494,6 +494,11 @@ err: if (dhandle->type == WT_DHANDLE_TYPE_BTREE) __wt_evict_file_exclusive_off(session); + if (ret == ENOENT && F_ISSET(dhandle, WT_DHANDLE_IS_METADATA)) { + F_SET(S2C(session), WT_CONN_DATA_CORRUPTION); + return (WT_ERROR); + } + return (ret); } diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 7637f44ce3a..d42e0d43d9d 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -34,6 +34,8 @@ extern bool __wt_las_page_skip_locked(WT_SESSION_IMPL *session, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern bool __wt_lsm_chunk_visible_all(WT_SESSION_IMPL *session, WT_LSM_CHUNK *chunk) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern bool __wt_modify_idempotent(const void *modify) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern bool __wt_page_evict_urgent(WT_SESSION_IMPL *session, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern bool __wt_rwlock_islocked(WT_SESSION_IMPL *session, WT_RWLOCK *l) @@ -572,6 +574,8 @@ extern int __wt_debug_addr(WT_SESSION_IMPL *session, const uint8_t *addr, size_t const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_addr_print(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_debug_cursor_las(void *cursor_arg, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE( + (visibility("default"))) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_cursor_page(void *cursor_arg, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE( (visibility("default"))) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_disk(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile) diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c index 80e409f380f..db790537c79 100644 --- a/src/third_party/wiredtiger/src/meta/meta_turtle.c +++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c @@ -335,7 +335,7 @@ err: */ if (ret == 0 || strcmp(key, WT_METADATA_COMPAT) == 0 || F_ISSET(S2C(session), WT_CONN_SALVAGE)) return (ret); - WT_PANIC_RET(session, ret, "%s: fatal turtle file read error", WT_METADATA_TURTLE); + WT_PANIC_RET(session, WT_TRY_SALVAGE, "%s: fatal turtle file read error", WT_METADATA_TURTLE); } /* diff --git a/src/third_party/wiredtiger/src/support/modify.c b/src/third_party/wiredtiger/src/support/modify.c index 086fb4b3920..56d44af77ef 100644 --- a/src/third_party/wiredtiger/src/support/modify.c +++ b/src/third_party/wiredtiger/src/support/modify.c @@ -38,6 +38,36 @@ } \ while (0) +/* + * __wt_modify_idempotent -- + * Check if a modify operation is idempotent. + */ +bool +__wt_modify_idempotent(const void *modify) +{ + WT_MODIFY mod; + size_t tmp; + const size_t *p; + int nentries; + + /* Get the number of modify entries. */ + p = modify; + memcpy(&tmp, p++, sizeof(size_t)); + nentries = (int)tmp; + + WT_MODIFY_FOREACH_BEGIN (mod, p, nentries, 0) { + /* + * If the number of bytes being replaced doesn't match the number of bytes being written, + * we're resizing and the operation isn't idempotent. + */ + if (mod.size != mod.data.size) + return (false); + } + WT_MODIFY_FOREACH_END; + + return (true); +} + /* * __wt_modify_pack -- * Pack a modify structure into a buffer. @@ -224,8 +254,7 @@ __modify_fast_path(WT_ITEM *value, const size_t *p, int nentries, int *nappliedp */ fastpath = first = true; *nappliedp = 0; - WT_MODIFY_FOREACH_BEGIN(current, p, nentries, 0) - { + WT_MODIFY_FOREACH_BEGIN (current, p, nentries, 0) { datasz += current.data.size; if (fastpath && current.data.size == current.size && @@ -295,8 +324,7 @@ __modify_apply_no_overlap(WT_SESSION_IMPL *session, WT_ITEM *value, const size_t from = (const uint8_t *)value->data + value->size; to = (uint8_t *)value->data + destsz; - WT_MODIFY_FOREACH_REVERSE(current, p, nentries, napplied, datasz) - { + WT_MODIFY_FOREACH_REVERSE (current, p, nentries, napplied, datasz) { /* Move the current unmodified block into place if necessary. */ sz = WT_PTRDIFF(to, value->data) - (current.offset + current.data.size); from -= sz; @@ -374,8 +402,7 @@ __wt_modify_apply(WT_CURSOR *cursor, const void *modify) goto done; } - WT_MODIFY_FOREACH_BEGIN(mod, p, nentries, napplied) - { + WT_MODIFY_FOREACH_BEGIN (mod, p, nentries, napplied) { WT_RET(__modify_apply_one(session, value, &mod, sformat)); } WT_MODIFY_FOREACH_END; diff --git a/src/third_party/wiredtiger/src/txn/txn_log.c b/src/third_party/wiredtiger/src/txn/txn_log.c index 124465cc529..9dfb65306ca 100644 --- a/src/third_party/wiredtiger/src/txn/txn_log.c +++ b/src/third_party/wiredtiger/src/txn/txn_log.c @@ -80,7 +80,16 @@ __txn_op_log( #endif switch (upd->type) { case WT_UPDATE_MODIFY: - WT_RET(__wt_logop_row_modify_pack(session, logrec, fileid, &cursor->key, &value)); + /* + * Write full updates to the log for size-changing modify operations: they aren't + * idempotent and recovery cannot guarantee that they will be applied exactly once. We + * rely on the cursor value already having the modify applied. + */ + if (__wt_modify_idempotent(upd->data)) + WT_RET(__wt_logop_row_modify_pack(session, logrec, fileid, &cursor->key, &value)); + else + WT_RET( + __wt_logop_row_put_pack(session, logrec, fileid, &cursor->key, &cursor->value)); break; case WT_UPDATE_STANDARD: WT_RET(__wt_logop_row_put_pack(session, logrec, fileid, &cursor->key, &value)); @@ -97,7 +106,10 @@ __txn_op_log( switch (upd->type) { case WT_UPDATE_MODIFY: - WT_RET(__wt_logop_col_modify_pack(session, logrec, fileid, recno, &value)); + if (__wt_modify_idempotent(upd->data)) + WT_RET(__wt_logop_col_modify_pack(session, logrec, fileid, recno, &value)); + else + WT_RET(__wt_logop_col_put_pack(session, logrec, fileid, recno, &cursor->value)); break; case WT_UPDATE_STANDARD: WT_RET(__wt_logop_col_put_pack(session, logrec, fileid, recno, &value)); diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml index 97d69537a9d..76cdee3ebcb 100755 --- a/src/third_party/wiredtiger/test/evergreen.yml +++ b/src/third_party/wiredtiger/test/evergreen.yml @@ -231,6 +231,13 @@ tasks: vars: posix_configure_flags: --enable-silent-rules --enable-diagnostic --enable-strict --enable-python + - name: compile-wtperf + commands: + - func: "get project" + - func: "compile wiredtiger" + vars: + posix_configure_flags: --enable-strict --enable-diagnostic + - name: make-check-test depends_on: - name: compile @@ -1586,6 +1593,27 @@ tasks: display_name: Coverage report remote_file: wiredtiger/${build_variant}/${revision}/coverage_report/coverage_report_${build_id}.html + - name: wtperf-test + depends_on: + - name: compile-wtperf + commands: + - func: "fetch artifacts" + vars: + dependent_task: compile-wtperf + - command: shell.exec + params: + working_dir: "wiredtiger/build_posix" + script: | + set -o errexit + set -o verbose + # The test will generate WT_TEST directory automatically + dir=../bench/wtperf/stress + for file in `ls $dir` + do + ./bench/wtperf/wtperf -O $dir/$file -o verbose=2 + cp -rf WT_TEST WT_TEST_$file + done + buildvariants: - name: ubuntu1804 display_name: Ubuntu 18.04 @@ -1603,11 +1631,14 @@ buildvariants: - name: compile-ubsan - name: ubsan-test - name: linux-directio + - name: syscall-linux - name: make-check-asan-test - name: configure-combinations - name: checkpoint-filetypes-test - name: coverage-report - name: unit-test-long + - name: compile-wtperf + - name: wtperf-test - name: ubuntu1804-python3 display_name: Ubuntu 18.04 (Python3) @@ -1633,19 +1664,6 @@ buildvariants: tasks: - name: package -- name: syscall-linux - display_name: Syscall Linux - batchtime: 10080 # a week - run_on: - - ubuntu1804-test - expansions: - test_env_vars: PATH=/opt/mongodbtoolchain/v3/bin:$PATH LD_LIBRARY_PATH=$(pwd)/.libs top_srcdir=$(pwd)/.. top_builddir=$(pwd) - smp_command: -j $(grep -c ^processor /proc/cpuinfo) - make_command: PATH=/opt/mongodbtoolchain/v3/bin:$PATH make - tasks: - - name: compile - - name: syscall-linux - - name: linux-no-ftruncate display_name: Linux no ftruncate batchtime: 10080 # 1 day @@ -1755,6 +1773,7 @@ buildvariants: smp_command: -j $(grep -c ^processor /proc/cpuinfo) posix_configure_flags: --enable-silent-rules --enable-diagnostic --enable-python --enable-zlib --enable-snappy --enable-strict --enable-static --prefix=$(pwd)/LOCAL_INSTALL make_command: PATH=/opt/mongodbtoolchain/v3/bin:$PATH make + test_env_vars: PATH=/opt/mongodbtoolchain/v3/bin:$PATH LD_LIBRARY_PATH=$(pwd)/.libs top_srcdir=$(pwd)/.. top_builddir=$(pwd) tasks: - name: compile - name: unit-test @@ -1767,6 +1786,7 @@ buildvariants: smp_command: -j $(grep -c ^processor /proc/cpuinfo) posix_configure_flags: --enable-silent-rules --enable-diagnostic --enable-python --enable-zlib --enable-snappy --enable-strict --enable-static --prefix=$(pwd)/LOCAL_INSTALL make_command: PATH=/opt/mongodbtoolchain/v3/bin:$PATH make + test_env_vars: PATH=/opt/mongodbtoolchain/v3/bin:$PATH LD_LIBRARY_PATH=$(pwd)/.libs:$(pwd)/lang/python top_srcdir=$(pwd)/.. top_builddir=$(pwd) tasks: - name: compile - name: unit-test diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h index d8cfea5730a..bae89f7e2f6 100644 --- a/src/third_party/wiredtiger/test/format/format.h +++ b/src/third_party/wiredtiger/test/format/format.h @@ -63,6 +63,7 @@ typedef struct { char *home_backup_init; /* Initialize backup command */ char *home_config; /* Run CONFIG file path */ char *home_init; /* Initialize home command */ + char *home_lasdump; /* LAS dump filename */ char *home_log; /* Operation log file path */ char *home_pagedump; /* Page dump filename */ char *home_rand; /* RNG log file path */ diff --git a/src/third_party/wiredtiger/test/format/snap.c b/src/third_party/wiredtiger/test/format/snap.c index e68309c0149..eed296e212f 100644 --- a/src/third_party/wiredtiger/test/format/snap.c +++ b/src/third_party/wiredtiger/test/format/snap.c @@ -191,19 +191,14 @@ snap_verify(WT_CURSOR *cursor, TINFO *tinfo, SNAP_OPS *snap) return (0); } -/* Things went pear-shaped. */ -#ifdef HAVE_DIAGNOSTIC - fprintf(stderr, "snapshot-isolation error: Dumping page to %s\n", g.home_pagedump); - testutil_check(__wt_debug_cursor_page(cursor, g.home_pagedump)); -#endif + /* Things went pear-shaped. */ switch (g.type) { case FIX: - testutil_die(ret, "snapshot-isolation: %" PRIu64 - " search: " - "expected {0x%02x}, found {0x%02x}", - keyno, snap->op == REMOVE ? 0 : *(uint8_t *)snap->vdata, - ret == WT_NOTFOUND ? 0 : *(uint8_t *)value->data); - /* NOTREACHED */ + fprintf(stderr, + "snapshot-isolation: %" PRIu64 " search: expected {0x%02x}, found {0x%02x}\n", keyno, + snap->op == REMOVE ? 0U : *(uint8_t *)snap->vdata, + ret == WT_NOTFOUND ? 0U : *(uint8_t *)value->data); + break; case ROW: fprintf( stderr, "snapshot-isolation %.*s search mismatch\n", (int)key->size, (char *)key->data); @@ -216,10 +211,7 @@ snap_verify(WT_CURSOR *cursor, TINFO *tinfo, SNAP_OPS *snap) fprintf(stderr, " found {deleted}\n"); else print_item_data(" found", value->data, value->size); - - testutil_die( - ret, "snapshot-isolation: %.*s search mismatch", (int)key->size, (char *)key->data); - /* NOTREACHED */ + break; case VAR: fprintf(stderr, "snapshot-isolation %" PRIu64 " search mismatch\n", keyno); @@ -231,8 +223,35 @@ snap_verify(WT_CURSOR *cursor, TINFO *tinfo, SNAP_OPS *snap) fprintf(stderr, " found {deleted}\n"); else print_item_data(" found", value->data, value->size); + break; + } +#ifdef HAVE_DIAGNOSTIC + /* + * We have a mismatch. Try to print out as much information as we can. In doing so, we are + * calling into the debug code directly and that does not take locks. So it is possible that the + * calls may crash in some way. + * + * The most important information is the key/value mismatch information. Then try to dump out + * the other information. Right now we dump the entire lookaside table including what is on + * disk. That can potentially be very large. If it becomes a problem, this can be modified to + * just dump out the page this key is on. + */ + fprintf(stderr, "snapshot-isolation error: Dumping page to %s\n", g.home_pagedump); + testutil_check(__wt_debug_cursor_page(cursor, g.home_pagedump)); + fprintf(stderr, "snapshot-isolation error: Dumping LAS to %s\n", g.home_lasdump); + testutil_check(__wt_debug_cursor_las(cursor, g.home_lasdump)); + if (g.logging) + testutil_check(cursor->session->log_flush(cursor->session, "sync=off")); +#endif + switch (g.type) { + case FIX: + case VAR: testutil_die(ret, "snapshot-isolation: %" PRIu64 " search mismatch", keyno); + /* NOTREACHED */ + case ROW: + testutil_die( + ret, "snapshot-isolation: %.*s search mismatch", (int)key->size, (char *)key->data); /* NOTREACHED */ } diff --git a/src/third_party/wiredtiger/test/format/util.c b/src/third_party/wiredtiger/test/format/util.c index bdc98d25b46..95ded261097 100644 --- a/src/third_party/wiredtiger/test/format/util.c +++ b/src/third_party/wiredtiger/test/format/util.c @@ -329,6 +329,11 @@ path_setup(const char *home) g.home_log = dmalloc(len); testutil_check(__wt_snprintf(g.home_log, len, "%s/%s", g.home, "log")); + /* LAS dump file. */ + len = strlen(g.home) + strlen("LASdump") + 2; + g.home_lasdump = dmalloc(len); + testutil_check(__wt_snprintf(g.home_lasdump, len, "%s/%s", g.home, "LASdump")); + /* Page dump file. */ len = strlen(g.home) + strlen("pagedump") + 2; g.home_pagedump = dmalloc(len); diff --git a/src/third_party/wiredtiger/test/suite/test_txn19.py b/src/third_party/wiredtiger/test/suite/test_txn19.py index c63e9f9c6e9..87cbf608a7c 100755 --- a/src/third_party/wiredtiger/test/suite/test_txn19.py +++ b/src/third_party/wiredtiger/test/suite/test_txn19.py @@ -520,11 +520,7 @@ class test_txn19_meta(wttest.WiredTigerTestCase, suite_subprocess): if expect_fail: self.check_file_contains_one_of(errfile, - ['/unknown configuration key/', - '/handle-open:/', - '/turtle file read error: WT_NOTFOUND: item not found/', - 'WT_ERROR: non-specific WiredTiger error', - 'WT_TRY_SALVAGE: database corruption detected']) + ['WT_TRY_SALVAGE: database corruption detected']) for salvagedir in [ newdir, newdir2 ]: # Removing the 'WiredTiger.turtle' file has weird behavior: -- cgit v1.2.1