diff options
author | Louis Williams <louis.williams@mongodb.com> | 2021-03-29 11:40:34 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-31 21:44:49 +0000 |
commit | bed9b4820e4421d63ff5457cd854671cf51bf4f6 (patch) | |
tree | d2599cab58b0c24e53cbcfd26246ef7c9c5e360a /src/mongo/db/ttl.cpp | |
parent | 7cfcec38fd4f6549a12907f8c32f86a85e773ff5 (diff) | |
download | mongo-bed9b4820e4421d63ff5457cd854671cf51bf4f6.tar.gz |
SERVER-55591 Store time-series metadata in the durable catalog entry for buckets collections
Diffstat (limited to 'src/mongo/db/ttl.cpp')
-rw-r--r-- | src/mongo/db/ttl.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index 52ab8485f1d..437a15265c9 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -298,17 +298,8 @@ private: Date_t safeExpirationDate(OperationContext* opCtx, const CollectionPtr& coll, std::int64_t expireAfterSeconds) const { - if (coll->ns().isTimeseriesBucketsCollection()) { - auto timeseriesNs = coll->ns().bucketsNamespaceToTimeseries(); - auto viewCatalog = DatabaseHolder::get(opCtx)->getViewCatalog(opCtx, timeseriesNs.db()); - invariant(viewCatalog); - auto viewDef = viewCatalog->lookup(opCtx, timeseriesNs.ns()); - uassert(ErrorCodes::NamespaceNotFound, - fmt::format("Could not find view definition for namespace: {}", - timeseriesNs.toString()), - viewDef); - - const auto bucketMaxSpan = Seconds(viewDef->timeseries()->getBucketMaxSpanSeconds()); + if (auto timeseries = coll->getTimeseriesOptions()) { + const auto bucketMaxSpan = Seconds(timeseries->getBucketMaxSpanSeconds()); // Don't delete data unless it is safely out of range of the bucket maximum time // range. On time-series collections, the _id (and thus RecordId) is the minimum |