MongoDB 8.0+ forbids creating time-series buckets collections without the 'timeseries' options field as part of SERVER-79630. Around the same time, shardCollection was redesigned as part of SERVER-78918, so that a new DDL coordinator is used after an upgrade to FCV 8.0.
However, time-series buckets collections without the 'timeseries' options field can still be created if the feature flag associated to this functionality is disabled. After this happens, running a shardCollection command in FCV 8.0 targeting the main namespace will shard the buckets collection without 'timeseries' options. In contrast, the old shardCollection command from FCV 7.0 returns an error without sharding the collection:
[direct: mongos] test> // NOTE: Shards must have been launched with mongod --setParameter featureFlagDisallowBucketCollectionWithoutTimeseriesOptions=false [direct: mongos] test> db.createCollection("system.buckets.withoutoptions") { ok: 1 } [direct: mongos] test> db.adminCommand({setFeatureCompatibilityVersion: "7.0", confirm: true}) { ok: 1, [...] } [direct: mongos] test> db.adminCommand({shardCollection: "test.withoutoptions", key: {m:1}}) MongoServerError[Location6159000]: the collection 'test.system.buckets.withoutoptions' does not have 'timeseries' options [direct: mongos] test> db.adminCommand({setFeatureCompatibilityVersion: "8.0", confirm: true}) { ok: 1, [...] } [direct: mongos] test> db.adminCommand({shardCollection: "test.withoutoptions", key: {m:1}}) { collectionsharded: 'test.withoutoptions', ok: 1, [...] }
Similarly, moveCollection will also track the collection in the cluster catalog:
[direct: mongos] test> db.createCollection("system.buckets.withoutoptions") { ok: 1 } [direct: mongos] test> db.adminCommand({moveCollection: "test.withoutoptions", toShard: "shard02"}) MongoServerError[NamespaceNotFound]: Expected collection test.withoutoptions to be tracked [direct: mongos] test> db.getSiblingDB("config").collections.find({_id: {$regex: /^test\./}}) [ {_id: 'test.system.buckets.withoutoptions', [...], unsplittable: true} ]
Add a guardrail so that we never track a time-series bucket collections without the 'timeseries' field when using the shardCollection / moveCollection command in any FCV version.
- is depended on by
-
SERVER-99290 Invalid timeseries buckets collections prevent completion of FCV 8.0 upgrade
- Closed
- related to
-
SERVER-87678 `createIndex` may create bucket collection after timeseries is dropped
- Backlog