summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/session/session_compact.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/session/session_compact.c')
-rw-r--r--src/third_party/wiredtiger/src/session/session_compact.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/src/session/session_compact.c b/src/third_party/wiredtiger/src/session/session_compact.c
index 9e0ac6ce549..b57a734b29b 100644
--- a/src/third_party/wiredtiger/src/session/session_compact.c
+++ b/src/third_party/wiredtiger/src/session/session_compact.c
@@ -183,13 +183,17 @@ int
__wt_session_compact_check_timeout(WT_SESSION_IMPL *session)
{
struct timespec end;
+ WT_DECL_RET;
if (session->compact->max_time == 0)
return (0);
__wt_epoch(session, &end);
- return (
- session->compact->max_time > WT_TIMEDIFF_SEC(end, session->compact->begin) ? 0 : ETIMEDOUT);
+ ret =
+ session->compact->max_time > WT_TIMEDIFF_SEC(end, session->compact->begin) ? 0 : ETIMEDOUT;
+ if (ret != 0)
+ WT_STAT_CONN_INCR(session, session_table_compact_timeout);
+ return (ret);
}
/*
@@ -208,7 +212,6 @@ __compact_checkpoint(WT_SESSION_IMPL *session)
/* Checkpoints take a lot of time, check if we've run out. */
WT_RET(__wt_session_compact_check_timeout(session));
-
return (__wt_txn_checkpoint(session, checkpoint_cfg, true));
}
@@ -271,6 +274,7 @@ __compact_worker(WT_SESSION_IMPL *session)
*/
if (ret == EBUSY) {
if (__wt_cache_stuck(session)) {
+ WT_STAT_CONN_INCR(session, session_table_compact_fail_cache_pressure);
WT_ERR_MSG(session, EBUSY, "compaction halted by eviction pressure");
}
ret = 0;
@@ -313,6 +317,8 @@ __wt_session_compact(WT_SESSION *wt_session, const char *uri, const char *config
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, compact, config, cfg);
+ WT_STAT_CONN_SET(session, session_table_compact_running, 1);
+
/*
* The compaction thread should not block when the cache is full: it is holding locks blocking
* checkpoints and once the cache is full, it can spend a long time doing eviction.
@@ -397,6 +403,7 @@ err:
WT_STAT_CONN_INCR(session, session_table_compact_fail);
else
WT_STAT_CONN_INCR(session, session_table_compact_success);
+ WT_STAT_CONN_SET(session, session_table_compact_running, 0);
API_END_RET_NOTFOUND_MAP(session, ret);
}