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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.1, 3.7.1
    • Component/s: Storage
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v3.6
    • Sprint:
      Storage 2017-11-13, Storage 2017-12-04

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: