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

Test that applyOps can clone admin.system.version preserving its UUID

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.1, 3.7.1
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • v3.6
    • Storage 2017-11-13, Storage 2017-12-04

      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
        			}
        		}
        	]
        })
        

            Assignee:
            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            Reporter:
            geert.bosch@mongodb.com Geert Bosch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: