summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/conn/conn_sweep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/conn/conn_sweep.c')
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_sweep.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c
index 4d2267d176b..52a4a5424b4 100644
--- a/src/third_party/wiredtiger/src/conn/conn_sweep.c
+++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c
@@ -259,7 +259,7 @@ __sweep_remove_handles(WT_SESSION_IMPL *session)
/*
* __sweep_server_run_chk --
- * Check to decide if the checkpoint server should continue running.
+ * Check to decide if the sweep server should continue running.
*/
static bool
__sweep_server_run_chk(WT_SESSION_IMPL *session)
@@ -277,21 +277,23 @@ __sweep_server(void *arg)
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_SESSION_IMPL *session;
- time_t now;
- uint64_t last_las_sweep_id, oldest_id;
+ time_t last, now;
+ uint64_t last_las_sweep_id, min_sleep, oldest_id;
u_int dead_handles;
session = arg;
conn = S2C(session);
last_las_sweep_id = WT_TXN_NONE;
+ min_sleep = WT_MIN(WT_LAS_SWEEP_SEC, conn->sweep_interval);
/*
* Sweep for dead and excess handles.
*/
+ __wt_seconds(session, &last);
for (;;) {
/* Wait until the next event. */
__wt_cond_wait(session, conn->sweep_cond,
- conn->sweep_interval * WT_MILLION, __sweep_server_run_chk);
+ min_sleep * WT_MILLION, __sweep_server_run_chk);
/* Check if we're quitting or being reconfigured. */
if (!__sweep_server_run_chk(session))
@@ -299,8 +301,6 @@ __sweep_server(void *arg)
__wt_seconds(session, &now);
- WT_STAT_CONN_INCR(session, dh_sweeps);
-
/*
* Sweep the lookaside table. If the lookaside table hasn't yet
* been written, there's no work to do.
@@ -312,7 +312,8 @@ __sweep_server(void *arg)
* bringing in and evicting pages from the lookaside table,
* which will stop the cache from moving into the stuck state.
*/
- if (__wt_las_nonempty(session) &&
+ if (now - last >= WT_LAS_SWEEP_SEC &&
+ __wt_las_nonempty(session) &&
!__wt_cache_stuck(session)) {
oldest_id = __wt_txn_oldest_id(session);
if (WT_TXNID_LT(last_las_sweep_id, oldest_id)) {
@@ -322,6 +323,14 @@ __sweep_server(void *arg)
}
/*
+ * See if it is time to sweep the data handles. Those are swept
+ * less frequently than the lookaside table by default and the
+ * frequency is controlled by a user setting.
+ */
+ if ((uint64_t)(now - last) < conn->sweep_interval)
+ continue;
+ WT_STAT_CONN_INCR(session, dh_sweeps);
+ /*
* Mark handles with a time of death, and report whether any
* handles are marked dead. If sweep_idle_time is 0, handles
* never become idle.