summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/bt_compact.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2019-03-05 13:25:53 +1100
committerLuke Chen <luke.chen@mongodb.com>2019-03-05 13:27:30 +1100
commit70f793946b5e3872d07f73908b2d45a31cce051d (patch)
tree70cd44000deed16e6c4a9179f326dba1c08953be /src/third_party/wiredtiger/src/btree/bt_compact.c
parent6f3c3df4fc0abda76fd97e970ced4a01f0c48007 (diff)
downloadmongo-70f793946b5e3872d07f73908b2d45a31cce051d.tar.gz
Import wiredtiger: afdead1093b5c5b41dd54ddddf6f42d92bef1666 from branch mongodb-4.2
ref: 37e1570f82..afdead1093 for: 4.1.9 WT-4413 Add optional compact progress messages WT-4465 Add documentation for a dhandle's lifecycle WT-4514 Implement assert=durable_timestamp WT-4517 Change WT data format to avoid writing stable timestamps WT-4537 Fix WiredTiger cursor prev/next traversal failure on prepare retry WT-4554 Enhance WT salvage to handle the case of corrupted WiredTiger.turtle WT-4556 workgen: add synchronization points during run time WT-4558 WiredTiger connection statistics cursor incorrectly provides doubled-up values WT-4568 Operation tracking visualization incorrectly displays call stacks WT-4573 Reducing calls to __wt_epoch from session reset WT-4587 Parallelize the script that parses operation tracking files WT-4595 Coverity "null pointer dereference" complaints WT-4596 Simplify wt utility's session/connection handling WT-4599 Show latency threshold violations in operation visualizations WT-4605 workgen: read_write_storms.py needs a public domain notice WT-4606 workgen: remove lsm from the default table type in wtperf emulation WT-4613 Skip the wt4333_handle_locks test on OS X WT-4615 Sync backup file before returning backup cursor WT-4617 Cursor next/prev returns PREPARE_CONFLICT only once
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_compact.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_compact.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_compact.c b/src/third_party/wiredtiger/src/btree/bt_compact.c
index 37ee36634ff..e358e993ec4 100644
--- a/src/third_party/wiredtiger/src/btree/bt_compact.c
+++ b/src/third_party/wiredtiger/src/btree/bt_compact.c
@@ -104,6 +104,39 @@ __compact_rewrite_lock(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
}
/*
+ * __compact_progress --
+ * Output a compact progress message.
+ */
+static void
+__compact_progress(WT_SESSION_IMPL *session)
+{
+ struct timespec cur_time;
+ WT_BM *bm;
+ uint64_t time_diff;
+
+ if (!WT_VERBOSE_ISSET(session, WT_VERB_COMPACT_PROGRESS))
+ return;
+
+ bm = S2BT(session)->bm;
+ __wt_epoch(session, &cur_time);
+
+ /* Log one progress message every twenty seconds. */
+ time_diff = WT_TIMEDIFF_SEC(cur_time, session->compact->begin);
+ if (time_diff / WT_PROGRESS_MSG_PERIOD >
+ session->compact->prog_msg_count) {
+ __wt_verbose(session,
+ WT_VERB_COMPACT_PROGRESS, "Compact running"
+ " for %" PRIu64 " seconds; reviewed %"
+ PRIu64 " pages, skipped %" PRIu64 " pages,"
+ " wrote %" PRIu64 " pages", time_diff,
+ bm->block->compact_pages_reviewed,
+ bm->block->compact_pages_skipped,
+ bm->block->compact_pages_written);
+ session->compact->prog_msg_count++;
+ }
+}
+
+/*
* __wt_compact --
* Compact a file.
*/
@@ -137,6 +170,7 @@ __wt_compact(WT_SESSION_IMPL *session)
* Quit if eviction is stuck, we're making the problem worse.
*/
if (++i > 100) {
+ __compact_progress(session);
WT_ERR(__wt_session_compact_check_timeout(session));
if (__wt_cache_stuck(session))