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

a moveChunk that joins the active moveChunk on a shard may not respect its waitForDelete

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.9, 3.5.12
    • Affects Version/s: 3.4.6, 3.5.10
    • Component/s: Sharding
    • Labels:
    • Fully Compatible
    • ALL
    • v3.4
    • Sharding 2017-08-21

      moveChunk's are considered equal even if their 'waitForDelete' options do not match:

      https://github.com/mongodb/mongo/blob/r3.5.10/src/mongo/s/move_chunk_request.cpp#L159-L170

      bool MoveChunkRequest::operator==(const MoveChunkRequest& other) const {
          if (_nss != other._nss)
              return false;
          if (_fromShardId != other._fromShardId)
              return false;
          if (_toShardId != other._toShardId)
              return false;
          if (_range != other._range)
              return false;
      
          return true;
      }
      

      However, only the active moveChunk acts on its 'waitForDelete' option.

      So, if the active moveChunk has waitForDelete=false, a moveChunk that joins it will exhibit waitForDelete=false behavior even if it has waitForDelete=true.

      A quick fix for this is to include the 'waitForDelete' option when comparing moveChunk requests. This way, if a later moveChunk's waitForDelete does not match the active moveChunk's waitForDelete, the later moveChunk will fail with ConflictingOperationInProgress rather than succeeding silently.

      A longer fix is to refactor the schedule range deletion and waitForDelete behavior so that it is done by each moveChunk request according to its own waitForDelete option. This would allow a later moveChunk to join the active one for the actual migration, but wait for delete independently.

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: