diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-09-09 15:49:31 +1000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-09-09 15:58:39 +1000 |
commit | 29b5a329c5c72fe87d1627bd99e682d9d5e2e34c (patch) | |
tree | 1dc8949286121eb16b472d4f5e4ea391baebc5de /src/third_party/wiredtiger/src/lsm | |
parent | bda317e9c852b27f0fe7d148e5c08499d2f8ec49 (diff) | |
download | mongo-29b5a329c5c72fe87d1627bd99e682d9d5e2e34c.tar.gz |
Import wiredtiger: 569c70d13a7b3da0fe8eb1bac06a86865cb36a7c from branch mongodb-3.4
ref: 7d3c0f9f50..569c70d13a
for: 3.3.13
SERVER-25843 Coverity analysis defect 99856: Redundant test
SERVER-25845 Coverity analysis defect 99859: Explicit null dereferenced
SERVER-25846 Coverity analysis defect 99861: Dereference after null check
WT-2221 Document which statistics are available via a "fast" configuration vs. an "all" configuration
WT-2233 Investigate changing when the eviction server switches to aggressive mode.
WT-2323 Allocate a transaction id at the beginning of join cursor iteration
WT-2555 make format run on Windows
WT-2788 Java: freed memory overwrite during handle close can cause JNI crash
WT-2816 Improve WiredTiger eviction performance
WT-2824 wtperf displays connection and table create configurations twice
WT-2842 split wtperf's configuration into per-database and per-run parts
WT-2866 Eviction server algorithm tuning
WT-2867 Review and fix barrier usage in __lsm_tree_close
WT-2870 Rename wtperf checkpoint schema jobs
WT-2871 __wt_verbose has the wrong GCC format attributes
WT-2872 Recent stuck cache test/stress failures.
WT-2873 Refactor CRC32 code
WT-2875 Test test_wt2853_perf can run too long under valgrind
WT-2876 Extend wtperf to support a log like table
WT-2878 Verbose changes affected performance
WT-2881 Add -Wpedantic to clang compiler warning flags
WT-2882 Add CRC32 hardware scons detection, disable CRC hardware support on ARM for now
WT-2883 wiredtiger_open with verbose=handleops recursive loop
WT-2885 __wt_checkpoint_signal lint
WT-2886 Decide how in-memory configuration and eviction_dirty_target interact
WT-2888 Switch functions to return void where possible
WT-2892 hot backup can race with block truncate
WT-2896 Coverity #1362535: resource leak
WT-2897 Checkpoints can become corrupted on failure
WT-2901 Add option to disable checkpoint dirty stepdown phase
Diffstat (limited to 'src/third_party/wiredtiger/src/lsm')
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_cursor.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_manager.c | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_merge.c | 13 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_meta.c | 51 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_tree.c | 22 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_work_unit.c | 2 |
6 files changed, 44 insertions, 53 deletions
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c index 78d77884d40..bf591d8dbe6 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c @@ -1074,8 +1074,7 @@ __clsm_lookup(WT_CURSOR_LSM *clsm, WT_ITEM *value) bloom = NULL; if ((bloom = clsm->blooms[i]) != NULL) { if (!have_hash) { - WT_ERR(__wt_bloom_hash( - bloom, &cursor->key, &bhash)); + __wt_bloom_hash(bloom, &cursor->key, &bhash); have_hash = true; } diff --git a/src/third_party/wiredtiger/src/lsm/lsm_manager.c b/src/third_party/wiredtiger/src/lsm/lsm_manager.c index bafab9abaa3..a504acc361c 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_manager.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_manager.c @@ -491,9 +491,8 @@ err: WT_PANIC_MSG(session, ret, "LSM worker manager thread error"); * introduces an inefficiency if LSM trees are being opened and closed * regularly. */ -int -__wt_lsm_manager_clear_tree( - WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) +void +__wt_lsm_manager_clear_tree(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) { WT_LSM_MANAGER *manager; WT_LSM_WORK_UNIT *current, *next; @@ -541,7 +540,6 @@ __wt_lsm_manager_clear_tree( } __wt_spin_unlock(session, &manager->manager_lock); WT_STAT_FAST_CONN_INCRV(session, lsm_work_units_discarded, removed); - return (0); } /* diff --git a/src/third_party/wiredtiger/src/lsm/lsm_merge.c b/src/third_party/wiredtiger/src/lsm/lsm_merge.c index ccad6c90449..2276631af1e 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_merge.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_merge.c @@ -43,12 +43,11 @@ __wt_lsm_merge_update_tree(WT_SESSION_IMPL *session, * __lsm_merge_aggressive_clear -- * We found a merge to do - clear the aggressive timer. */ -static int +static void __lsm_merge_aggressive_clear(WT_LSM_TREE *lsm_tree) { F_CLR(lsm_tree, WT_LSM_TREE_AGGRESSIVE_TIMER); lsm_tree->merge_aggressiveness = 0; - return (0); } /* @@ -80,8 +79,10 @@ __lsm_merge_aggressive_update(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) * Only get aggressive if a reasonable number of flushes have been * completed since opening the tree. */ - if (lsm_tree->chunks_flushed <= lsm_tree->merge_min) - return (__lsm_merge_aggressive_clear(lsm_tree)); + if (lsm_tree->chunks_flushed <= lsm_tree->merge_min) { + __lsm_merge_aggressive_clear(lsm_tree); + return (0); + } /* * Start the timer if it isn't running. Use a flag to define whether @@ -329,7 +330,7 @@ retry_find: return (WT_NOTFOUND); } - WT_RET(__lsm_merge_aggressive_clear(lsm_tree)); + __lsm_merge_aggressive_clear(lsm_tree); *records = record_count; *start = start_chunk; *end = end_chunk; @@ -471,7 +472,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) dest->set_value(dest, &value); WT_ERR(dest->insert(dest)); if (create_bloom) - WT_ERR(__wt_bloom_insert(bloom, &key)); + __wt_bloom_insert(bloom, &key); } WT_ERR_NOTFOUND_OK(ret); diff --git a/src/third_party/wiredtiger/src/lsm/lsm_meta.c b/src/third_party/wiredtiger/src/lsm/lsm_meta.c index 7e100cb855c..ec52af96231 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_meta.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_meta.c @@ -28,15 +28,15 @@ __lsm_meta_read_v0( if (F_ISSET(S2C(session), WT_CONN_LSM_MERGE)) F_SET(lsm_tree, WT_LSM_TREE_MERGES); - WT_ERR(__wt_config_init(session, &cparser, lsmconf)); + __wt_config_init(session, &cparser, lsmconf); while ((ret = __wt_config_next(&cparser, &ck, &cv)) == 0) { if (WT_STRING_MATCH("key_format", ck.str, ck.len)) { __wt_free(session, lsm_tree->key_format); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->key_format)); } else if (WT_STRING_MATCH("value_format", ck.str, ck.len)) { __wt_free(session, lsm_tree->value_format); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->value_format)); } else if (WT_STRING_MATCH("collator", ck.str, ck.len)) { if (cv.len == 0 || @@ -46,25 +46,25 @@ __lsm_meta_read_v0( * Extract the application-supplied metadata (if any) * from the file configuration. */ - WT_ERR(__wt_config_getones( + WT_RET(__wt_config_getones( session, lsmconf, "file_config", &fileconf)); WT_CLEAR(metadata); - WT_ERR_NOTFOUND_OK(__wt_config_subgets( + WT_RET_NOTFOUND_OK(__wt_config_subgets( session, &fileconf, "app_metadata", &metadata)); - WT_ERR(__wt_collator_config(session, lsm_tree->name, + WT_RET(__wt_collator_config(session, lsm_tree->name, &cv, &metadata, &lsm_tree->collator, &lsm_tree->collator_owned)); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->collator_name)); } else if (WT_STRING_MATCH("bloom_config", ck.str, ck.len)) { __wt_free(session, lsm_tree->bloom_config); /* Don't include the brackets. */ - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str + 1, cv.len - 2, &lsm_tree->bloom_config)); } else if (WT_STRING_MATCH("file_config", ck.str, ck.len)) { __wt_free(session, lsm_tree->file_config); /* Don't include the brackets. */ - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str + 1, cv.len - 2, &lsm_tree->file_config)); } else if (WT_STRING_MATCH("auto_throttle", ck.str, ck.len)) { if (cv.val) @@ -92,25 +92,25 @@ __lsm_meta_read_v0( else if (WT_STRING_MATCH("last", ck.str, ck.len)) lsm_tree->last = (u_int)cv.val; else if (WT_STRING_MATCH("chunks", ck.str, ck.len)) { - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("id", lk.str, lk.len)) { - WT_ERR(__wt_realloc_def(session, + WT_RET(__wt_realloc_def(session, &lsm_tree->chunk_alloc, nchunks + 1, &lsm_tree->chunk)); - WT_ERR( + WT_RET( __wt_calloc_one(session, &chunk)); lsm_tree->chunk[nchunks++] = chunk; chunk->id = (uint32_t)lv.val; - WT_ERR(__wt_lsm_tree_chunk_name(session, + WT_RET(__wt_lsm_tree_chunk_name(session, lsm_tree, chunk->id, &chunk->uri)); F_SET(chunk, WT_LSM_CHUNK_ONDISK | WT_LSM_CHUNK_STABLE); } else if (WT_STRING_MATCH( "bloom", lk.str, lk.len)) { - WT_ERR(__wt_lsm_tree_bloom_name( + WT_RET(__wt_lsm_tree_bloom_name( session, lsm_tree, chunk->id, &chunk->bloom_uri)); F_SET(chunk, WT_LSM_CHUNK_BLOOM); @@ -129,28 +129,28 @@ __lsm_meta_read_v0( continue; } } - WT_ERR_NOTFOUND_OK(ret); + WT_RET_NOTFOUND_OK(ret); lsm_tree->nchunks = nchunks; } else if (WT_STRING_MATCH("old_chunks", ck.str, ck.len)) { - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("bloom", lk.str, lk.len)) { - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, lv.str, lv.len, &chunk->bloom_uri)); F_SET(chunk, WT_LSM_CHUNK_BLOOM); continue; } - WT_ERR(__wt_realloc_def(session, + WT_RET(__wt_realloc_def(session, &lsm_tree->old_alloc, nchunks + 1, &lsm_tree->old_chunks)); - WT_ERR(__wt_calloc_one(session, &chunk)); + WT_RET(__wt_calloc_one(session, &chunk)); lsm_tree->old_chunks[nchunks++] = chunk; - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, lk.str, lk.len, &chunk->uri)); F_SET(chunk, WT_LSM_CHUNK_ONDISK); } - WT_ERR_NOTFOUND_OK(ret); + WT_RET_NOTFOUND_OK(ret); lsm_tree->nold_chunks = nchunks; } /* @@ -158,8 +158,8 @@ __lsm_meta_read_v0( * created by a future release, with unknown options. */ } - WT_ERR_NOTFOUND_OK(ret); -err: return (ret); + WT_RET_NOTFOUND_OK(ret); + return (0); } /* @@ -264,7 +264,7 @@ __lsm_meta_read_v1( WT_ERR(__wt_config_getones(session, lsmconf, "last", &cv)); lsm_tree->last = (u_int)cv.val; WT_ERR(__wt_config_getones(session, lsmconf, "chunks", &cv)); - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("id", lk.str, lk.len)) { @@ -299,7 +299,7 @@ __lsm_meta_read_v1( lsm_tree->nchunks = nchunks; WT_ERR(__wt_config_getones(session, lsmconf, "old_chunks", &cv)); - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("bloom", lk.str, lk.len)) { @@ -404,6 +404,7 @@ __lsm_meta_upgrade_v1(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) err: __wt_scr_free(session, &buf); return (ret); } + /* * __wt_lsm_meta_read -- * Read the metadata for an LSM tree. diff --git a/src/third_party/wiredtiger/src/lsm/lsm_tree.c b/src/third_party/wiredtiger/src/lsm/lsm_tree.c index c84f5c519cf..db9fd581110 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_tree.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_tree.c @@ -85,10 +85,9 @@ __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) * __lsm_tree_close -- * Close an LSM tree structure. */ -static int +static void __lsm_tree_close(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) { - WT_DECL_RET; int i; /* @@ -97,7 +96,7 @@ __lsm_tree_close(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) * the tree queue state. */ lsm_tree->active = false; - WT_READ_BARRIER(); + WT_FULL_BARRIER(); /* * Wait for all LSM operations to drain. If WiredTiger is shutting @@ -120,17 +119,11 @@ __lsm_tree_close(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) * other schema level operations will return EBUSY, even though * we're dropping the schema lock here. */ - if (i % WT_THOUSAND == 0) { - WT_WITHOUT_LOCKS(session, ret = + if (i % WT_THOUSAND == 0) + WT_WITHOUT_LOCKS(session, __wt_lsm_manager_clear_tree(session, lsm_tree)); - WT_ERR(ret); - } __wt_yield(); } - return (0); - -err: lsm_tree->active = true; - return (ret); } /* @@ -154,7 +147,7 @@ __wt_lsm_tree_close_all(WT_SESSION_IMPL *session) * is unconditional. */ (void)__wt_atomic_add32(&lsm_tree->refcnt, 1); - WT_TRET(__lsm_tree_close(session, lsm_tree, true)); + __lsm_tree_close(session, lsm_tree, true); WT_TRET(__lsm_tree_discard(session, lsm_tree, true)); } @@ -390,9 +383,8 @@ __lsm_tree_find(WT_SESSION_IMPL *session, * spurious busy returns. */ (void)__wt_atomic_add32(&lsm_tree->refcnt, 1); - if (__lsm_tree_close( - session, lsm_tree, false) != 0 || - lsm_tree->refcnt != 1) { + __lsm_tree_close(session, lsm_tree, false); + if (lsm_tree->refcnt != 1) { __wt_lsm_tree_release( session, lsm_tree); return (EBUSY); 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 bfca09b3807..72bcf56b3c4 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c @@ -447,7 +447,7 @@ __lsm_bloom_create(WT_SESSION_IMPL *session, F_SET(session, WT_SESSION_NO_CACHE | WT_SESSION_NO_EVICTION); for (insert_count = 0; (ret = src->next(src)) == 0; insert_count++) { WT_ERR(src->get_key(src, &key)); - WT_ERR(__wt_bloom_insert(bloom, &key)); + __wt_bloom_insert(bloom, &key); } WT_ERR_NOTFOUND_OK(ret); WT_TRET(src->close(src)); |