diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-11-02 16:36:36 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-11-02 16:36:36 +1100 |
commit | a19da30a1bf7462c9a8a0533c43f98bd13fbb190 (patch) | |
tree | 090e8225ea84e4971a077dd26dadf3c61068bf33 /src/third_party/wiredtiger/src/include | |
parent | 1559bd33d108e58ffdc0df5fa2af4cc163ae9721 (diff) | |
download | mongo-a19da30a1bf7462c9a8a0533c43f98bd13fbb190.tar.gz |
Import wiredtiger: e8cf194d813096cc2b30c0dd2d9d9c93ade79756 from branch mongodb-4.2
ref: 22b1224ee0..e8cf194d81
for: 4.1.5
WT-4298 Fix workgen to retry on WT_ROLLBACK and clear ops after warmup
WT-4343 Unlock when sleeping to allow other log threads to make progress
WT-4371 Workgen improvements to create a MongoDB-like workload
WT-4376 Fix a bug where table index open can race
WT-4385 Prepare-conflict during a cursor scan can return the wrong key
WT-4392 A large lint change
WT-4395 Seg fault walking corrupted log with log cursor
WT-4396 When retrying after prepare-conflict, cursor unable to find a valid update
WT-4400 Fix workgen use of PRIxxx macros, needed for old C++ compilers
Diffstat (limited to 'src/third_party/wiredtiger/src/include')
-rw-r--r-- | src/third_party/wiredtiger/src/include/api.h | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/btmem.h | 49 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/btree.h | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/config.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cursor.i | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/misc.i | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wt_internal.h | 2 |
8 files changed, 41 insertions, 32 deletions
diff --git a/src/third_party/wiredtiger/src/include/api.h b/src/third_party/wiredtiger/src/include/api.h index 1c22c99a11c..f363d45efad 100644 --- a/src/third_party/wiredtiger/src/include/api.h +++ b/src/third_party/wiredtiger/src/include/api.h @@ -93,7 +93,7 @@ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT); \ __update = !F_ISSET(&(s)->txn, WT_TXN_UPDATE); \ if (__update) \ - F_SET(&(s)->txn, WT_TXN_UPDATE); \ + F_SET(&(s)->txn, WT_TXN_UPDATE); /* An API call wrapped in a transaction if necessary. */ #define TXN_API_CALL_NOCONF(s, h, n, dh) do { \ @@ -105,7 +105,7 @@ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT); \ __update = !F_ISSET(&(s)->txn, WT_TXN_UPDATE); \ if (__update) \ - F_SET(&(s)->txn, WT_TXN_UPDATE); \ + F_SET(&(s)->txn, WT_TXN_UPDATE); /* End a transactional API call, optional retry on deadlock. */ #define TXN_API_END_RETRY(s, ret, retry) \ diff --git a/src/third_party/wiredtiger/src/include/btmem.h b/src/third_party/wiredtiger/src/include/btmem.h index c6f9aa2aa07..65ec0b3b816 100644 --- a/src/third_party/wiredtiger/src/include/btmem.h +++ b/src/third_party/wiredtiger/src/include/btmem.h @@ -857,29 +857,6 @@ struct __wt_ref { #define WT_REF_SPLIT 7 /* Parent page split (WT_REF dead) */ volatile uint32_t state; /* Page state */ -#ifdef HAVE_DIAGNOSTIC - /* Capture history of ref state changes. */ - struct { - WT_SESSION_IMPL *session; - const char *name; - const char *file; - int line; - uint32_t state; - } hist[3]; - int histoff; -#define WT_REF_SET_STATE(ref, s) do { \ - ref->hist[ref->histoff].session = session; \ - ref->hist[ref->histoff].name = session->name; \ - ref->hist[ref->histoff].file = __FILE__; \ - ref->hist[ref->histoff].line = __LINE__; \ - ref->hist[ref->histoff].state = s; \ - ref->histoff = (ref->histoff + 1) % (int)WT_ELEMENTS(ref->hist);\ - WT_PUBLISH(ref->state, s); \ -} while (0) -#else -#define WT_REF_SET_STATE(ref, s) WT_PUBLISH(ref->state, s) -#endif - /* * Address: on-page cell if read from backing block, off-page WT_ADDR * if instantiated in-memory, or NULL if page created in-memory. @@ -901,13 +878,37 @@ struct __wt_ref { WT_PAGE_DELETED *page_del; /* Deleted page information */ WT_PAGE_LOOKASIDE *page_las; /* Lookaside information */ + +#ifdef HAVE_DIAGNOSTIC + /* Capture history of ref state changes. */ + struct __wt_ref_hist { + WT_SESSION_IMPL *session; + const char *name; + const char *file; + int line; + uint32_t state; + } hist[3]; + uint64_t histoff; +#define WT_REF_SET_STATE(ref, s) do { \ + (ref)->hist[(ref)->histoff].session = session; \ + (ref)->hist[(ref)->histoff].name = session->name; \ + (ref)->hist[(ref)->histoff].file = __FILE__; \ + (ref)->hist[(ref)->histoff].line = __LINE__; \ + (ref)->hist[(ref)->histoff].state = s; \ + (ref)->histoff = \ + ((ref)->histoff + 1) % WT_ELEMENTS((ref)->hist); \ + WT_PUBLISH((ref)->state, s); \ +} while (0) +#else +#define WT_REF_SET_STATE(ref, s) WT_PUBLISH((ref)->state, s) +#endif }; /* * WT_REF_SIZE is the expected structure size -- we verify the build to ensure * the compiler hasn't inserted padding which would break the world. */ #ifdef HAVE_DIAGNOSTIC -#define WT_REF_SIZE 56 + 3*32 + 8 +#define WT_REF_SIZE (56 + 3 * sizeof(WT_REF_HIST) + 8) #else #define WT_REF_SIZE 56 #endif diff --git a/src/third_party/wiredtiger/src/include/btree.h b/src/third_party/wiredtiger/src/include/btree.h index 593745cc315..a44c010e51d 100644 --- a/src/third_party/wiredtiger/src/include/btree.h +++ b/src/third_party/wiredtiger/src/include/btree.h @@ -181,12 +181,12 @@ struct __wt_btree { * operation that would conflict with a sync. */ #define WT_BTREE_SYNCING(btree) \ - (btree->syncing != WT_BTREE_SYNC_OFF) + ((btree)->syncing != WT_BTREE_SYNC_OFF) #define WT_SESSION_BTREE_SYNC(session) \ - (S2BT(session)->sync_session == session) + (S2BT(session)->sync_session == (session)) #define WT_SESSION_BTREE_SYNC_SAFE(session, btree) \ ((btree)->syncing != WT_BTREE_SYNC_RUNNING || \ - (btree)->sync_session == session) + (btree)->sync_session == (session)) uint64_t bytes_inmem; /* Cache bytes in memory. */ uint64_t bytes_dirty_intl; /* Bytes in dirty internal pages. */ diff --git a/src/third_party/wiredtiger/src/include/config.h b/src/third_party/wiredtiger/src/include/config.h index 8feefd4201d..a02735c7e0a 100644 --- a/src/third_party/wiredtiger/src/include/config.h +++ b/src/third_party/wiredtiger/src/include/config.h @@ -50,7 +50,7 @@ struct __wt_config_parser_impl { "", 0, 0, WT_CONFIG_ITEM_NUM \ } -#define WT_CONFIG_UNSET -1 +#define WT_CONFIG_UNSET (-1) /* * DO NOT EDIT: automatically built by dist/api_config.py. * configuration section: BEGIN diff --git a/src/third_party/wiredtiger/src/include/cursor.i b/src/third_party/wiredtiger/src/include/cursor.i index cb665e17f5b..daa633f86ba 100644 --- a/src/third_party/wiredtiger/src/include/cursor.i +++ b/src/third_party/wiredtiger/src/include/cursor.i @@ -417,8 +417,14 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd) * Unpack the cell and deal with overflow and prefix-compressed keys. * Inline building simple prefix-compressed keys from a previous key, * otherwise build from scratch. + * + * Clear the key cell structure. It shouldn't be necessary (as far as I + * can tell, and we don't do it in lots of other places), but disabling + * shared builds (--disable-shared) results in the compiler complaining + * about uninitialized field use. */ kpack = &_kpack; + memset(kpack, 0, sizeof(*kpack)); __wt_cell_unpack(cell, kpack); if (kpack->type == WT_CELL_KEY && cbt->rip_saved != NULL && cbt->rip_saved == rip - 1) { diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 9a614dc2c19..e3b3296f405 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -27,7 +27,7 @@ extern int __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block) W extern int __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *list, wt_off_t offset, uint32_t size, bool live, const char *func, int line) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_off_remove_overlap(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, wt_off_t off, wt_off_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_alloc(WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t *offp, wt_off_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_free(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/third_party/wiredtiger/src/include/misc.i b/src/third_party/wiredtiger/src/include/misc.i index 5c9f95bc08a..4a34b5211d8 100644 --- a/src/third_party/wiredtiger/src/include/misc.i +++ b/src/third_party/wiredtiger/src/include/misc.i @@ -193,7 +193,7 @@ __wt_snprintf_len_incr( * Return an error if the current transaction is in the prepare state. */ static inline int -__wt_txn_context_prepare_check( WT_SESSION_IMPL *session) +__wt_txn_context_prepare_check(WT_SESSION_IMPL *session) { #ifdef HAVE_TIMESTAMPS if (F_ISSET(&session->txn, WT_TXN_PREPARE)) diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h index f84ecfe64d4..10ca7330885 100644 --- a/src/third_party/wiredtiger/src/include/wt_internal.h +++ b/src/third_party/wiredtiger/src/include/wt_internal.h @@ -271,6 +271,8 @@ struct __wt_process; typedef struct __wt_process WT_PROCESS; struct __wt_ref; typedef struct __wt_ref WT_REF; +struct __wt_ref_hist; + typedef struct __wt_ref_hist WT_REF_HIST; struct __wt_row; typedef struct __wt_row WT_ROW; struct __wt_rwlock; |