Inconsistent moveCollection response on 1 shard cluster vs multi shard cluster when trying to move a collection back to the same shard

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • ALL
    • Hide

      Here, it is run on a 1 config shard cluster
      Atlas [mongos] testdata> sh.moveCollection("testdata.bigCollection", "config")
      MongoServerError[IllegalOperation]: Cannot move a collection until a second shard has been successfully added

      when a cluster has more than 1 shard, we return

      {ok:1}

      for the same command immediately.

      Atlas [mongos] testdata> sh.moveCollection("testdata.bigCollection", "config")
      {
      ok: 1,
      '$clusterTime': {
      clusterTime: Timestamp(

      { t: 1744490529, i: 44 }

      ),
      signature:

      { hash: Binary.createFromBase64('nj5d8NHc4vqlkB/BYugmYb7tinA=', 0), keyId: Long('7492098370836627479') }

      },
      operationTime: Timestamp(

      { t: 1744490529, i: 44 }

      )
      }

      Show
      Here, it is run on a 1 config shard cluster Atlas [mongos] testdata> sh.moveCollection("testdata.bigCollection", "config") MongoServerError [IllegalOperation] : Cannot move a collection until a second shard has been successfully added when a cluster has more than 1 shard, we return {ok:1} for the same command immediately. Atlas [mongos] testdata> sh.moveCollection("testdata.bigCollection", "config") { ok: 1, '$clusterTime': { clusterTime: Timestamp( { t: 1744490529, i: 44 } ), signature: { hash: Binary.createFromBase64('nj5d8NHc4vqlkB/BYugmYb7tinA=', 0), keyId: Long('7492098370836627479') } }, operationTime: Timestamp( { t: 1744490529, i: 44 } ) }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      moveCollection throws an error when trying to rewrite the collection back to the same shard the data is on if it is run on a 1 shard cluster.
      rewriteCollection command (SERVER-83289) should be used to rewrite the collection back the same shard.

      We should always return

      {ok: 1}

      for moveCollection if the collection is in goal state like we do in case of a multi shard cluster (see below).

            Assignee:
            Unassigned
            Reporter:
            Ratika Gandhi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: