[SERVER-31906] Test that applyOps can clone admin.system.version preserving its UUID Created: 10/Nov/17  Updated: 30/Oct/23  Resolved: 20/Nov/17

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.6.1, 3.7.1

Type: Improvement Priority: Major - P3
Reporter: Geert Bosch Assignee: Xiangyu Yao (Inactive)
Resolution: Fixed Votes: 0
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Tested
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.6
Sprint: Storage 2017-11-13, Storage 2017-12-04
Participants:

 Description   

Cloud backup needs to be able to implement its version of initial sync that clones all databases preserving UUIDs, including admin.system.version. However, starting up mongod without data files will itself create the admin.system.version collection with a newly generated UUID. Backup uses the technique below to replace the collection with one preserving the UUID of the backup source.

We need a test to ensure the following will keep working:

  • Use listCollections to note the UUID of the existing admin.system.version
  • Issue applyOps command:

    db.runCommand({
    	"applyOps" : [
    		{
    			"op" : "c",
    			"ns" : "admin.$cmd",
    			"ui" : UUID("deadbeef-8afe-4493-ac73-f2d521877a3b"), // <-- Your new UUID
    			"o" : {
    				"create" : "system.version"
    			}
    		},
    		{
    			"op" : "i",
    			"ns" : "admin.system.version",
    			"o" : {
    				"_id" : "featureCompatibilityVersion",
    				"version" : "3.6"
    			}
    		},
    		{
    			"op" : "c",
    			"ns" : "admin.$cmd",
    			"ui" : UUID("16f1fd0d-aa46-487e-b4c5-571ff5f1e385"), // <-- The UUID of the existing admin.system.version
    			"o" : {
    				"drop" : "admin.tmp_system_version" // <-- Just a placeholder name, doesn't have to be actual collection
    			}
    		}
    	]
    })
    



 Comments   
Comment by Githook User [ 07/Dec/17 ]

Author:

{'name': 'Xiangyu Yao', 'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com'}

Message: SERVER-31906 Test that applyOps can overwrite admin.system.version

(cherry picked from commit 7327250b59dbe844af968488c3b90a97364a2a24)
Branch: v3.6
https://github.com/mongodb/mongo/commit/0c297682547350e3ca8b39f2f53c3fb77f189c60

Comment by Githook User [ 20/Nov/17 ]

Author:

{'name': 'Xiangyu Yao', 'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com'}

Message: SERVER-31906 Test that applyOps can overwrite admin.system.version
Branch: master
https://github.com/mongodb/mongo/commit/7327250b59dbe844af968488c3b90a97364a2a24

Generated at Thu Feb 08 04:28:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.