summaryrefslogtreecommitdiff
path: root/src/mongo/db/timeseries/bucket_catalog
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2023-02-03 02:58:04 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-03 14:17:36 +0000
commit5a03cdc2d8c60a17aac020db65dcec6f3aa8c789 (patch)
tree44b12a4dbe7d07ef04cbe019739d40cedde6cb00 /src/mongo/db/timeseries/bucket_catalog
parenta073b665cb0299080469bce2dd4f2ffdaa8806d6 (diff)
downloadmongo-5a03cdc2d8c60a17aac020db65dcec6f3aa8c789.tar.gz
SERVER-73511 Reuse the code of making new bucket documents for writes to repack unmatched measurements for time-series updates/deletes
Diffstat (limited to 'src/mongo/db/timeseries/bucket_catalog')
-rw-r--r--src/mongo/db/timeseries/bucket_catalog/bucket_catalog.cpp8
-rw-r--r--src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.cpp5
-rw-r--r--src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.h4
3 files changed, 10 insertions, 7 deletions
diff --git a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog.cpp b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog.cpp
index d14bcf38932..4019e73df3d 100644
--- a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog.cpp
+++ b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog.cpp
@@ -76,12 +76,6 @@ OperationId getOpId(OperationContext* opCtx,
MONGO_UNREACHABLE;
}
-BSONObj buildControlMinTimestampDoc(StringData timeField, Date_t roundedTime) {
- BSONObjBuilder builder;
- builder.append(timeField, roundedTime);
- return builder.obj();
-}
-
std::pair<OID, Date_t> generateBucketOID(const Date_t& time, const TimeseriesOptions& options) {
OID oid = OID::gen();
@@ -1594,7 +1588,7 @@ Bucket* BucketCatalog::_allocateBucket(Stripe* stripe,
// Make sure we set the control.min time field to match the rounded _id timestamp.
auto controlDoc = buildControlMinTimestampDoc(info.options.getTimeField(), roundedTime);
bucket->minmax.update(
- controlDoc, bucket->key.metadata.getMetaField(), bucket->key.metadata.getComparator());
+ controlDoc, /*metaField=*/boost::none, bucket->key.metadata.getComparator());
return bucket;
}
diff --git a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.cpp b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.cpp
index 2709e55d769..e62b095d365 100644
--- a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.cpp
+++ b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.cpp
@@ -256,6 +256,11 @@ StatusWith<Date_t> extractTime(const BSONObj& doc, StringData timeFieldName) {
return timeElem.Date();
}
+BSONObj buildControlMinTimestampDoc(StringData timeField, Date_t roundedTime) {
+ BSONObjBuilder builder;
+ builder.append(timeField, roundedTime);
+ return builder.obj();
+}
StatusWith<std::pair<Date_t, BSONElement>> extractTimeAndMeta(const BSONObj& doc,
StringData timeFieldName,
diff --git a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.h b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.h
index ae7f157a497..3f501ec08a6 100644
--- a/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.h
+++ b/src/mongo/db/timeseries/bucket_catalog/bucket_catalog_helpers.h
@@ -73,6 +73,10 @@ StatusWith<std::pair<Date_t, BSONElement>> extractTimeAndMeta(const BSONObj& doc
StringData timeFieldName,
StringData metaFieldName);
+/**
+ * Constructs a singleton BSONObj with the minimum timestamp.
+ */
+BSONObj buildControlMinTimestampDoc(StringData timeField, Date_t roundedTime);
/**
* Retrieves a document from the record store based off of the bucket ID.