diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2017-04-07 16:55:32 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-04-07 16:55:32 -0400 |
commit | ab281e0a4f312f99494cdb381264196278c18a2f (patch) | |
tree | 080909f5d00561bfe78e78dc0c96cd2d1aa2e1d1 | |
parent | 84e6ac0e67019bba22af87b99b40bb0bc0e21157 (diff) | |
download | mongo-ab281e0a4f312f99494cdb381264196278c18a2f.tar.gz |
WT-3269 Miscellaneous cleanup (#3377)
I missed two copyright notices when updating from 2016 to 2017.
* Cleanup, one of the temporary copyright files wasn't being removed on exit.
* Don't use S2C/S2BT if there's already a local conn/btree variable.
* Fix some indentation, minor whitespace.
* clang warning: Value stored to 'pgs_evicted_cur' is never read
* __wt_thread_group_start_one and __wt_thread_group_stop_one no longer
return errors, clean up error handling and comments in
__evict_tune_workers, and __evict_tune_workers itself no longer returns
an error.
* Give test/syscall/wt2336_base/base.run a standard copyright notice,
so dist/s_copyright doesn't have to treat it as a special case.
-rwxr-xr-x | dist/s_c_test_create | 2 | ||||
-rwxr-xr-x | dist/s_copyright | 7 | ||||
-rw-r--r-- | ext/compressors/lz4/lz4_compress.c | 4 | ||||
-rw-r--r-- | src/btree/bt_split.c | 2 | ||||
-rw-r--r-- | src/cache/cache_las.c | 4 | ||||
-rw-r--r-- | src/cursor/cur_stat.c | 2 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 42 | ||||
-rw-r--r-- | src/include/btree.i | 2 | ||||
-rw-r--r-- | src/lsm/lsm_manager.c | 2 | ||||
-rw-r--r-- | src/lsm/lsm_tree.c | 2 | ||||
-rw-r--r-- | src/reconcile/rec_write.c | 3 | ||||
-rw-r--r-- | src/txn/txn_ckpt.c | 2 | ||||
-rw-r--r-- | src/txn/txn_recover.c | 2 | ||||
-rw-r--r-- | test/checkpoint/workers.c | 2 | ||||
-rw-r--r-- | test/format/wts.c | 4 | ||||
-rw-r--r-- | test/salvage/salvage.c | 2 | ||||
-rw-r--r-- | test/syscall/wt2336_base/base.run | 61 |
17 files changed, 67 insertions, 78 deletions
diff --git a/dist/s_c_test_create b/dist/s_c_test_create index f4f9eb3ac1f..1d379664e75 100755 --- a/dist/s_c_test_create +++ b/dist/s_c_test_create @@ -35,7 +35,7 @@ mkdir $CSUITE_DIRECTORY/$TEST_NAME (cat <<EOF /*- - * Public Domain 2014-2016 MongoDB, Inc. + * Public Domain 2014-2017 MongoDB, Inc. * Public Domain 2008-2014 WiredTiger, Inc. * * This is free and unencumbered software released into the public domain. diff --git a/dist/s_copyright b/dist/s_copyright index 490f7eb6427..4a93be73fb6 100755 --- a/dist/s_copyright +++ b/dist/s_copyright @@ -53,7 +53,7 @@ if [ $# -ne 0 ]; then exit 0 fi -trap 'rm -f $c1 $c2 $c3 $c4' 0 1 2 3 13 15 +trap 'rm -f $c1 $c2 $c3 $c4 $c5' 0 1 2 3 13 15 year=`date +%Y` @@ -125,12 +125,16 @@ fi -e 's/^\.\///' | xargs $xp -n 1 -I{} sh dist/s_copyright {}) +# One-offs. +(cd .. && sh dist/s_copyright test/syscall/wt2336_base/base.run) + # A few special cases: LICENSE, documentation, wt utility, some of which have # more than one copyright notice in the file. For files that have only a single # copyright notice, we give it to MongoDB, from 2008 to now. string1="Copyright \(c\) 2014-$year MongoDB, Inc." string2="Copyright \(c\) 2008-$year MongoDB, Inc." string3="printf.*Copyright \(c\) 2008-$year MongoDB, Inc." +string4="Public Domain 2014-$year MongoDB, Inc." special_copyright() { cnt=`egrep "$3" ../$1 | wc -l` @@ -140,6 +144,7 @@ special_copyright() } special_copyright LICENSE 1 "$string1" +special_copyright dist/s_c_test_create 1 "$string4" special_copyright src/docs/build-javadoc.sh 1 "$string2" special_copyright src/docs/style/footer.html 2 "$string2" special_copyright src/utilities/util_cpyright.c 1 "$string3" diff --git a/ext/compressors/lz4/lz4_compress.c b/ext/compressors/lz4/lz4_compress.c index 7fe72942f1e..e99d125b69f 100644 --- a/ext/compressors/lz4/lz4_compress.c +++ b/ext/compressors/lz4/lz4_compress.c @@ -141,7 +141,7 @@ lz4_compress(WT_COMPRESSOR *compressor, WT_SESSION *session, /* Compress, starting after the prefix bytes. */ lz4_len = LZ4_compress( - (const char *)src, (char *)dst + sizeof(LZ4_PREFIX), (int)src_len); + (const char *)src, (char *)dst + sizeof(LZ4_PREFIX), (int)src_len); /* * If compression succeeded and the compressed length is smaller than @@ -214,7 +214,7 @@ lz4_decompress(WT_COMPRESSOR *compressor, WT_SESSION *session, */ if (dst_len < prefix.uncompressed_len) { if ((dst_tmp = wt_api->scr_alloc( - wt_api, session, (size_t)prefix.uncompressed_len)) == NULL) + wt_api, session, (size_t)prefix.uncompressed_len)) == NULL) return (ENOMEM); decoded = LZ4_decompress_safe( diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index db3e3f33abf..a5dd5ae9d0c 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -41,7 +41,7 @@ __split_safe_free(WT_SESSION_IMPL *session, { /* We should only call safe free if we aren't pinning the memory. */ WT_ASSERT(session, - __wt_session_gen(session, WT_GEN_SPLIT) != split_gen); + __wt_session_gen(session, WT_GEN_SPLIT) != split_gen); /* * We have swapped something in a page: if we don't have exclusive diff --git a/src/cache/cache_las.c b/src/cache/cache_las.c index 68d7227a762..9e8545453d3 100644 --- a/src/cache/cache_las.c +++ b/src/cache/cache_las.c @@ -393,8 +393,8 @@ err: __wt_buf_free(session, key); * arithmetic is signed, so underflow isn't fatal, but check anyway so * we don't skew low over time. */ - if (remove_cnt > S2C(session)->las_record_cnt) - S2C(session)->las_record_cnt = 0; + if (remove_cnt > conn->las_record_cnt) + conn->las_record_cnt = 0; else if (remove_cnt > 0) (void)__wt_atomic_subi64(&conn->las_record_cnt, remove_cnt); diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index 1c543023779..0f5b40bee40 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -478,7 +478,7 @@ __curstat_join_desc(WT_CURSOR_STAT *cst, int slot, const char **resultp) strlen(static_desc) + 1; WT_RET(__wt_realloc(session, NULL, len, &cst->desc_buf)); WT_RET(__wt_snprintf( - cst->desc_buf, len, "join: %s%s", sgrp->desc_prefix, static_desc)); + cst->desc_buf, len, "join: %s%s", sgrp->desc_prefix, static_desc)); *resultp = cst->desc_buf; return (0); } diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 8b003cd099e..1e67c7f22b4 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -15,7 +15,7 @@ static int __evict_lru_walk(WT_SESSION_IMPL *); static int __evict_page(WT_SESSION_IMPL *, bool); static int __evict_pass(WT_SESSION_IMPL *); static int __evict_server(WT_SESSION_IMPL *, bool *); -static int __evict_tune_workers(WT_SESSION_IMPL *session); +static void __evict_tune_workers(WT_SESSION_IMPL *session); static int __evict_walk(WT_SESSION_IMPL *, WT_EVICT_QUEUE *); static int __evict_walk_file( WT_SESSION_IMPL *, WT_EVICT_QUEUE *, u_int, u_int *); @@ -657,7 +657,7 @@ __evict_pass(WT_SESSION_IMPL *session) prev = now; if (conn->evict_threads.threads[0]->session == session) - WT_RET(__evict_tune_workers(session)); + __evict_tune_workers(session); /* * Increment the shared read generation. Do this occasionally * even if eviction is not currently required, so that pages @@ -956,13 +956,12 @@ __wt_evict_file_exclusive_off(WT_SESSION_IMPL *session) * curve. In that case, we will set the number of workers to the best observed * so far and settle into a stable state. */ -static int +static void __evict_tune_workers(WT_SESSION_IMPL *session) { struct timespec current_time; WT_CACHE *cache; WT_CONNECTION_IMPL *conn; - WT_DECL_RET; uint64_t cur_threads, delta_msec, delta_pages, i, target_threads; uint64_t pgs_evicted_cur, pgs_evicted_persec_cur, time_diff; uint32_t thread_surplus; @@ -971,7 +970,7 @@ __evict_tune_workers(WT_SESSION_IMPL *session) cache = conn->cache; WT_ASSERT(session, conn->evict_threads.threads[0]->session == session); - pgs_evicted_cur = pgs_evicted_persec_cur = 0; + pgs_evicted_cur = 0; __wt_epoch(session, ¤t_time); time_diff = WT_TIMEDIFF_SEC(current_time, conn->evict_tune_last_time); @@ -982,7 +981,7 @@ __evict_tune_workers(WT_SESSION_IMPL *session) */ if (conn->evict_tune_stable) { if (time_diff < EVICT_FORCE_RETUNE) - return (0); + return; /* * Stable state was reached a long time ago. Let's re-tune. @@ -1012,7 +1011,7 @@ __evict_tune_workers(WT_SESSION_IMPL *session) * anything unless enough time has passed since the last * time we have taken any action in this function. */ - return (0); + return; /* * Measure the number of evicted pages so far. Eviction rate correlates @@ -1028,7 +1027,7 @@ __evict_tune_workers(WT_SESSION_IMPL *session) * Otherwise, we just record the number of evicted pages and return. */ if (conn->evict_tune_pgs_last == 0) - goto err; + goto done; delta_msec = WT_TIMEDIFF_MS(current_time, conn->evict_tune_last_time); delta_pages = pgs_evicted_cur - conn->evict_tune_pgs_last; @@ -1079,11 +1078,6 @@ __evict_tune_workers(WT_SESSION_IMPL *session) conn->evict_tune_workers_best; for (i = 0; i < thread_surplus; i++) { - /* - * If we get an error, it should be because we - * were unable to acquire the thread group lock. - * Break out of trying. - */ __wt_thread_group_stop_one( session, &conn->evict_threads); WT_STAT_CONN_INCR(session, @@ -1095,7 +1089,7 @@ __evict_tune_workers(WT_SESSION_IMPL *session) conn->evict_tune_stable = true; WT_STAT_CONN_SET(session, cache_eviction_active_workers, conn->evict_threads.current_threads); - goto err; + goto done; } } @@ -1118,11 +1112,6 @@ __evict_tune_workers(WT_SESSION_IMPL *session) * Start the new threads. */ for (i = 0; i < (target_threads - cur_threads); ++i) { - /* - * If we get an error, it should be because we were - * unable to acquire the thread group lock. Break out - * of trying. - */ __wt_thread_group_start_one(session, &conn->evict_threads, false); WT_STAT_CONN_INCR(session, @@ -1136,15 +1125,8 @@ __evict_tune_workers(WT_SESSION_IMPL *session) WT_STAT_CONN_SET(session, cache_eviction_active_workers, conn->evict_threads.current_threads); -err: conn->evict_tune_last_time = current_time; +done: conn->evict_tune_last_time = current_time; conn->evict_tune_pgs_last = pgs_evicted_cur; - /* - * If we got an EBUSY trying to acquire the lock just return. - * We can try to tune the workers next time. - */ - if (ret == EBUSY) - ret = 0; - return (ret); } /* @@ -1163,13 +1145,13 @@ __evict_lru_pages(WT_SESSION_IMPL *session, bool is_server) * Reconcile and discard some pages: EBUSY is returned if a page fails * eviction because it's unavailable, continue in that case. */ - while (F_ISSET(S2C(session), WT_CONN_EVICTION_RUN) && ret == 0) + while (F_ISSET(conn, WT_CONN_EVICTION_RUN) && ret == 0) if ((ret = __evict_page(session, is_server)) == EBUSY) ret = 0; /* If a worker thread found the queue empty, pause. */ if (ret == WT_NOTFOUND && !is_server && - F_ISSET(S2C(session), WT_CONN_EVICTION_RUN)) + F_ISSET(conn, WT_CONN_EVICTION_RUN)) __wt_cond_wait( session, conn->evict_threads.wait_cond, 10000, NULL); @@ -1354,7 +1336,7 @@ __evict_walk(WT_SESSION_IMPL *session, WT_EVICT_QUEUE *queue) bool dhandle_locked, incr; conn = S2C(session); - cache = S2C(session)->cache; + cache = conn->cache; btree = NULL; dhandle = NULL; dhandle_locked = incr = false; diff --git a/src/include/btree.i b/src/include/btree.i index c169ddd1a9a..e89c7809a79 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -424,7 +424,7 @@ __wt_cache_page_evict(WT_SESSION_IMPL *session, WT_PAGE *page, bool rewrite) modify = page->modify; /* Update the bytes in-memory to reflect the eviction. */ - __wt_cache_decr_check_uint64(session, &S2BT(session)->bytes_inmem, + __wt_cache_decr_check_uint64(session, &btree->bytes_inmem, page->memory_footprint, "WT_BTREE.bytes_inmem"); __wt_cache_decr_check_uint64(session, &cache->bytes_inmem, page->memory_footprint, "WT_CACHE.bytes_inmem"); diff --git a/src/lsm/lsm_manager.c b/src/lsm/lsm_manager.c index d9726ac419b..82a6fc8f86c 100644 --- a/src/lsm/lsm_manager.c +++ b/src/lsm/lsm_manager.c @@ -388,7 +388,7 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session) __wt_readlock(session, &conn->dhandle_lock); F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST_READ); dhandle_locked = true; - TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q) { + TAILQ_FOREACH(lsm_tree, &conn->lsmqh, q) { if (!lsm_tree->active) continue; __wt_epoch(session, &now); diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c index 115ec2acc8a..d9c7a7d7284 100644 --- a/src/lsm/lsm_tree.c +++ b/src/lsm/lsm_tree.c @@ -499,7 +499,7 @@ __lsm_tree_open(WT_SESSION_IMPL *session, __wt_epoch(session, &lsm_tree->last_flush_ts); /* Now the tree is setup, make it visible to others. */ - TAILQ_INSERT_HEAD(&S2C(session)->lsmqh, lsm_tree, q); + TAILQ_INSERT_HEAD(&conn->lsmqh, lsm_tree, q); if (!exclusive) lsm_tree->active = true; F_SET(lsm_tree, WT_LSM_TREE_OPEN); diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 47194478887..0740239758c 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -4386,8 +4386,7 @@ __rec_col_var_helper(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_RET(__rec_split_raw(session, r, val->len)); } else if (WT_CHECK_CROSSING_BND(r, val->len)) - WT_RET(__rec_split_crossing_bnd( - session, r, val->len)); + WT_RET(__rec_split_crossing_bnd(session, r, val->len)); /* Copy the value onto the page. */ if (!deleted && !overflow_type && btree->dictionary) diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index 50684f1a75a..92dfd9e3887 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -1525,7 +1525,7 @@ err: /* */ if (ret != 0) { btree->modified = true; - S2C(session)->modified = true; + conn->modified = true; } __wt_meta_ckptlist_free(session, &btree->ckpt); diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c index e5d1aed7083..93f5fa5d15e 100644 --- a/src/txn/txn_recover.c +++ b/src/txn/txn_recover.c @@ -441,7 +441,7 @@ __wt_txn_recover(WT_SESSION_IMPL *session) * last checkpoint was done with logging disabled, recovery should not * run. Scan the metadata to figure out the largest file ID. */ - if (!FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_EXISTED) || + if (!FLD_ISSET(conn->log_flags, WT_CONN_LOG_EXISTED) || WT_IS_MAX_LSN(&metafile->ckpt_lsn)) { WT_ERR(__recovery_file_scan(&r)); conn->next_file_id = r.max_fileid; diff --git a/test/checkpoint/workers.c b/test/checkpoint/workers.c index a055654df71..520266adf55 100644 --- a/test/checkpoint/workers.c +++ b/test/checkpoint/workers.c @@ -215,7 +215,7 @@ real_worker(void) } } else if (ret == WT_ROLLBACK) { if ((ret = session->rollback_transaction( - session, NULL)) != 0) { + session, NULL)) != 0) { (void)log_print_err( "real_worker:rollback_transaction", ret, 1); goto err; diff --git a/test/format/wts.c b/test/format/wts.c index c5346bd399e..2a8c6f54b06 100644 --- a/test/format/wts.c +++ b/test/format/wts.c @@ -276,8 +276,8 @@ wts_open(const char *home, bool set_api, WT_CONNECTION **connp) if ((ret = conn->load_extension( conn, HELIUM_PATH, helium_config)) != 0) testutil_die(ret, - "WT_CONNECTION.load_extension: %s:%s", - HELIUM_PATH, helium_config); + "WT_CONNECTION.load_extension: %s:%s", + HELIUM_PATH, helium_config); } *connp = conn; } diff --git a/test/salvage/salvage.c b/test/salvage/salvage.c index 2a99d8c4851..c19a529bcb8 100644 --- a/test/salvage/salvage.c +++ b/test/salvage/salvage.c @@ -522,7 +522,7 @@ build(int ikey, int ivalue, int cnt) break; case WT_PAGE_ROW_LEAF: testutil_check(__wt_snprintf( - kbuf, sizeof(kbuf), "%010d KEY------", ikey)); + kbuf, sizeof(kbuf), "%010d KEY------", ikey)); key.data = kbuf; key.size = 20; cursor->set_key(cursor, &key); diff --git a/test/syscall/wt2336_base/base.run b/test/syscall/wt2336_base/base.run index 7d2c42ce64e..db455c97474 100644 --- a/test/syscall/wt2336_base/base.run +++ b/test/syscall/wt2336_base/base.run @@ -1,32 +1,35 @@ -// Public Domain 2014-2016 MongoDB, Inc. -// Public Domain 2008-2014 WiredTiger, Inc. -// -// This is free and unencumbered software released into the public domain. -// -// Anyone is free to copy, modify, publish, use, compile, sell, or -// distribute this software, either in source code form or as a compiled -// binary, for any purpose, commercial or non-commercial, and by any -// means. -// -// In jurisdictions that recognize copyright laws, the author or authors -// of this software dedicate any and all copyright interest in the -// software to the public domain. We make this dedication for the benefit -// of the public at large and to the detriment of our heirs and -// successors. We intend this dedication to be an overt act of -// relinquishment in perpetuity of all present and future rights to this -// software under copyright law. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// base.run -// Command line syscall test runner -// +/*- + * Public Domain 2014-2017 MongoDB, Inc. + * Public Domain 2008-2014 WiredTiger, Inc. + * + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * base.run + * Command line syscall test runner + */ #ifdef __linux__ SYSTEM("Linux"); #define OPEN_EXISTING(name, flags) open(name, flags) |