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

Create a config.migrations collection and a Scoped RAII object class to write to it for migrations

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.3.12
    • None
    • Sharding
    • None
    • Fully Compatible
    • Sharding 18 (08/05/16), Sharding 2016-08-29
    • 0

    Description

      The balancer is going to write every active migrations to the config.migrations collection so that this collection can be used for migration recovery on balancer startup after a stepdown/crash.

      config.migrations should have fields to identify the specific chunk as well as a version and toShard field

      {
          name
          ns
          min
          max
          toShard
          chunkVersion
          collectionVersion
      }
      

      This collection should have an index on (ns, min, max) so that duplicate migrations cannot be scheduled – this would fail anyway.

      The version field is necessary so that on recovery that balancer will not try to schedule a migration that managed to both succeed and be moved back to the original source shard. This can only happen if a v3.2 mongos is running and scheduling moveChunk commands directly to the shards rather than through the balancer – in v3.4, all moveChunks go through the balancer, i.e. a v3.4 mongos routes moveChunk commands to the balancer.

      ------------------------------------------------

      Create a ScopedMigrationRequest RAII object class that will write to config.migrations on creation and destruction, to add and remove an entry, respectively.

      Create a static method that:
      instantiates the scoped object after a local insert is successful.
      waits for majority write concern, and returns an error on failure

      The destructor does a local delete – don't need to worry about majority because if majority fails and we stepdown/crash, recovery will just safely check the migration.

      Attachments

        Activity

          People

            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: