summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/range_deletion_util.cpp20
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