summaryrefslogtreecommitdiff
path: root/src/mongo/db/ttl.cpp
diff options
context:
space:
mode:
authorSergi Mateo Bellido <sergi.mateo-bellido@mongodb.com>2022-02-11 08:09:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-11 08:36:13 +0000
commitbf11296b533b07bd4b87f64e7477cc147c7697ea (patch)
tree981432f87b9cd6d23abd6ab318f806a19b71489b /src/mongo/db/ttl.cpp
parent98171115a000d2a9174a9289f4db5713c1c6d162 (diff)
downloadmongo-bf11296b533b07bd4b87f64e7477cc147c7697ea.tar.gz
SERVER-63530 Lowering error level of TTL tasks that fail on SSV
Diffstat (limited to 'src/mongo/db/ttl.cpp')
-rw-r--r--src/mongo/db/ttl.cpp73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index a3dee4d8070..f3f945ae50c 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -218,45 +218,42 @@ private:
"TTLMonitor was interrupted, waiting before doing another pass",
"wait"_attr = Milliseconds(Seconds(ttlMonitorSleepSecs.load())));
return;
- } catch (const DBException& ex) {
- if (ex.isA<ErrorCategory::StaleShardVersionError>()) {
- // The TTL index tried to delete some information from a sharded collection
- // through a direct operation against the shard but the filtering metadata
- // was not available.
- //
- // The current TTL task cannot be completed. However, if the critical
- // section is not held the code below will fire an asynchronous refresh,
- // hoping that the next time this task is re-executed the filtering
- // information is already present.
- if (auto staleInfo = ex.extraInfo<StaleConfigInfo>();
- staleInfo && !staleInfo->getCriticalSectionSignal()) {
- auto executor = Grid::get(opCtx)->getExecutorPool()->getFixedExecutor();
- ExecutorFuture<void>(executor)
- .then(
- [serviceContext = opCtx->getServiceContext(), nss, staleInfo] {
- ThreadClient tc("TTLShardVersionRecovery", serviceContext);
- {
- stdx::lock_guard<Client> lk(*tc.get());
- tc->setSystemOperationKillableByStepdown(lk);
- }
-
- auto uniqueOpCtx = tc->makeOperationContext();
- auto opCtx = uniqueOpCtx.get();
-
- onShardVersionMismatchNoExcept(
- opCtx, *nss, staleInfo->getVersionWanted())
- .ignore();
- })
- .onError([](const Status& status) {
- LOGV2_WARNING(
- 5803600,
- "Error on deferred shardVersion recovery execution",
- "error"_attr = redact(status));
- })
- .getAsync([](auto) {});
- }
+ } catch (const ExceptionForCat<ErrorCategory::StaleShardVersionError>& ex) {
+ // The TTL index tried to delete some information from a sharded collection
+ // through a direct operation against the shard but the filtering metadata was
+ // not available.
+ //
+ // The current TTL task cannot be completed. However, if the critical section is
+ // not held the code below will fire an asynchronous refresh, hoping that the
+ // next time this task is re-executed the filtering information is already
+ // present.
+ if (auto staleInfo = ex.extraInfo<StaleConfigInfo>();
+ staleInfo && !staleInfo->getCriticalSectionSignal()) {
+ auto executor = Grid::get(opCtx)->getExecutorPool()->getFixedExecutor();
+ ExecutorFuture<void>(executor)
+ .then([serviceContext = opCtx->getServiceContext(), nss, staleInfo] {
+ ThreadClient tc("TTLShardVersionRecovery", serviceContext);
+ {
+ stdx::lock_guard<Client> lk(*tc.get());
+ tc->setSystemOperationKillableByStepdown(lk);
+ }
+
+ auto uniqueOpCtx = tc->makeOperationContext();
+ auto opCtx = uniqueOpCtx.get();
+
+ onShardVersionMismatchNoExcept(
+ opCtx, *nss, staleInfo->getVersionWanted())
+ .ignore();
+ })
+ .getAsync([](auto) {});
}
-
+ LOGV2_WARNING(6353000,
+ "Error running TTL job on collection: the shard should refresh "
+ "before being able to complete this task",
+ logAttrs(*nss),
+ "error"_attr = ex);
+ continue;
+ } catch (const DBException& ex) {
LOGV2_ERROR(5400703,
"Error running TTL job on collection",
logAttrs(*nss),