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

renameCollectionForApplyOps should skip system.buckets rename check

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.0.4, 5.1.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Execution Team 2021-10-18
    • 159

      In SERVER-59666, we prohibited system.buckets collection from being renamed by the user, but the applyOps code path can run into this check that was added.

       

      There is a build failure where the TenantMigrationWriter renames a system.buckets collection to a temporary name:

      [j4:rs1:prim] | 2021-10-05T02:42:08.680+00:00 I  COMMAND  20309   [TenantMigrationWriter-0] "CMD: create -- renaming existing collection with conflicting UUID to temporary collection","attr":{"newCollection":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","conflictingUUID":{"uuid":{"$uuid":"ee6edfb2-ca25-4b88-8334-c2fe7afc9eaa"}},"tempName":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create"}
      [j4:rs1:prim] | 2021-10-05T02:42:08.680+00:00 I  STORAGE  20319   [TenantMigrationWriter-0] "renameCollection","attr":{"uuid":{"uuid":{"$uuid":"f01ae87b-2bc7-4d5a-94c6-8e62c623d99b"}},"fromName":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","toName":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create"}
      [j4:rs1:prim] | 2021-10-05T02:42:08.682+00:00 I  STORAGE  20320   [TenantMigrationWriter-0] "createCollection","attr":{"namespace":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","uuidDisposition":"provided","uuid":{"uuid":{"$uuid":"ee6edfb2-ca25-4b88-8334-c2fe7afc9eaa"}},"options":{"uuid":{"$uuid":"ee6edfb2-ca25-4b88-8334-c2fe7afc9eaa"},"validator":{"$jsonSchema":{"bsonType":"object","required":["_id","control","data"],"properties":{"_id":{"bsonType":"objectId"},"control":{"bsonType":"object","required":["version","min","max"],"properties":{"version":{"bsonType":"number"},"min":{"bsonType":"object","required":["time"],"properties":{"time":{"bsonType":"date"}}},"max":{"bsonType":"object","required":["time"],"properties":{"time":{"bsonType":"date"}}},"closed":{"bsonType":"bool"}}},"data":{"bsonType":"object"},"meta":{}},"additionalProperties":false}},"clusteredIndex":true,"expireAfterSeconds":10,"timeseries":{"timeField":"time","granularity":"seconds","bucketMaxSpanSeconds":3600}}}
      

      This gets replicated to the secondaries, which check that renaming a system.buckets collection is not allowed and throw a fatal assertion:

      [j4:rs1:sec0] | 2021-10-05T02:42:08.746+00:00 I  COMMAND  20401   [ReplWriterWorker-0] "renameCollectionForApplyOps","attr":{"sourceNamespace":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","uuid":"f01ae87b-2bc7-4d5a-94c6-8e62c623d99b","targetNamespace":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create","uuidToDrop":"<none>"}
      [j4:rs1:sec0] | 2021-10-05T02:42:08.746+00:00 E  REPL     21262   [ReplWriterWorker-0] "Failed command during oplog application","attr":{"command":{"renameCollection":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","to":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create","stayTemp":true},"db":"tenantMigrationTenantId_clustered_index_options","error":{"code":20,"codeName":"IllegalOperation","errmsg":"Renaming system.buckets collections is disallowed"}}
      [j4:rs1:sec0] | 2021-10-05T02:42:08.746+00:00 F  REPL     21237   [ReplWriterWorker-0] "Error applying operation","attr":{"oplogEntry":{"oplogEntry":{"op":"c","ns":"tenantMigrationTenantId_clustered_index_options.$cmd","ui":{"$uuid":"f01ae87b-2bc7-4d5a-94c6-8e62c623d99b"},"o":{"renameCollection":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","to":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create","stayTemp":true},"ts":{"$timestamp":{"t":1633401728,"i":25}},"t":1,"v":2,"wall":{"$date":"2021-10-05T02:42:08.680Z"},"fromTenantMigration":{"$uuid":"26cb4153-0cff-4923-a3c3-220efe28ae2c"}}},"error":" :: caused by :: IllegalOperation: Renaming system.buckets collections is disallowed"}
      [j4:rs1:sec0] | 2021-10-05T02:42:08.747+00:00 F  REPL     21235   [OplogApplier-0] "Failed to apply batch of operations","attr":{"numOperationsInBatch":1,"firstOperation":{"oplogEntry":{"op":"c","ns":"tenantMigrationTenantId_clustered_index_options.$cmd","ui":{"$uuid":"f01ae87b-2bc7-4d5a-94c6-8e62c623d99b"},"o":{"renameCollection":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","to":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create","stayTemp":true},"ts":{"$timestamp":{"t":1633401728,"i":25}},"t":1,"v":2,"wall":{"$date":"2021-10-05T02:42:08.680Z"},"fromTenantMigration":{"$uuid":"26cb4153-0cff-4923-a3c3-220efe28ae2c"}}},"lastOperation":{"oplogEntry":{"op":"c","ns":"tenantMigrationTenantId_clustered_index_options.$cmd","ui":{"$uuid":"f01ae87b-2bc7-4d5a-94c6-8e62c623d99b"},"o":{"renameCollection":"tenantMigrationTenantId_clustered_index_options.system.buckets.clustered_index_options","to":"tenantMigrationTenantId_clustered_index_options.tmpuBcvQ.create","stayTemp":true},"ts":{"$timestamp":{"t":1633401728,"i":25}},"t":1,"v":2,"wall":{"$date":"2021-10-05T02:42:08.680Z"},"fromTenantMigration":{"$uuid":"26cb4153-0cff-4923-a3c3-220efe28ae2c"}}},"failedWriterThread":9,"error":"IllegalOperation: Renaming system.buckets collections is disallowed"}
      [j4:rs1:sec0] | 2021-10-05T02:42:08.748+00:00 F  ASSERT   23095   [OplogApplier-0] "Fatal assertion","attr":{"msgid":34437,"error":"IllegalOperation: Renaming system.buckets collections is disallowed","file":"src/mongo/db/repl/oplog_applier_impl.cpp","line":343}
      [j4:rs1:sec0] | 2021-10-05T02:42:08.748+00:00 F  ASSERT   23096   [OplogApplier-0] "\n\n***aborting after fassert() failure\n\n"
      

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: