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

Rename collection to a bucket does not consider already existing target collection

    • 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-alpha1
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • Hide
      db.createCollection( 'srcColl', { timeseries: { timeField: "timestamp", metaField: "metadata" } })
      db.createCollection( 'dstColl')
      db.system.buckets.srcColl.renameCollection(system.buckets.dstColl);
      
      Show
      db.createCollection( 'srcColl', { timeseries: { timeField: "timestamp", metaField: "metadata" } }) db.createCollection( 'dstColl') db.system.buckets.srcColl.renameCollection(system.buckets.dstColl);
    • 2

      renaming a timeseries bucket collection is currently allowed (under special priviledges) and also used internally by $out.

      The problem is that when we execute a rename of a timeseries bucket collection we do not check if a collection already exist on the target main namespace.

      For instance, if we do the following:

      db.createCollection( 'srcColl', { timeseries: { timeField: "timestamp", metaField: "metadata" } })
      db.createCollection( 'dstColl')
      db.system.buckets.srcColl.renameCollection(system.buckets.dstColl);
      

      The rename should fail because the target collection already exists and instead it works leaving the local catalog with both normal collection 'db.dstColl' and timeseries bucket collection 'db.system.buckets.dstColl'

      We should extend jstests/core/rename_system_buckets_collections.js to cover those scenarios.

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

              Created:
              Updated: