diff options
author | Yu Jin Kang Park <yujin.kang@mongodb.com> | 2023-05-17 12:31:11 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 13:43:06 +0000 |
commit | a4cffa9d6a2c902101f19b3b54af2714b0f4af4a (patch) | |
tree | 4651f38a404eb0c68065ecb206cde66516436186 | |
parent | d2f241ddb0494d079b8b2b282de4333b666da805 (diff) | |
download | mongo-a4cffa9d6a2c902101f19b3b54af2714b0f4af4a.tar.gz |
SERVER-77214 Add buildUUID, db, and collectionUUID to index build data corruption log message
-rw-r--r-- | jstests/noPassthrough/index_build_out_of_order_scan.js | 22 | ||||
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 7 |
2 files changed, 27 insertions, 2 deletions
diff --git a/jstests/noPassthrough/index_build_out_of_order_scan.js b/jstests/noPassthrough/index_build_out_of_order_scan.js index f6491f9c70e..ebc2d1dbf00 100644 --- a/jstests/noPassthrough/index_build_out_of_order_scan.js +++ b/jstests/noPassthrough/index_build_out_of_order_scan.js @@ -31,6 +31,11 @@ const hangAfterInitializingIndexBuild = const createIdx = IndexBuildTest.startIndexBuild( primary, primaryColl.getFullName(), {a: 1}, null, [ErrorCodes.DataCorruptionDetected]); +const buildUUID = + IndexBuildTest + .assertIndexesSoon(primaryColl, 2, ['_id_'], ['a_1'], {includeBuildUUIDs: true})['a_1'] + .buildUUID; + hangAfterInitializingIndexBuild.wait(); const WTRecordStoreUassertOutOfOrder = configureFailPoint(primary, "WTRecordStoreUassertOutOfOrder"); @@ -39,8 +44,23 @@ const hangBeforeAbort = hangAfterInitializingIndexBuild.off(); hangBeforeAbort.wait(); + +// Get collection UUID. +const collInfos = primaryDB.getCollectionInfos({name: primaryColl.getName()}); +assert.eq(collInfos.length, 1, collInfos); +const collUUID = collInfos[0].info.uuid; + // Index build: data corruption detected. -checkLog.containsJson(primary, 7333600); +checkLog.containsJson(primary, 7333600, { + buildUUID: function(uuid) { + return uuid && uuid["uuid"]["$uuid"] === extractUUIDFromObject(buildUUID); + }, + db: primaryDB.getName(), + collectionUUID: function(uuid) { + jsTestLog(collUUID); + return uuid && uuid["uuid"]["$uuid"] === extractUUIDFromObject(collUUID); + } +}); assert.eq(1, primaryDB.serverStatus().indexBuilds.failedDueToDataCorruption); // Disable out-of-order failpoint so clean-up can succeed. diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 38b1da5703f..4961d533f68 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -2632,7 +2632,12 @@ void IndexBuildsCoordinator::_cleanUpAfterFailure(OperationContext* opCtx, if (status.code() == ErrorCodes::DataCorruptionDetected) { indexBuildsSSS.failedDueToDataCorruption.addAndFetch(1); - LOGV2(7333600, "Index build: data corruption detected", "status"_attr = status); + LOGV2(7333600, + "Index build: data corruption detected", + "buildUUID"_attr = replState->buildUUID, + logAttrs(replState->dbName), + "collectionUUID"_attr = replState->collectionUUID, + "error"_attr = status); } if (IndexBuildProtocol::kSinglePhase == replState->protocol) { |