summaryrefslogtreecommitdiff
path: root/src/conn
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-09-05 21:59:46 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-06 11:59:46 +1000
commit3aab0803b5401c8aed08813cb58d3a6f341fbb00 (patch)
tree76f8d9e9c655b5d66517bf0d08c775edf237e293 /src/conn
parent375066e5cf6c16cb338452fa3a7dd032cd5aad8d (diff)
downloadmongo-3aab0803b5401c8aed08813cb58d3a6f341fbb00.tar.gz
WT-2888 Switch functions to return void where possible (#3019)
Some functions return an error code even though they don't need to. That adds complexity to our code. Switch to returning a void.
Diffstat (limited to 'src/conn')
-rw-r--r--src/conn/conn_api.c8
-rw-r--r--src/conn/conn_cache_pool.c32
-rw-r--r--src/conn/conn_dhandle.c6
-rw-r--r--src/conn/conn_stat.c4
-rw-r--r--src/conn/conn_sweep.c6
5 files changed, 26 insertions, 30 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index ab7657c3a89..61683f3394e 100644
--- a/src/conn/conn_api.c
+++ b/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/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c
index 15517f37b6a..ba6097fd2c1 100644
--- a/src/conn/conn_cache_pool.c
+++ b/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)
{
@@ -709,7 +708,6 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
*/
}
}
- return (0);
}
/*
@@ -756,7 +754,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/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 9eb4d4a7746..ec850c793cc 100644
--- a/src/conn/conn_dhandle.c
+++ b/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/conn/conn_stat.c b/src/conn/conn_stat.c
index 0894d1c6058..530bbfcd2db 100644
--- a/src/conn/conn_stat.c
+++ b/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/conn/conn_sweep.c b/src/conn/conn_sweep.c
index dda296f50f3..240c5726fb0 100644
--- a/src/conn/conn_sweep.c
+++ b/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);
}
/*
@@ -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.