diff options
author | Yuhong Zhang <yuhong.zhang@mongodb.com> | 2022-08-24 14:17:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-24 14:51:49 +0000 |
commit | 65bef341dc5b3ea7dab8cbf4ff17b5d2e4d81ca1 (patch) | |
tree | 05a1806a65486e8b16c1be850cf76d167469ab55 /src/mongo | |
parent | 97989ceff09af0a2ed6a8c38fad42337d10fe1ec (diff) | |
download | mongo-65bef341dc5b3ea7dab8cbf4ff17b5d2e4d81ca1.tar.gz |
SERVER-57786 Include `_id` along with the recordId for multikey errors in validation report
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/catalog/validate_adaptor.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/catalog/validate_adaptor.cpp b/src/mongo/db/catalog/validate_adaptor.cpp index 0a493ab97a3..ded7cf98819 100644 --- a/src/mongo/db/catalog/validate_adaptor.cpp +++ b/src/mongo/db/catalog/validate_adaptor.cpp @@ -505,9 +505,12 @@ Status ValidateAdaptor::validateRecord(OperationContext* opCtx, results->repaired = true; } else { auto& curRecordResults = (results->indexResultsMap)[descriptor->indexName()]; - std::string msg = str::stream() << "Index " << descriptor->indexName() - << " is not multikey but has more than one" - << " key in document " << recordId; + std::string msg = fmt::format( + "Index {} is not multikey but has more than one key in document with " + "RecordId({}) and {}", + descriptor->indexName(), + recordId.toString(), + recordBson.getField("_id").toString()); curRecordResults.errors.push_back(msg); curRecordResults.valid = false; if (crashOnMultikeyValidateFailure.shouldFail()) { @@ -535,9 +538,11 @@ Status ValidateAdaptor::validateRecord(OperationContext* opCtx, << " multikey paths updated."); results->repaired = true; } else { - std::string msg = str::stream() - << "Index " << descriptor->indexName() - << " multikey paths do not cover a document. RecordId: " << recordId; + std::string msg = fmt::format( + "Index {} multikey paths do not cover a document with RecordId({}) and {}", + descriptor->indexName(), + recordId.toString(), + recordBson.getField("_id").toString()); auto& curRecordResults = (results->indexResultsMap)[descriptor->indexName()]; curRecordResults.errors.push_back(msg); curRecordResults.valid = false; |