diff options
author | Dan Larkin-York <dan.larkin-york@mongodb.com> | 2021-10-27 16:42:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-27 17:36:55 +0000 |
commit | dd8c32c66cbb401af315364e8d6843e521d96e72 (patch) | |
tree | ce1d7a108145888a968d216a9bb4de2c9552244a /src/mongo/db/timeseries/bucket_catalog.h | |
parent | f977f696a5179cbf36d49e55dcbd0bd6a8d7b975 (diff) | |
download | mongo-dd8c32c66cbb401af315364e8d6843e521d96e72.tar.gz |
SERVER-60565 Ensure newly created time-series buckets do not contain problematic mixed-schema data
Diffstat (limited to 'src/mongo/db/timeseries/bucket_catalog.h')
-rw-r--r-- | src/mongo/db/timeseries/bucket_catalog.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/timeseries/bucket_catalog.h b/src/mongo/db/timeseries/bucket_catalog.h index 9936a9be4c3..763808bc2a8 100644 --- a/src/mongo/db/timeseries/bucket_catalog.h +++ b/src/mongo/db/timeseries/bucket_catalog.h @@ -425,6 +425,10 @@ public: // The minimum and maximum values for each field in the bucket. timeseries::MinMax _minmax; + // The reference schema for measurements in this bucket. May reflect schema of uncommitted + // measurements. + BSONObj _schema; + // The latest time that has been inserted into the bucket. Date_t _latestTime; @@ -463,6 +467,7 @@ private: AtomicWord<long long> numBucketUpdates; AtomicWord<long long> numBucketsOpenedDueToMetadata; AtomicWord<long long> numBucketsClosedDueToCount; + AtomicWord<long long> numBucketsClosedDueToSchemaChange; AtomicWord<long long> numBucketsClosedDueToSize; AtomicWord<long long> numBucketsClosedDueToTimeForward; AtomicWord<long long> numBucketsClosedDueToTimeBackward; @@ -598,6 +603,14 @@ private: void release(); /** + * Determines if the schema for an incoming measurement is incompatible with those already + * stored in the bucket. + * + * Returns true if incompatible + */ + bool schemaIncompatible(const BSONObj& doc); + + /** * Close the existing, full bucket and open a new one for the same metadata. * Parameter is a function which should check that the bucket is indeed still full after * reacquiring the necessary locks. The first parameter will give the function access to |