summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Ahmad <josef.ahmad@mongodb.com>2022-03-23 08:02:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-23 08:56:52 +0000
commitc799851554dc01493d35b43701416e9c78b3665c (patch)
tree236f4eeae9914ac31f40ebe94ae32288a310a3d4
parentecff61d82253c9103e94ef50327d5c6cf8d64c1c (diff)
downloadmongo-c799851554dc01493d35b43701416e9c78b3665c.tar.gz
SERVER-64737 dbcheck.js should tolerate non-deterministic batch boundaries
-rw-r--r--jstests/replsets/dbcheck.js13
-rw-r--r--src/mongo/db/commands/dbcheck.cpp4
2 files changed, 10 insertions, 7 deletions
diff --git a/jstests/replsets/dbcheck.js b/jstests/replsets/dbcheck.js
index 92d14f9e675..e6ddd119632 100644
--- a/jstests/replsets/dbcheck.js
+++ b/jstests/replsets/dbcheck.js
@@ -306,13 +306,16 @@ function testDbCheckParameters() {
assert(keyBoundsResult.hasNext(), "dbCheck put no batches in health log");
- let bounds = keyBoundsResult.next();
+ const bounds = keyBoundsResult.next();
+ const counts = healthLogCounts(healthlog);
assert.eq(bounds.minKey, start, "dbCheck minKey field incorrect");
- assert.eq(bounds.maxKey, end, "dbCheck maxKey field incorrect");
- let counts = healthLogCounts(healthlog);
- assert.eq(counts.totalDocs, end - start);
- assert.eq(counts.totalBytes, (end - start) * docSize);
+ // dbCheck evaluates some exit conditions like maxCount and maxBytes at batch boundary.
+ // The batch boundary isn't generally deterministic (e.g. can be time-dependent per
+ // maxBatchTimeMillis) hence the greater-than-or-equal comparisons.
+ assert.gte(bounds.maxKey, end, "dbCheck maxKey field incorrect");
+ assert.gte(counts.totalDocs, end - start);
+ assert.gte(counts.totalBytes, (end - start) * docSize);
});
}
diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp
index 291b79740ac..c26b09d8831 100644
--- a/src/mongo/db/commands/dbcheck.cpp
+++ b/src/mongo/db/commands/dbcheck.cpp
@@ -659,8 +659,8 @@ public:
"Invoke with { dbCheck: <collection name/uuid>,\n"
" minKey: <first key, exclusive>,\n"
" maxKey: <last key, inclusive>,\n"
- " maxCount: <max number of docs>,\n"
- " maxSize: <max size of docs>,\n"
+ " maxCount: <try to keep a batch within maxCount number of docs>,\n"
+ " maxSize: <try to keep a batch withing maxSize of docs (bytes)>,\n"
" maxCountPerSecond: <max rate in docs/sec>\n"
" maxDocsPerBatch: <max number of docs/batch>\n"
" maxBytesPerBatch: <try to keep a batch within max bytes/batch>\n"