summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbcheck.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/commands/dbcheck.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/commands/dbcheck.cpp')
-rw-r--r--src/mongo/db/commands/dbcheck.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp
index ef4a566bc8f..5d4579691dd 100644
--- a/src/mongo/db/commands/dbcheck.cpp
+++ b/src/mongo/db/commands/dbcheck.cpp
@@ -53,6 +53,8 @@
#include "mongo/logv2/log.h"
MONGO_FAIL_POINT_DEFINE(sleepAfterExtraIndexKeysHashing);
+MONGO_FAIL_POINT_DEFINE(hangBeforeProcessingDbCheckRun);
+MONGO_FAIL_POINT_DEFINE(hangBeforeAddingDBCheckBatchToOplog);
namespace mongo {
@@ -288,6 +290,11 @@ protected:
DbCheckStartAndStopLogger startStop(opCtx);
+ if (MONGO_unlikely(hangBeforeProcessingDbCheckRun.shouldFail())) {
+ LOGV2(7949000, "Hanging dbcheck due to failpoint 'hangBeforeProcessingDbCheckRun'");
+ hangBeforeProcessingDbCheckRun.pauseWhileSet();
+ }
+
for (const auto& coll : *_run) {
try {
_doCollection(opCtx, coll);
@@ -440,11 +447,14 @@ private:
WriteConcernResult unused;
auto status = waitForWriteConcern(opCtx, stats.time, info.writeConcern, &unused);
if (!status.isOK()) {
- auto entry = dbCheckWarningHealthLogEntry(info.nss,
- "dbCheck failed waiting for writeConcern",
- OplogEntriesEnum::Batch,
- status);
+ // TODO SERVER-89817: Add context with batch ID and lastKey once those are
+ // backported.
+ auto entry = dbCheckErrorHealthLogEntry(info.nss,
+ "dbCheck failed waiting for writeConcern",
+ OplogEntriesEnum::Batch,
+ status);
HealthLogInterface::get(opCtx)->log(*entry);
+ return;
}
start = stats.lastKey;
@@ -575,6 +585,12 @@ private:
batch.setMaxKey(BSONKey(hasher->lastKey()));
batch.setReadTimestamp(readTimestamp);
+ if (MONGO_unlikely(hangBeforeAddingDBCheckBatchToOplog.shouldFail())) {
+ LOGV2(8589000,
+ "Hanging dbCheck due to failpoint 'hangBeforeAddingDBCheckBatchToOplog'");
+ hangBeforeAddingDBCheckBatchToOplog.pauseWhileSet();
+ }
+
// Send information on this batch over the oplog.
result.time = _logOp(opCtx, info.nss, collection->uuid(), batch.toBSON());
result.readTimestamp = readTimestamp;