Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-94974

Zone Sharding with Time Series Collections Doesn't Work Unless the Shard Key Includes the timeField

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.0.0, 6.0.0, 7.0.0, 8.0.0
    • Component/s: None
    • None
    • Cluster Scalability
    • Cluster Scalability Priorities

      If a customer shards a Time Series collection without specifying the timeField in the collection's shard key they cannot create a zone configuration as the system conducts a check that all zone ranges are from MinKey to MinKey for the timeField.

      sh.updateZoneKeyRange( "test.system.buckets.testTimeSeriesInsert",
         { "meta": MinKey() },
         { "meta": MaxKey() },
         "consolidateZoneShard0"
      );
      MongoServerError[InvalidOptions]: time field cannot be specified in the zone range for time-series collections 
      
      sh.shardCollection("test.testTimeSeriesInsert", {"sensorId": 1, "timestamp": 1})
      sh.updateZoneKeyRange( "test.system.buckets.testTimeSeriesInsert",
         { "meta": MinKey(), "control.min.timestamp": MinKey()},
         { "meta": MaxKey(), "control.min.timestamp": MinKey()},
         "consolidateZoneShard0"
      );
      {
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1726726752, i: 1 }),
          signature: {
            hash: Binary.createFromBase64('v1yVwHISdlstf7HAdAwEVyGXf1U=', 0),
            keyId: Long('7374051748756848643')
          }
        },
        operationTime: Timestamp({ t: 1726726752, i: 1 })
      }

       

      When the customer does not have the timeField present in their shard key they cannot specify a MinKey to MinKey range for the timeField in their zone configuration as the system will say their zone configuration doesn't match the shard key pattern.

      sh.updateZoneKeyRange( "test.system.buckets.testTimeSeriesInsert",
         { "meta": MinKey(), "timeField": MinKey() },
         { "meta": MaxKey(), "timeField": MinKey() },
         "consolidateZoneShard0"
      );
      MongoServerError[ShardKeyNotFound]: min: { meta: MinKey, timeField: MinKey } is not a prefix of the shard key { meta: 1 } of ns: test.system.buckets.testTimeSeriesInsert 

       

      Sharding on the timeField is not recommended and is deprecated (SERVER-84049), so customers are effectively not able to use zone sharding with Time Series collections contrary to public documentation which removed the zone configuration limitation in the 6.0 docs but is present in the 5.3 docs

            Assignee:
            Unassigned Unassigned
            Reporter:
            matt.panton@mongodb.com Matt Panton
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: