diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-12-20 22:06:15 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-21 00:05:29 +0000 |
commit | 21b2615135067cdb67409f9cae670b315425b0df (patch) | |
tree | e0cde48dee3ccec39315c840e162c02a25705f05 | |
parent | 7fb90620aa832db2c1835d800333959077e431df (diff) | |
download | mongo-21b2615135067cdb67409f9cae670b315425b0df.tar.gz |
SERVER-71436 Range deleter must not aggressively spam the log when shard key index not found
-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 00435d0dba7..1cf11141504 100644 --- a/src/mongo/db/s/range_deletion_util.cpp +++ b/src/mongo/db/s/range_deletion_util.cpp @@ -130,12 +130,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 |