summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/conn
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-09 15:49:31 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-09 15:58:39 +1000
commit29b5a329c5c72fe87d1627bd99e682d9d5e2e34c (patch)
tree1dc8949286121eb16b472d4f5e4ea391baebc5de /src/third_party/wiredtiger/src/conn
parentbda317e9c852b27f0fe7d148e5c08499d2f8ec49 (diff)
downloadmongo-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/conn')
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c8
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache.c30
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache_pool.c35
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_ckpt.c8
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_dhandle.c6
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_log.c20
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_stat.c4
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_sweep.c10
8 files changed, 75 insertions, 46 deletions
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index ab7657c3a89..61683f3394e 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/src/conn/conn_api.c
@@ -919,7 +919,7 @@ __conn_load_extensions(
WT_CONFIG_BASE(session, WT_CONNECTION_load_extension), NULL, NULL };
WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval));
- WT_ERR(__wt_config_subinit(session, &subconfig, &cval));
+ __wt_config_subinit(session, &subconfig, &cval);
while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) {
if (expath == NULL)
WT_ERR(__wt_scr_alloc(session, 0, &expath));
@@ -1020,7 +1020,7 @@ err: /*
}
/* Release all named snapshots. */
- WT_TRET(__wt_txn_named_snapshot_destroy(session));
+ __wt_txn_named_snapshot_destroy(session);
/* Close open, external sessions. */
for (s = conn->sessions, i = 0; i < conn->session_cnt; ++s, ++i)
@@ -1854,7 +1854,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[])
"readonly=,"
"use_environment_priv=,"
"verbose=,", &base_config));
- WT_ERR(__wt_config_init(session, &parser, base_config));
+ __wt_config_init(session, &parser, base_config);
while ((ret = __wt_config_next(&parser, &k, &v)) == 0) {
/* Fix quoting for non-trivial settings. */
if (v.type == WT_CONFIG_ITEM_STRING) {
@@ -2009,7 +2009,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
session->name = "wiredtiger_open";
/* Do standard I/O and error handling first. */
- WT_ERR(__wt_os_stdio(session));
+ __wt_os_stdio(session);
__wt_event_handler_set(session, event_handler);
/*
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c
index ba1e0210334..7e94e9e87dc 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache.c
+++ b/src/third_party/wiredtiger/src/conn/conn_cache.c
@@ -42,11 +42,33 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[])
WT_RET(__wt_config_gets(session, cfg, "eviction_trigger", &cval));
cache->eviction_trigger = (u_int)cval.val;
- WT_RET(__wt_config_gets(session, cfg, "eviction_dirty_target", &cval));
- cache->eviction_dirty_target = (u_int)cval.val;
+ if (F_ISSET(conn, WT_CONN_IN_MEMORY))
+ cache->eviction_checkpoint_target =
+ cache->eviction_dirty_target =
+ cache->eviction_dirty_trigger = 100U;
+ else {
+ WT_RET(__wt_config_gets(
+ session, cfg, "eviction_checkpoint_target", &cval));
+ cache->eviction_checkpoint_target = (u_int)cval.val;
+
+ WT_RET(__wt_config_gets(
+ session, cfg, "eviction_dirty_target", &cval));
+ cache->eviction_dirty_target = (u_int)cval.val;
- WT_RET(__wt_config_gets(session, cfg, "eviction_dirty_trigger", &cval));
- cache->eviction_dirty_trigger = (u_int)cval.val;
+ /*
+ * Sanity check the checkpoint target: don't allow a value
+ * lower than the dirty target.
+ */
+ if (cache->eviction_checkpoint_target > 0 &&
+ cache->eviction_checkpoint_target <
+ cache->eviction_dirty_target)
+ cache->eviction_checkpoint_target =
+ cache->eviction_dirty_target;
+
+ WT_RET(__wt_config_gets(
+ session, cfg, "eviction_dirty_trigger", &cval));
+ cache->eviction_dirty_trigger = (u_int)cval.val;
+ }
WT_RET(__wt_config_gets(session, cfg, "eviction.threads_max", &cval));
WT_ASSERT(session, cval.val > 0);
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c b/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
index 15517f37b6a..79c2fc23da5 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
+++ b/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
@@ -34,10 +34,10 @@
#define WT_CACHE_POOL_APP_WAIT_MULTIPLIER 6
#define WT_CACHE_POOL_READ_MULTIPLIER 1
-static int __cache_pool_adjust(
+static void __cache_pool_adjust(
WT_SESSION_IMPL *, uint64_t, uint64_t, bool, bool *);
-static int __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *);
-static int __cache_pool_balance(WT_SESSION_IMPL *, bool);
+static void __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *);
+static void __cache_pool_balance(WT_SESSION_IMPL *, bool);
/*
* __wt_cache_pool_config --
@@ -414,11 +414,10 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
* Do a pass over the cache pool members and ensure the pool is being
* effectively used.
*/
-static int
+static void
__cache_pool_balance(WT_SESSION_IMPL *session, bool forward)
{
WT_CACHE_POOL *cp;
- WT_DECL_RET;
bool adjusted;
uint64_t bump_threshold, highest;
@@ -429,10 +428,12 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward)
__wt_spin_lock(NULL, &cp->cache_pool_lock);
/* If the queue is empty there is nothing to do. */
- if (TAILQ_FIRST(&cp->cache_pool_qh) == NULL)
- goto err;
+ if (TAILQ_FIRST(&cp->cache_pool_qh) == NULL) {
+ __wt_spin_unlock(NULL, &cp->cache_pool_lock);
+ return;
+ }
- WT_ERR(__cache_pool_assess(session, &highest));
+ __cache_pool_assess(session, &highest);
bump_threshold = WT_CACHE_POOL_BUMP_THRESHOLD;
/*
@@ -442,8 +443,8 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward)
*/
while (F_ISSET(cp, WT_CACHE_POOL_ACTIVE) &&
F_ISSET(S2C(session)->cache, WT_CACHE_POOL_RUN)) {
- WT_ERR(__cache_pool_adjust(
- session, highest, bump_threshold, forward, &adjusted));
+ __cache_pool_adjust(
+ session, highest, bump_threshold, forward, &adjusted);
/*
* Stop if the amount of cache being used is stable, and we
* aren't over capacity.
@@ -454,15 +455,14 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward)
--bump_threshold;
}
-err: __wt_spin_unlock(NULL, &cp->cache_pool_lock);
- return (ret);
+ __wt_spin_unlock(NULL, &cp->cache_pool_lock);
}
/*
* __cache_pool_assess --
* Assess the usage of the cache pool.
*/
-static int
+static void
__cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest)
{
WT_CACHE_POOL *cp;
@@ -548,7 +548,6 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest)
highest, entries);
*phighest = highest;
- return (0);
}
/*
@@ -557,7 +556,7 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest)
* ignore cache load information, and reduce the allocation for every
* connection allocated more than their reserved size.
*/
-static int
+static void
__cache_pool_adjust(WT_SESSION_IMPL *session,
uint64_t highest, uint64_t bump_threshold, bool forward, bool *adjustedp)
{
@@ -600,7 +599,8 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
* assigned.
*/
pressure = cache->cp_pass_pressure / highest_percentile;
- busy = __wt_eviction_needed(entry->default_session, &pct_full);
+ busy = __wt_eviction_needed(
+ entry->default_session, false, &pct_full);
__wt_verbose(session, WT_VERB_SHARED_CACHE,
"\t%5" PRIu64 ", %3" PRIu64 ", %2" PRIu32 ", %d, %2u",
@@ -709,7 +709,6 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
*/
}
}
- return (0);
}
/*
@@ -756,7 +755,7 @@ __wt_cache_pool_server(void *arg)
* reported in the balance function.
*/
if (F_ISSET(cache, WT_CACHE_POOL_MANAGER)) {
- (void)__cache_pool_balance(session, forward);
+ __cache_pool_balance(session, forward);
forward = !forward;
}
}
diff --git a/src/third_party/wiredtiger/src/conn/conn_ckpt.c b/src/third_party/wiredtiger/src/conn/conn_ckpt.c
index 5e9d8f70193..b4913043d63 100644
--- a/src/third_party/wiredtiger/src/conn/conn_ckpt.c
+++ b/src/third_party/wiredtiger/src/conn/conn_ckpt.c
@@ -93,7 +93,7 @@ __ckpt_server(void *arg)
/* Reset. */
if (conn->ckpt_logsize) {
__wt_log_written_reset(session);
- conn->ckpt_signalled = 0;
+ conn->ckpt_signalled = false;
/*
* In case we crossed the log limit during the
@@ -226,9 +226,8 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session)
/*
* __wt_checkpoint_signal --
* Signal the checkpoint thread if sufficient log has been written.
- * Return 1 if this signals the checkpoint thread, 0 otherwise.
*/
-int
+void
__wt_checkpoint_signal(WT_SESSION_IMPL *session, wt_off_t logsize)
{
WT_CONNECTION_IMPL *conn;
@@ -237,7 +236,6 @@ __wt_checkpoint_signal(WT_SESSION_IMPL *session, wt_off_t logsize)
WT_ASSERT(session, WT_CKPT_LOGSIZE(conn));
if (logsize >= conn->ckpt_logsize && !conn->ckpt_signalled) {
__wt_cond_signal(session, conn->ckpt_cond);
- conn->ckpt_signalled = 1;
+ conn->ckpt_signalled = true;
}
- return (0);
}
diff --git a/src/third_party/wiredtiger/src/conn/conn_dhandle.c b/src/third_party/wiredtiger/src/conn/conn_dhandle.c
index 9eb4d4a7746..ec850c793cc 100644
--- a/src/third_party/wiredtiger/src/conn/conn_dhandle.c
+++ b/src/third_party/wiredtiger/src/conn/conn_dhandle.c
@@ -488,9 +488,9 @@ __wt_conn_dhandle_close_all(
* open at this point. Close the handle, if necessary.
*/
if (F_ISSET(dhandle, WT_DHANDLE_OPEN)) {
- if ((ret = __wt_meta_track_sub_on(session)) == 0)
- ret = __wt_conn_btree_sync_and_close(
- session, false, force);
+ __wt_meta_track_sub_on(session);
+ ret = __wt_conn_btree_sync_and_close(
+ session, false, force);
/*
* If the close succeeded, drop any locks it acquired.
diff --git a/src/third_party/wiredtiger/src/conn/conn_log.c b/src/third_party/wiredtiger/src/conn/conn_log.c
index 6c05376f9ce..a8f0fe4810b 100644
--- a/src/third_party/wiredtiger/src/conn/conn_log.c
+++ b/src/third_party/wiredtiger/src/conn/conn_log.c
@@ -421,15 +421,27 @@ __log_file_server(void *arg)
* later syncs.
*/
WT_ERR(__wt_fsync(session, close_fh, true));
+
/*
* We want to have the file size reflect actual
* data with minimal pre-allocated zeroed space.
- * The underlying file system may not support
- * truncate, which is OK, it's just more work
+ * We can't truncate the file during hot backup,
+ * or the underlying file system may not support
+ * truncate: both are OK, it's just more work
* during cursor traversal.
*/
- WT_ERR_ERROR_OK(__wt_ftruncate(session,
- close_fh, close_end_lsn.l.offset), ENOTSUP);
+ if (!conn->hot_backup) {
+ __wt_readlock(
+ session, conn->hot_backup_lock);
+ if (!conn->hot_backup)
+ WT_ERR_ERROR_OK(
+ __wt_ftruncate(session,
+ close_fh,
+ close_end_lsn.l.offset),
+ ENOTSUP);
+ __wt_readunlock(
+ session, conn->hot_backup_lock);
+ }
WT_SET_LSN(&close_end_lsn,
close_end_lsn.l.file + 1, 0);
__wt_spin_lock(session, &log->log_sync_lock);
diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c
index 0894d1c6058..530bbfcd2db 100644
--- a/src/third_party/wiredtiger/src/conn/conn_stat.c
+++ b/src/third_party/wiredtiger/src/conn/conn_stat.c
@@ -155,13 +155,13 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp)
WT_ERR(__wt_filename(session, tmp->data, &conn->stat_path));
WT_ERR(__wt_config_gets(session, cfg, "statistics_log.sources", &cval));
- WT_ERR(__wt_config_subinit(session, &objectconf, &cval));
+ __wt_config_subinit(session, &objectconf, &cval);
for (cnt = 0; (ret = __wt_config_next(&objectconf, &k, &v)) == 0; ++cnt)
;
WT_ERR_NOTFOUND_OK(ret);
if (cnt != 0) {
WT_ERR(__wt_calloc_def(session, cnt + 1, &sources));
- WT_ERR(__wt_config_subinit(session, &objectconf, &cval));
+ __wt_config_subinit(session, &objectconf, &cval);
for (cnt = 0;
(ret = __wt_config_next(&objectconf, &k, &v)) == 0; ++cnt) {
/*
diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c
index dda296f50f3..25057d73564 100644
--- a/src/third_party/wiredtiger/src/conn/conn_sweep.c
+++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c
@@ -17,7 +17,7 @@
* Mark idle handles with a time of death, and note if we see dead
* handles.
*/
-static int
+static void
__sweep_mark(WT_SESSION_IMPL *session, time_t now)
{
WT_CONNECTION_IMPL *conn;
@@ -50,8 +50,6 @@ __sweep_mark(WT_SESSION_IMPL *session, time_t now)
dhandle->timeofdeath = now;
WT_STAT_FAST_CONN_INCR(session, dh_sweep_tod);
}
-
- return (0);
}
/*
@@ -286,10 +284,10 @@ __sweep_server(void *arg)
* If we try to sweep when the cache is full or we aren't
* making progress in eviction, sweeping can wind up constantly
* bringing in and evicting pages from the lookaside table,
- * which will stop the WT_CACHE_STUCK flag from being set.
+ * which will stop the cache from moving into the stuck state.
*/
if (__wt_las_is_written(session) &&
- !F_ISSET(conn->cache, WT_CACHE_STUCK)) {
+ !__wt_cache_stuck(session)) {
oldest_id = __wt_txn_oldest_id(session);
if (WT_TXNID_LT(last_las_sweep_id, oldest_id)) {
WT_ERR(__wt_las_sweep(session));
@@ -303,7 +301,7 @@ __sweep_server(void *arg)
* never become idle.
*/
if (conn->sweep_idle_time != 0)
- WT_ERR(__sweep_mark(session, now));
+ __sweep_mark(session, now);
/*
* Close handles if we have reached the configured limit.