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

Timeseries bucket collection creation should be idempotent

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • v7.3, v7.0, v6.0, v5.0
    • Hide

      // Create a bucket collection with timeseries options assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));

      // If we run the same operation again it will fail
      assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));

      Show
      // Create a bucket collection with timeseries options assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions})); // If we run the same operation again it will fail assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));
    • CAR Team 2024-04-01

      Direct creation of bucket collection with timeseries options is supported and currently used by mongosync and $out.

      The problem is that today this operation is not idempotent, consider the following scenario as an example:

      // Create a bucket collection with timeseries options assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));
      
      // If we run the same operation again it will fail
      assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));

      We also have an additional problem, if we first create the bucket collection with timeseries options, then the creation of a timeseries collection on the main namespace does not work. E.g.:

      // Create a bucket collection with timeseries options assert.commandWorked(db.createCollection('system.buckets.coll', {timeseries: tsOptions}));
      
      // If we attempt to create the timeseries collection afteward it will fail
      assert.commandWorked(db.createCollection('coll', {timeseries: tsOptions}));

       

            Assignee:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Reporter:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: