summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2022-12-21 08:56:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-21 10:13:24 +0000
commit19ece9bbfeab344c2d77a7282854496db4e5b7f3 (patch)
tree558368845553926b712f2960016c0762b6c219b2
parente8b18b3eb1606188833073ea47ff65a73222d6a4 (diff)
downloadmongo-19ece9bbfeab344c2d77a7282854496db4e5b7f3.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.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 64b07eab270..ec1a3f2daeb 100644
--- a/src/mongo/db/s/range_deletion_util.cpp
+++ b/src/mongo/db/s/range_deletion_util.cpp
@@ -134,12 +134,20 @@ StatusWith<int> deleteNextBatch(OperationContext* opCtx,
auto catalog = collection->getIndexCatalog();
const IndexDescriptor* idx = catalog->findShardKeyPrefixedIndex(opCtx, keyPattern, false);
if (!idx) {
- 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.toString(),
- "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