diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-12-05 19:32:58 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-05 20:38:19 +0000 |
commit | bf34a18cb9d476d9d1766695b15885a3fd6885af (patch) | |
tree | ec745e2ee21c4e2a2ec911cb5c9bc92d17f8c1f3 /src/mongo | |
parent | d3af256f1a2a07aefdeb18a9af12c08763bd8b21 (diff) | |
download | mongo-bf34a18cb9d476d9d1766695b15885a3fd6885af.tar.gz |
SERVER-71436 Range deleter must not aggressively spam the log when shard key index not found
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/s/range_deletion_util.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mongo/db/s/range_deletion_util.cpp b/src/mongo/db/s/range_deletion_util.cpp index 707516db64f..edf663fc4ba 100644 --- a/src/mongo/db/s/range_deletion_util.cpp +++ b/src/mongo/db/s/range_deletion_util.cpp @@ -96,12 +96,20 @@ StatusWith<int> deleteNextBatch(OperationContext* opCtx, auto shardKeyIdx = findShardKeyPrefixedIndex( opCtx, collection, collection->getIndexCatalog(), keyPattern, /*requireSingleKey=*/false); if (!shardKeyIdx) { - LOGV2_ERROR_OPTIONS(23765, - {logv2::UserAssertAfterLog(ErrorCodes::InternalError)}, - "Unable to find shard key index for {keyPattern} in {namespace}", - "Unable to find shard key index", - "keyPattern"_attr = keyPattern, - "namespace"_attr = nss.ns()); + LOGV2_ERROR(23765, + "Unable to find shard key index", + "keyPattern"_attr = keyPattern, + "namespace"_attr = nss.ns()); + + // When a shard key index is not found, the range deleter gets stuck and indefinitely logs + // an error message. This sleep is aimed at avoiding logging too aggressively in order to + // prevent log files to increase too much in size. + opCtx->sleepFor(Seconds(5)); + + uasserted(ErrorCodes::IndexNotFound, + str::stream() << "Unable to find shard key index" + << " for " << nss.ns() << " and key pattern `" + << keyPattern.toString() << "'"); } // Extend bounds to match the index we found |