[SERVER-60497] renameCollectionForApplyOps should skip system.buckets rename check Created: 06/Oct/21  Updated: 29/Oct/23  Resolved: 07/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0, 5.0.4, 5.1.0-rc1

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-59666 Renaming system.buckets collection sh... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0
Sprint: Execution Team 2021-10-18
Participants:
Linked BF Score: 159

 Description   

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"



 Comments   
Comment by Githook User [ 15/Oct/21 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-60497 renameCollectionForApplyOps should skip system.buckets rename check

(cherry picked from commit fba7e40847260c1cff61adbd331be308ee140766)
Branch: v5.0
https://github.com/mongodb/mongo/commit/60f923dd448430fb9c48f30acfb08c87f5741803

Comment by Githook User [ 15/Oct/21 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-60497 renameCollectionForApplyOps should skip system.buckets rename check

(cherry picked from commit fba7e40847260c1cff61adbd331be308ee140766)
Branch: v5.1
https://github.com/mongodb/mongo/commit/d9cefac2f521837128a03685947be900f053f01d

Comment by Githook User [ 07/Oct/21 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-60497 renameCollectionForApplyOps should skip system.buckets rename check
Branch: master
https://github.com/mongodb/mongo/commit/fba7e40847260c1cff61adbd331be308ee140766

Generated at Thu Feb 08 05:49:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.