diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-07-20 12:20:46 +1000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-07-20 12:24:11 +1000 |
commit | 5a2533ebc3606973fbe237228b9bacdcb21a532b (patch) | |
tree | 66805f578f761446f1cdd6637dcfaa90c60e1388 /src/third_party/wiredtiger/src/lsm/lsm_tree.c | |
parent | 634435949c4b855b9cc5bfbf5cf481d8158fd996 (diff) | |
download | mongo-5a2533ebc3606973fbe237228b9bacdcb21a532b.tar.gz |
Import wiredtiger: 6173a98979715ed727c432c1a31da64ea8a37048 from branch mongodb-3.6
ref: ff10db8811..6173a98979
for: 3.5.11
WT-3039 Enhance logging so new log files no longer need to wait for the previous log file to be synced
WT-3138 Enhance eviction statistics
WT-3140 Enhance json mode statistics to better support per-dhandle statistics
WT-3310 Add support to WT_SESSION::alter to change table log setting
WT-3329 With a uniform workload and a number of small collections, eviction does a poor job of selecting candidates for eviction.
WT-3381 Improve concurrency in the transaction subsystem
WT-3394 Build WiredTiger with gcc7
WT-3396 test/csuite/wt3363_checkpoint_op_races, test_utility cleanups
WT-3397 Coverity lint
WT-3398 in-memory configurations don't support schema_worker operations
WT-3401 Lint and minor cleanup
WT-3402 Move cached overflow records to the update list.
WT-3403 Automated tests timeout running csuite
WT-3409 WiredTiger generations can silently self-deadlock.
WT-3413 Add more aggressive compile warning flags to Jenkins Windows job
WT-3415 setting timestamp in txn_state requires the global write lock
WT-3421 Compilation error unreachable code in test/csuite/wt3363_checkpoint_op_races
WT-3424 additional gcc 7.1 compile warnings.
WT-3425 workgen: add ability to reopen cursors
WT-3426 Add new wtperf configuration to automated performance testing
WT-3438 Don't tune eviction thread count when the count is fixed
Also explicitly disable v2 log records via a configuration setting in MongoDB -
this will later be plumbed into the feature compatability version mechanism.
Diffstat (limited to 'src/third_party/wiredtiger/src/lsm/lsm_tree.c')
-rw-r--r-- | src/third_party/wiredtiger/src/lsm/lsm_tree.c | 123 |
1 files changed, 57 insertions, 66 deletions
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_tree.c b/src/third_party/wiredtiger/src/lsm/lsm_tree.c index ebdd1e492cc..18e1f6d3115 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_tree.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_tree.c @@ -15,6 +15,42 @@ static int __lsm_tree_open( static int __lsm_tree_set_name(WT_SESSION_IMPL *, WT_LSM_TREE *, const char *); /* + * __lsm_tree_discard_state -- + * Free the metadata configuration state related LSM tree pointers. + */ +static void +__lsm_tree_discard_state(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) +{ + WT_LSM_CHUNK *chunk; + u_int i; + + __wt_free(session, lsm_tree->config); + __wt_free(session, lsm_tree->key_format); + __wt_free(session, lsm_tree->value_format); + __wt_free(session, lsm_tree->collator_name); + __wt_free(session, lsm_tree->bloom_config); + __wt_free(session, lsm_tree->file_config); + + for (i = 0; i < lsm_tree->nchunks; i++) { + if ((chunk = lsm_tree->chunk[i]) == NULL) + continue; + + __wt_free(session, chunk->bloom_uri); + __wt_free(session, chunk->uri); + __wt_free(session, chunk); + } + + for (i = 0; i < lsm_tree->nold_chunks; i++) { + chunk = lsm_tree->old_chunks[i]; + WT_ASSERT(session, chunk != NULL); + + __wt_free(session, chunk->bloom_uri); + __wt_free(session, chunk->uri); + __wt_free(session, chunk); + } +} + +/* * __lsm_tree_discard -- * Free an LSM tree structure. */ @@ -22,8 +58,6 @@ static int __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) { WT_DECL_RET; - WT_LSM_CHUNK *chunk; - u_int i; WT_UNUSED(final); /* Only used in diagnostic builds */ @@ -48,34 +82,12 @@ __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) lsm_tree->collator, &session->iface)); __wt_free(session, lsm_tree->name); - __wt_free(session, lsm_tree->config); - __wt_free(session, lsm_tree->key_format); - __wt_free(session, lsm_tree->value_format); - __wt_free(session, lsm_tree->collator_name); - __wt_free(session, lsm_tree->bloom_config); - __wt_free(session, lsm_tree->file_config); - - __wt_rwlock_destroy(session, &lsm_tree->rwlock); - - for (i = 0; i < lsm_tree->nchunks; i++) { - if ((chunk = lsm_tree->chunk[i]) == NULL) - continue; - - __wt_free(session, chunk->bloom_uri); - __wt_free(session, chunk->uri); - __wt_free(session, chunk); - } + __lsm_tree_discard_state(session, lsm_tree); __wt_free(session, lsm_tree->chunk); + __wt_free(session, lsm_tree->old_chunks); - for (i = 0; i < lsm_tree->nold_chunks; i++) { - chunk = lsm_tree->old_chunks[i]; - WT_ASSERT(session, chunk != NULL); + __wt_rwlock_destroy(session, &lsm_tree->rwlock); - __wt_free(session, chunk->bloom_uri); - __wt_free(session, chunk->uri); - __wt_free(session, chunk); - } - __wt_free(session, lsm_tree->old_chunks); __wt_free(session, lsm_tree); return (ret); @@ -851,45 +863,6 @@ __wt_lsm_tree_retire_chunks(WT_SESSION_IMPL *session, } /* - * __wt_lsm_tree_alter -- - * Alter an LSM tree. - */ -int -__wt_lsm_tree_alter( - WT_SESSION_IMPL *session, const char *uri, const char *cfg[]) -{ - WT_DECL_RET; - WT_LSM_CHUNK *chunk; - WT_LSM_TREE *lsm_tree; - u_int i; - bool locked; - - locked = false; - - /* Get the LSM tree. */ - WT_RET(__wt_lsm_tree_get(session, uri, false, &lsm_tree)); - - /* Prevent any new opens. */ - __wt_lsm_tree_writelock(session, lsm_tree); - locked = true; - - /* Alter the chunks. */ - for (i = 0; i < lsm_tree->nchunks; i++) { - chunk = lsm_tree->chunk[i]; - WT_ERR(__wt_schema_alter(session, chunk->uri, cfg)); - if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM)) - WT_ERR( - __wt_schema_alter(session, chunk->bloom_uri, cfg)); - } - WT_ERR(__wt_lsm_meta_write(session, lsm_tree, cfg[0])); - -err: if (locked) - __wt_lsm_tree_writeunlock(session, lsm_tree); - __wt_lsm_tree_release(session, lsm_tree); - return (ret); -} - -/* * __wt_lsm_tree_drop -- * Drop an LSM tree. */ @@ -1385,6 +1358,24 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session, WT_ERR(__wt_schema_worker(session, chunk->bloom_uri, file_func, name_func, cfg, open_flags)); } + /* + * If this was an alter operation, we need to alter the configuration + * for the overall tree and then reread it so it isn't out of date. + * Reread it here so that we update the configuration of the + * current tree's structure to any new, altered values. + */ + if (FLD_ISSET(open_flags, WT_BTREE_ALTER)) { + WT_ERR(__wt_lsm_meta_write(session, lsm_tree, cfg[0])); + /* + * We're about to read in the new configuration that + * we just wrote. Free the old ones. + */ + __lsm_tree_discard_state(session, lsm_tree); + if ((ret = __wt_lsm_meta_read(session, lsm_tree)) != 0) + WT_PANIC_ERR(session, ret, + "Failed to read updated LSM configuration"); + } + err: if (locked) { if (exclusive) __wt_lsm_tree_writeunlock(session, lsm_tree); |