__compact_file has a loop that can perform hundreds of checkpoints during a single compact command:
/* * We compact 10% of the file on each pass (but the overall size of the * file is decreasing each time, so we're not compacting 10% of the * original file each time). Try 100 times (which is clearly more than * we need); quit if we make no progress and check for a timeout each * time through the loop. */ for (i = 0; i < 100; ++i) { WT_ERR(wt_session->checkpoint(wt_session, t->data)); session->compaction = 0; WT_WITH_SCHEMA_LOCK(session, ret = __wt_schema_worker( session, uri, __wt_compact, NULL, cfg, 0)); WT_ERR(ret); if (!session->compaction) break; WT_ERR(wt_session->checkpoint(wt_session, t->data)); WT_ERR(wt_session->checkpoint(wt_session, t->data)); WT_ERR(__session_compact_check_timeout(session, start_time)); }
This worst case scenario is hit 100 times in the JS test below:
'use strict'; var t = db.compact; t.drop(); t.insert({}); for (var i = 0; i < 100; i++) { var res = db.runCommand({compact: t.getName()}); assert.commandWorked(res); }
Version info:
db version v3.1.4-pre-
git version: 845a2dcc23a597520065d1258089cc87dabf6cb8
- is depended on by
-
SERVER-18647 WiredTiger changes for MongoDB 3.0.4
- Closed
- links to