diff options
38 files changed, 145 insertions, 105 deletions
diff --git a/src/third_party/wiredtiger/api/leveldb/Makefile.am b/src/third_party/wiredtiger/api/leveldb/Makefile.am index 2cfd9d945a5..34f2f97ec36 100644 --- a/src/third_party/wiredtiger/api/leveldb/Makefile.am +++ b/src/third_party/wiredtiger/api/leveldb/Makefile.am @@ -78,4 +78,4 @@ leveldb_test_LDADD = libwiredtiger_leveldb.la TESTS = $(noinst_PROGRAMS) clean-local: - rm -rf WTLDB_HOME + rm -rf WTLDB_HOME core.* *.core diff --git a/src/third_party/wiredtiger/bench/wtperf/Makefile.am b/src/third_party/wiredtiger/bench/wtperf/Makefile.am index 57792e3887f..5690d03224e 100644 --- a/src/third_party/wiredtiger/bench/wtperf/Makefile.am +++ b/src/third_party/wiredtiger/bench/wtperf/Makefile.am @@ -18,4 +18,4 @@ AM_TESTS_ENVIRONMENT = rm -rf WT_TEST ; mkdir WT_TEST ; TESTS_ENVIRONMENT = $(AM_TESTS_ENVIRONMENT) clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/dist/function.py b/src/third_party/wiredtiger/dist/function.py index 446f16dc47f..7c632b4e227 100644 --- a/src/third_party/wiredtiger/dist/function.py +++ b/src/third_party/wiredtiger/dist/function.py @@ -49,11 +49,14 @@ types = [ 'TEST_', 'WT_', 'wt_', + 'DWORD', 'double', 'float', 'intmax_t', 'intptr_t', + 'clock_t', 'pid_t', + 'pthread_t', 'size_t', 'ssize_t', 'time_t', diff --git a/src/third_party/wiredtiger/dist/s_clang-tidy b/src/third_party/wiredtiger/dist/s_clang-tidy index 89d3fa4112a..8fd140ca883 100644 --- a/src/third_party/wiredtiger/dist/s_clang-tidy +++ b/src/third_party/wiredtiger/dist/s_clang-tidy @@ -48,16 +48,22 @@ args="-checks=*" args="$args,-android-cloexec-fopen" args="$args,-clang-analyzer-core.NullDereference" args="$args,-clang-analyzer-optin.performance.Padding" +args="$args,-cppcoreguidelines-avoid-magic-numbers" args="$args,-google-readability-braces-around-statements" args="$args,-hicpp-braces-around-statements" +args="$args,-hicpp-multiway-paths-covered" args="$args,-hicpp-no-assembler" args="$args,-hicpp-signed-bitwise" +args="$args,-hicpp-uppercase-literal-suffix" +args="$args,-hicpp-uppercase-literal-suffix-header-guard" args="$args,-llvm-header-guard" args="$args,-llvm-include-order" args="$args,-readability-braces-around-statements" args="$args,-readability-inconsistent-declaration-parameter-name" +args="$args,-readability-magic-numbers" args="$args,-readability-named-parameter" args="$args,-readability-non-const-parameter" +args="$args,-readability-uppercase-literal-suffix" # clang-tidy gets unhappy if we toss the whole tree at it, so run # through a file at a time. diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok index 20befb6bf97..c5546aed751 100644 --- a/src/third_party/wiredtiger/dist/s_string.ok +++ b/src/third_party/wiredtiger/dist/s_string.ok @@ -701,6 +701,7 @@ endian english enqueue enqueued +enum env eof epi diff --git a/src/third_party/wiredtiger/examples/c/Makefile.am b/src/third_party/wiredtiger/examples/c/Makefile.am index 41a9bcdc6bb..e441d45af46 100644 --- a/src/third_party/wiredtiger/examples/c/Makefile.am +++ b/src/third_party/wiredtiger/examples/c/Makefile.am @@ -39,4 +39,4 @@ AM_TESTS_ENVIRONMENT = WIREDTIGER_HOME=`mktemp -d WT_HOME.XXXX` ; export WIREDTI LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WT_HOME* *.core backup_full.* backup_incr.* + rm -rf WT_HOME* core.* *.core backup_full.* backup_incr.* diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 49a7eb25cc7..53289581e95 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "5812c92f5fb2ed3b58d0398e5cbe1cb33380d450", + "commit": "d5793d4dd57bb763079e3f79821444e7e666ff44", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.2" diff --git a/src/third_party/wiredtiger/lang/python/Makefile.am b/src/third_party/wiredtiger/lang/python/Makefile.am index b32d0321194..d7539c35bdd 100644 --- a/src/third_party/wiredtiger/lang/python/Makefile.am +++ b/src/third_party/wiredtiger/lang/python/Makefile.am @@ -24,6 +24,6 @@ install-exec-local: # clean up both. Don't rely on "setup.py clean" -- everything that should # be removed is created under the build directory. clean-local: - rm -rf build _wiredtiger.so wiredtiger_wrap.o WT_TEST + rm -rf build _wiredtiger.so wiredtiger_wrap.o WT_TEST core.* *.core TESTS = run-ex_access diff --git a/src/third_party/wiredtiger/src/conn/api_calc_modify.c b/src/third_party/wiredtiger/src/conn/api_calc_modify.c index 6de88644f79..a5a7fdff2b7 100644 --- a/src/third_party/wiredtiger/src/conn/api_calc_modify.c +++ b/src/third_party/wiredtiger/src/conn/api_calc_modify.c @@ -151,7 +151,7 @@ wiredtiger_calc_modify(WT_SESSION *wt_session, * in the post-image without finding a good match, double the size of * the gap, update the markers and keep trying. */ - h = hstart = hend = 0; + hstart = hend = 0; i = gap = 0; for (p1 = cms.used1, p2 = cms.used2, start = true; p1 + WT_CM_BLOCKSIZE <= cms.e1 && p2 + WT_CM_BLOCKSIZE <= cms.e2; diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index 085100dc2b3..c01fd84b7d0 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -2613,10 +2613,11 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, } WT_ERR(__wt_config_gets(session, cfg, "buffer_alignment", &cval)); - if (cval.val == -1) - conn->buffer_alignment = - (conn->direct_io == 0) ? 0 : WT_BUFFER_ALIGNMENT_DEFAULT; - else + if (cval.val == -1) { + conn->buffer_alignment = 0; + if (conn->direct_io != 0) + conn->buffer_alignment = WT_BUFFER_ALIGNMENT_DEFAULT; + } else conn->buffer_alignment = (size_t)cval.val; #ifndef HAVE_POSIX_MEMALIGN if (conn->buffer_alignment != 0) diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c index 741ea80f1cb..0e1ceae2fa0 100644 --- a/src/third_party/wiredtiger/src/conn/conn_stat.c +++ b/src/third_party/wiredtiger/src/conn/conn_stat.c @@ -613,6 +613,9 @@ __statlog_server(void *arg) session = arg; conn = S2C(session); + WT_CLEAR(path); + WT_CLEAR(tmp); + /* * We need a temporary place to build a path and an entry prefix. * The length of the path plus 128 should be more than enough. @@ -620,10 +623,8 @@ __statlog_server(void *arg) * We also need a place to store the current path, because that's * how we know when to close/re-open the file. */ - WT_CLEAR(path); WT_ERR(__wt_buf_init(session, &path, strlen(conn->stat_path) + 128)); WT_ERR(__wt_buf_setstr(session, &path, "")); - WT_CLEAR(tmp); WT_ERR(__wt_buf_init(session, &tmp, strlen(conn->stat_path) + 128)); WT_ERR(__wt_buf_setstr(session, &tmp, "")); diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c index f5765cc4313..771ff32e328 100644 --- a/src/third_party/wiredtiger/src/evict/evict_page.c +++ b/src/third_party/wiredtiger/src/evict/evict_page.c @@ -38,7 +38,7 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref) * Check for a hazard pointer indicating another thread is using the * page, meaning the page cannot be evicted. */ - if (__wt_hazard_check(session, ref) == NULL) + if (__wt_hazard_check(session, ref, NULL) == NULL) return (0); WT_STAT_DATA_INCR(session, cache_eviction_hazard); diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index d4a72bc340b..50eaa16e847 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -717,7 +717,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp ); extern int __wt_hazard_clear(WT_SESSION_IMPL *session, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_hazard_close(WT_SESSION_IMPL *session); -extern WT_HAZARD *__wt_hazard_check(WT_SESSION_IMPL *session, WT_REF *ref); +extern WT_HAZARD *__wt_hazard_check(WT_SESSION_IMPL *session, WT_REF *ref, WT_SESSION_IMPL **sessionp); extern u_int __wt_hazard_count(WT_SESSION_IMPL *session, WT_REF *ref); extern bool __wt_hazard_check_assert(WT_SESSION_IMPL *session, void *ref, bool waitfor) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_fill_hex(const uint8_t *src, size_t src_max, uint8_t *dest, size_t dest_max, size_t *lenp); diff --git a/src/third_party/wiredtiger/src/include/mutex.h b/src/third_party/wiredtiger/src/include/mutex.h index 5c836526a21..703ee12afc1 100644 --- a/src/third_party/wiredtiger/src/include/mutex.h +++ b/src/third_party/wiredtiger/src/include/mutex.h @@ -82,7 +82,7 @@ struct __wt_rwlock { /* Read/write lock */ WT_RWLOCK_INIT_TRACKED(session, l, name); \ (l)->stat_session_usecs_off = \ (int16_t)WT_SESSION_STATS_FIELD_TO_OFFSET( \ - &(session->stats), lock_##name##_wait); \ + &(session)->stats, lock_##name##_wait); \ } while (0) /* diff --git a/src/third_party/wiredtiger/src/include/mutex.i b/src/third_party/wiredtiger/src/include/mutex.i index d7f715e81e1..93c745bd5fc 100644 --- a/src/third_party/wiredtiger/src/include/mutex.i +++ b/src/third_party/wiredtiger/src/include/mutex.i @@ -290,7 +290,7 @@ __wt_spin_unlock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) WT_SPIN_INIT_TRACKED(session, t, name); \ (t)->stat_session_usecs_off = \ (int16_t)WT_SESSION_STATS_FIELD_TO_OFFSET( \ - &(session->stats), lock_##name##_wait); \ + &(session)->stats, lock_##name##_wait); \ } while (0) /* diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h index c54a9fcc8b0..35bd30419da 100644 --- a/src/third_party/wiredtiger/src/include/stat.h +++ b/src/third_party/wiredtiger/src/include/stat.h @@ -166,7 +166,8 @@ __wt_stats_clear(void *stats_arg, int slot) } while (0) #define WT_STAT_DECRV_ATOMIC_BASE(session, stat, fld, value) do { \ if (WT_STAT_ENABLED(session)) \ - __wt_atomic_subi64(&(stat)->fld, (int64_t)(value)); \ + (void) \ + __wt_atomic_subi64(&(stat)->fld, (int64_t)(value)); \ } while (0) #define WT_STAT_INCRV_BASE(session, stat, fld, value) do { \ if (WT_STAT_ENABLED(session)) \ @@ -174,7 +175,8 @@ __wt_stats_clear(void *stats_arg, int slot) } while (0) #define WT_STAT_INCRV_ATOMIC_BASE(session, stat, fld, value) do { \ if (WT_STAT_ENABLED(session)) \ - __wt_atomic_addi64(&(stat)->fld, (int64_t)(value)); \ + (void) \ + __wt_atomic_addi64(&(stat)->fld, (int64_t)(value)); \ } while (0) #define WT_STAT_DECRV(session, stats, fld, value) do { \ @@ -265,7 +267,7 @@ __wt_stats_clear(void *stats_arg, int slot) * Update per session statistics. */ #define WT_STAT_SESSION_INCRV(session, fld, value) \ - WT_STAT_INCRV_BASE(session, &session->stats, fld, value) + WT_STAT_INCRV_BASE(session, &(session)->stats, fld, value) /* * Construct histogram increment functions to put the passed value into the diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i index 7de59e498d4..a297db2cf9e 100644 --- a/src/third_party/wiredtiger/src/include/txn.i +++ b/src/third_party/wiredtiger/src/include/txn.i @@ -343,51 +343,56 @@ __wt_txn_unmodify(WT_SESSION_IMPL *session) } /* - * __wt_txn_op_commit_page_del -- - * Make the transaction ID and timestamp updates necessary to a ref that - * was created by a fast delete truncate operation. + * __wt_txn_op_apply_prepare_state -- + * Apply the correct prepare state and the timestamp to the ref and to any + * updates in the page del update list. */ static inline void -__wt_txn_op_commit_page_del(WT_SESSION_IMPL *session, WT_REF *ref) +__wt_txn_op_apply_prepare_state( + WT_SESSION_IMPL *session, WT_REF *ref, bool commit) { WT_TXN *txn; WT_UPDATE **updp; + wt_timestamp_t ts; uint32_t previous_state; + uint8_t prepare_state; txn = &session->txn; - /* Avoid locking the page if a previous eviction already cleaned up. */ - if (ref->page_del->update_list == NULL) - return; - /* - * Lock the ref to ensure we don't race with eviction freeing the - * page deleted update list. + * Lock the ref to ensure we don't race with eviction freeing the page + * deleted update list or with a page instantiate. */ for (;; __wt_yield()) { previous_state = ref->state; + WT_ASSERT(session, previous_state != WT_REF_READING); if (previous_state != WT_REF_LOCKED && __wt_atomic_casv32( &ref->state, previous_state, WT_REF_LOCKED)) break; } + if (commit) { + ts = txn->commit_timestamp; + prepare_state = WT_PREPARE_RESOLVED; + } else { + ts = txn->prepare_timestamp; + prepare_state = WT_PREPARE_INPROGRESS; + } for (updp = ref->page_del->update_list; updp != NULL && *updp != NULL; ++updp) { - (*updp)->timestamp = txn->commit_timestamp; - if (F_ISSET(txn, WT_TXN_PREPARE)) - /* - * Holding the ref locked means we have exclusive - * access, so don't need to use the prepare locked - * transition state. - */ - (*updp)->prepare_state = WT_PREPARE_RESOLVED; + (*updp)->timestamp = ts; + /* + * Holding the ref locked means we have exclusive access, so if + * we are committing we don't need to use the prepare locked + * transition state. + */ + (*updp)->prepare_state = prepare_state; } + ref->page_del->timestamp = ts; + WT_PUBLISH(ref->page_del->prepare_state, prepare_state); - /* - * Publish to ensure we don't let the page be evicted and the updates - * discarded before being written. - */ + /* Unlock the page by setting it back to it's previous state */ WT_REF_SET_STATE(ref, previous_state); } @@ -416,8 +421,13 @@ __wt_txn_op_set_timestamp(WT_SESSION_IMPL *session, WT_TXN_OP *op) return; if (F_ISSET(txn, WT_TXN_PREPARE)) { + /* + * We have a commit timestamp for a prepare transaction, this is + * only possible as part of a transaction commit call. + */ if (op->type == WT_TXN_OP_REF_DELETE) - __wt_txn_op_commit_page_del(session, op->u.ref); + __wt_txn_op_apply_prepare_state( + session, op->u.ref, true); else { upd = op->u.op_upd; diff --git a/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c b/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c index 98645456fc4..d1b827d1db5 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c @@ -37,6 +37,7 @@ __lsm_copy_chunks(WT_SESSION_IMPL *session, /* Take a copy of the current state of the LSM tree. */ nchunks = old_chunks ? lsm_tree->nold_chunks : lsm_tree->nchunks; alloc = old_chunks ? lsm_tree->old_alloc : lsm_tree->chunk_alloc; + WT_ASSERT(session, alloc > 0 && nchunks > 0); /* * If the tree array of active chunks is larger than our current buffer, diff --git a/src/third_party/wiredtiger/src/os_common/os_fhandle.c b/src/third_party/wiredtiger/src/os_common/os_fhandle.c index 3e5ad67e031..c76bf8c3f14 100644 --- a/src/third_party/wiredtiger/src/os_common/os_fhandle.c +++ b/src/third_party/wiredtiger/src/os_common/os_fhandle.c @@ -128,16 +128,46 @@ __handle_search( } /* + * __open_verbose_file_type_tag -- + * Return a string describing a file type. + */ +static const char * +__open_verbose_file_type_tag(WT_FS_OPEN_FILE_TYPE file_type) +{ + + /* + * WT_FS_OPEN_FILE_TYPE is an enum and the switch exhaustively lists the + * cases, but clang, lint and gcc argue over whether or not the switch + * is exhaustive, or if a temporary variable inserted into the mix is + * set but never read. Break out of the switch, returning some value in + * all cases, just to shut everybody up. + */ + switch (file_type) { + case WT_FS_OPEN_FILE_TYPE_CHECKPOINT: + return ("checkpoint"); + case WT_FS_OPEN_FILE_TYPE_DATA: + return ("data"); + case WT_FS_OPEN_FILE_TYPE_DIRECTORY: + return ("directory"); + case WT_FS_OPEN_FILE_TYPE_LOG: + return ("log"); + case WT_FS_OPEN_FILE_TYPE_REGULAR: + break; + } + return ("regular"); +} + +/* * __open_verbose -- * Optionally output a verbose message on handle open. */ static inline int -__open_verbose( - WT_SESSION_IMPL *session, const char *name, int file_type, u_int flags) +__open_verbose(WT_SESSION_IMPL *session, + const char *name, WT_FS_OPEN_FILE_TYPE file_type, u_int flags) { WT_DECL_ITEM(tmp); WT_DECL_RET; - const char *file_type_tag, *sep; + const char *sep; if (!WT_VERBOSE_ISSET(session, WT_VERB_FILEOPS)) return (0); @@ -146,28 +176,6 @@ __open_verbose( * It's useful to track file opens when debugging platforms, take some * effort to output good tracking information. */ - - switch (file_type) { - case WT_FS_OPEN_FILE_TYPE_CHECKPOINT: - file_type_tag = "checkpoint"; - break; - case WT_FS_OPEN_FILE_TYPE_DATA: - file_type_tag = "data"; - break; - case WT_FS_OPEN_FILE_TYPE_DIRECTORY: - file_type_tag = "directory"; - break; - case WT_FS_OPEN_FILE_TYPE_LOG: - file_type_tag = "log"; - break; - case WT_FS_OPEN_FILE_TYPE_REGULAR: - file_type_tag = "regular"; - break; - default: - file_type_tag = "unknown open type"; - break; - } - WT_RET(__wt_scr_alloc(session, 0, &tmp)); sep = " ("; #define WT_FS_OPEN_VERBOSE_FLAG(f, name) \ @@ -188,7 +196,8 @@ __open_verbose( __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-open: type %s%s", - name, file_type_tag, tmp->size == 0 ? "" : (char *)tmp->data); + name, __open_verbose_file_type_tag(file_type), + tmp->size == 0 ? "" : (char *)tmp->data); err: __wt_scr_free(session, &tmp); return (ret); diff --git a/src/third_party/wiredtiger/src/os_win/os_dlopen.c b/src/third_party/wiredtiger/src/os_win/os_dlopen.c index a4e7ebe4fbb..153dd86abe5 100644 --- a/src/third_party/wiredtiger/src/os_win/os_dlopen.c +++ b/src/third_party/wiredtiger/src/os_win/os_dlopen.c @@ -15,9 +15,9 @@ int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) { - DWORD windows_error; WT_DECL_RET; WT_DLH *dlh; + DWORD windows_error; WT_RET(__wt_calloc_one(session, &dlh)); WT_ERR(__wt_strdup(session, path, &dlh->name)); @@ -80,8 +80,8 @@ __wt_dlsym(WT_SESSION_IMPL *session, int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) { - DWORD windows_error; WT_DECL_RET; + DWORD windows_error; if (FreeLibrary(dlh->handle) == FALSE) { windows_error = __wt_getlasterror(); diff --git a/src/third_party/wiredtiger/src/os_win/os_fs.c b/src/third_party/wiredtiger/src/os_win/os_fs.c index 2eac258fc70..e0011461b0a 100644 --- a/src/third_party/wiredtiger/src/os_win/os_fs.c +++ b/src/third_party/wiredtiger/src/os_win/os_fs.c @@ -41,10 +41,10 @@ static int __win_fs_remove(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *name, uint32_t flags) { - DWORD windows_error; WT_DECL_ITEM(name_wide); WT_DECL_RET; WT_SESSION_IMPL *session; + DWORD windows_error; WT_UNUSED(file_system); WT_UNUSED(flags); @@ -74,11 +74,11 @@ static int __win_fs_rename(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *from, const char *to, uint32_t flags) { - DWORD windows_error; WT_DECL_ITEM(from_wide); WT_DECL_ITEM(to_wide); WT_DECL_RET; WT_SESSION_IMPL *session; + DWORD windows_error; WT_UNUSED(file_system); WT_UNUSED(flags); @@ -153,10 +153,10 @@ err: __wt_scr_free(session, &name_wide); static int __win_file_close(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session) { - DWORD windows_error; WT_DECL_RET; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; + DWORD windows_error; win_fh = (WT_FILE_HANDLE_WIN *)file_handle; session = (WT_SESSION_IMPL *)wt_session; @@ -201,10 +201,10 @@ static int __win_file_lock( WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, bool lock) { - DWORD windows_error; WT_DECL_RET; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; + DWORD windows_error; win_fh = (WT_FILE_HANDLE_WIN *)file_handle; session = (WT_SESSION_IMPL *)wt_session; @@ -329,10 +329,10 @@ __win_file_size( static int __win_file_sync(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session) { - DWORD windows_error; WT_DECL_RET; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; + DWORD windows_error; win_fh = (WT_FILE_HANDLE_WIN *)file_handle; session = (WT_SESSION_IMPL *)wt_session; @@ -466,13 +466,13 @@ __win_open_file(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *name, WT_FS_OPEN_FILE_TYPE file_type, uint32_t flags, WT_FILE_HANDLE **file_handlep) { - DWORD dwCreationDisposition, windows_error; WT_CONNECTION_IMPL *conn; WT_DECL_ITEM(name_wide); WT_DECL_RET; WT_FILE_HANDLE *file_handle; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; + DWORD dwCreationDisposition, windows_error; int desired_access, f; WT_UNUSED(file_system); diff --git a/src/third_party/wiredtiger/src/os_win/os_map.c b/src/third_party/wiredtiger/src/os_win/os_map.c index 2223a6037ef..c2a404720bc 100644 --- a/src/third_party/wiredtiger/src/os_win/os_map.c +++ b/src/third_party/wiredtiger/src/os_win/os_map.c @@ -16,11 +16,11 @@ int __wt_win_map(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) { - DWORD windows_error; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; - size_t len; wt_off_t file_size; + DWORD windows_error; + size_t len; void *map, *mapped_cookie; win_fh = (WT_FILE_HANDLE_WIN *)file_handle; @@ -77,10 +77,10 @@ int __wt_win_unmap(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_region, size_t length, void *mapped_cookie) { - DWORD windows_error; WT_DECL_RET; WT_FILE_HANDLE_WIN *win_fh; WT_SESSION_IMPL *session; + DWORD windows_error; win_fh = (WT_FILE_HANDLE_WIN *)file_handle; session = (WT_SESSION_IMPL *)wt_session; diff --git a/src/third_party/wiredtiger/src/support/hazard.c b/src/third_party/wiredtiger/src/support/hazard.c index eb65c00741c..2a216ff1d24 100644 --- a/src/third_party/wiredtiger/src/support/hazard.c +++ b/src/third_party/wiredtiger/src/support/hazard.c @@ -322,7 +322,8 @@ hazard_get_reference( * Return if there's a hazard pointer to the page in the system. */ WT_HAZARD * -__wt_hazard_check(WT_SESSION_IMPL *session, WT_REF *ref) +__wt_hazard_check(WT_SESSION_IMPL *session, + WT_REF *ref, WT_SESSION_IMPL **sessionp) { WT_CONNECTION_IMPL *conn; WT_HAZARD *hp; @@ -366,6 +367,8 @@ __wt_hazard_check(WT_SESSION_IMPL *session, WT_REF *ref) if (hp->ref == ref) { WT_STAT_CONN_INCRV(session, cache_hazard_walks, walk_cnt); + if (sessionp != NULL) + *sessionp = s; goto done; } } @@ -408,18 +411,22 @@ bool __wt_hazard_check_assert(WT_SESSION_IMPL *session, void *ref, bool waitfor) { WT_HAZARD *hp; + WT_SESSION_IMPL *s; int i; + s = NULL; for (i = 0;;) { - if ((hp = __wt_hazard_check(session, ref)) == NULL) + if ((hp = __wt_hazard_check(session, ref, &s)) == NULL) return (true); if (!waitfor || ++i > 100) break; __wt_sleep(0, 10000); } __wt_errx(session, - "hazard pointer reference to discarded object: (%p: %s, line %d)", - (void *)hp->ref, hp->func, hp->line); + "hazard pointer reference to discarded object: " + "(%p: session %p name %s: %s, line %d)", + (void *)hp->ref, (void *)s, + s->name == NULL ? "UNKNOWN" : s->name, hp->func, hp->line); return (false); } diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c index 20e469d0262..4ddc75afe6c 100644 --- a/src/third_party/wiredtiger/src/txn/txn.c +++ b/src/third_party/wiredtiger/src/txn/txn.c @@ -992,9 +992,8 @@ __wt_txn_prepare(WT_SESSION_IMPL *session, const char *cfg[]) WT_STAT_CONN_INCR(session, txn_prepared_updates_count); break; case WT_TXN_OP_REF_DELETE: - op->u.ref->page_del->timestamp = ts; - WT_PUBLISH(op->u.ref->page_del->prepare_state, - WT_PREPARE_INPROGRESS); + __wt_txn_op_apply_prepare_state( + session, op->u.ref, false); break; case WT_TXN_OP_TRUNCATE_COL: case WT_TXN_OP_TRUNCATE_ROW: diff --git a/src/third_party/wiredtiger/src/utilities/util_list.c b/src/third_party/wiredtiger/src/utilities/util_list.c index 54e3cd61f8b..72ae405ff87 100644 --- a/src/third_party/wiredtiger/src/utilities/util_list.c +++ b/src/third_party/wiredtiger/src/utilities/util_list.c @@ -69,6 +69,8 @@ list_get_allocsize(WT_SESSION *session, const char *key, size_t *allocsize) int tret; char *config; + *allocsize = 0; + wt_api = session->connection->get_extension_api(session->connection); if ((ret = wt_api->metadata_search(wt_api, session, key, &config)) != 0) return (util_err( @@ -78,10 +80,9 @@ list_get_allocsize(WT_SESSION *session, const char *key, size_t *allocsize) return (util_err( session, ret, "WT_EXTENSION_API.config_parser_open")); if ((ret = parser->get(parser, "allocation_size", &szvalue)) != 0) { - if (ret == WT_NOTFOUND) { - *allocsize = 0; + if (ret == WT_NOTFOUND) ret = 0; - } else + else ret = util_err(session, ret, "WT_CONFIG_PARSER.get"); if ((tret = parser->close(parser)) != 0) (void)util_err(session, tret, "WT_CONFIG_PARSER.close"); diff --git a/src/third_party/wiredtiger/test/bloom/Makefile.am b/src/third_party/wiredtiger/test/bloom/Makefile.am index 81a21f59882..6bba3a5e33f 100644 --- a/src/third_party/wiredtiger/test/bloom/Makefile.am +++ b/src/third_party/wiredtiger/test/bloom/Makefile.am @@ -14,4 +14,4 @@ TESTS = $(noinst_PROGRAMS) LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WiredTiger* *.core + rm -rf WiredTiger* core.* *.core diff --git a/src/third_party/wiredtiger/test/checkpoint/Makefile.am b/src/third_party/wiredtiger/test/checkpoint/Makefile.am index 2b5ba800c9c..da7b85ec0b2 100644 --- a/src/third_party/wiredtiger/test/checkpoint/Makefile.am +++ b/src/third_party/wiredtiger/test/checkpoint/Makefile.am @@ -12,4 +12,4 @@ t_LDFLAGS = -static TESTS = smoke.sh clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/test/csuite/Makefile.am b/src/third_party/wiredtiger/test/csuite/Makefile.am index 6d6e893beb8..362d0775a88 100644 --- a/src/third_party/wiredtiger/test/csuite/Makefile.am +++ b/src/third_party/wiredtiger/test/csuite/Makefile.am @@ -132,4 +132,4 @@ TESTS = $(all_TESTS) LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WT_TEST.* *.core + rm -rf WT_TEST.* core.* *.core diff --git a/src/third_party/wiredtiger/test/csuite/wt3338_partial_update/main.c b/src/third_party/wiredtiger/test/csuite/wt3338_partial_update/main.c index e73f63cdd8a..1d59fab8583 100644 --- a/src/third_party/wiredtiger/test/csuite/wt3338_partial_update/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt3338_partial_update/main.c @@ -232,8 +232,6 @@ compare(WT_ITEM *local, WT_ITEM *library) local->data, library->data, local->size) == 0); } -static int nruns = 10000; - /* * modify_run * Run some tests: @@ -275,7 +273,8 @@ modify_run(bool verbose) memset(&_cursor, 0, sizeof(_cursor)); cursor->value_format = "u"; - for (i = 0; i < nruns; ++i) { +#define NRUNS 10000 + for (i = 0; i < NRUNS; ++i) { /* Create an initial value. */ len = (size_t)(__wt_random(&rnd) % MAX_REPL_BYTES); testutil_check(__wt_buf_set(NULL, localA, modify_repl, len)); @@ -320,7 +319,7 @@ modify_run(bool verbose) compare(localA, &cursor->value); } if (verbose) { - printf("%d (%d%%)\r", i, (i * 100) / nruns); + printf("%d (%d%%)\r", i, (i * 100) / NRUNS); fflush(stdout); } } diff --git a/src/third_party/wiredtiger/test/cursor_order/Makefile.am b/src/third_party/wiredtiger/test/cursor_order/Makefile.am index c98cf1fa047..f5330b57d3b 100644 --- a/src/third_party/wiredtiger/test/cursor_order/Makefile.am +++ b/src/third_party/wiredtiger/test/cursor_order/Makefile.am @@ -12,4 +12,4 @@ cursor_order_LDFLAGS = -static TESTS = $(noinst_PROGRAMS) clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/test/fops/Makefile.am b/src/third_party/wiredtiger/test/fops/Makefile.am index f8a76de82bc..519f6315445 100644 --- a/src/third_party/wiredtiger/test/fops/Makefile.am +++ b/src/third_party/wiredtiger/test/fops/Makefile.am @@ -15,4 +15,4 @@ TESTS = $(noinst_PROGRAMS) LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/test/format/Makefile.am b/src/third_party/wiredtiger/test/format/Makefile.am index 5d946e5b63d..3a74cb0c104 100644 --- a/src/third_party/wiredtiger/test/format/Makefile.am +++ b/src/third_party/wiredtiger/test/format/Makefile.am @@ -45,4 +45,4 @@ refresh: TESTS = smoke.sh clean-local: - rm -rf RUNDIR s_dumpcmp *.core + rm -rf RUNDIR s_dumpcmp core.* *.core diff --git a/src/third_party/wiredtiger/test/huge/Makefile.am b/src/third_party/wiredtiger/test/huge/Makefile.am index 894bff5eace..402e8efc81e 100644 --- a/src/third_party/wiredtiger/test/huge/Makefile.am +++ b/src/third_party/wiredtiger/test/huge/Makefile.am @@ -13,4 +13,4 @@ t_LDFLAGS = -static TESTS = smoke.sh clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/test/manydbs/Makefile.am b/src/third_party/wiredtiger/test/manydbs/Makefile.am index ff5985cf2a4..66310350d71 100644 --- a/src/third_party/wiredtiger/test/manydbs/Makefile.am +++ b/src/third_party/wiredtiger/test/manydbs/Makefile.am @@ -14,4 +14,4 @@ TESTS = $(noinst_PROGRAMS) LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WT_TEST *.core + rm -rf WT_TEST core.* *.core diff --git a/src/third_party/wiredtiger/test/packing/Makefile.am b/src/third_party/wiredtiger/test/packing/Makefile.am index c9128100cc3..0f6f59d2cff 100644 --- a/src/third_party/wiredtiger/test/packing/Makefile.am +++ b/src/third_party/wiredtiger/test/packing/Makefile.am @@ -11,4 +11,4 @@ LDFLAGS = -static TESTS = smoke.sh clean-local: - rm -rf *.core + rm -rf core.* *.core diff --git a/src/third_party/wiredtiger/test/readonly/Makefile.am b/src/third_party/wiredtiger/test/readonly/Makefile.am index 84092e76f02..7dd08586122 100644 --- a/src/third_party/wiredtiger/test/readonly/Makefile.am +++ b/src/third_party/wiredtiger/test/readonly/Makefile.am @@ -13,4 +13,4 @@ t_LDFLAGS = -static TESTS = smoke.sh clean-local: - rm -rf WT_RD* *.core + rm -rf WT_RD* core.* *.core diff --git a/src/third_party/wiredtiger/test/salvage/Makefile.am b/src/third_party/wiredtiger/test/salvage/Makefile.am index a3c49b9c41a..b9ba9c35d72 100644 --- a/src/third_party/wiredtiger/test/salvage/Makefile.am +++ b/src/third_party/wiredtiger/test/salvage/Makefile.am @@ -14,4 +14,4 @@ TESTS = $(noinst_PROGRAMS) LOG_COMPILER = $(TEST_WRAPPER) clean-local: - rm -rf WiredTiger* __slvg* *.core + rm -rf WiredTiger* __slvg* core.* *.core diff --git a/src/third_party/wiredtiger/test/thread/Makefile.am b/src/third_party/wiredtiger/test/thread/Makefile.am index 58b715d4a80..182effa3201 100644 --- a/src/third_party/wiredtiger/test/thread/Makefile.am +++ b/src/third_party/wiredtiger/test/thread/Makefile.am @@ -12,4 +12,4 @@ t_LDFLAGS = -static TESTS = smoke.sh clean-local: - rm -rf WT_TEST __stats *.core + rm -rf WT_TEST __stats core.* *.core |