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

Shard depends on string comparison of replica set connection string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.6.6, 2.7.5
    • Component/s: Sharding
    • Labels:
      None
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide
      1. Start a sharded replica set and shard a collection.
      2. Update the shards collection in the config database so the shards are in a different order

        > db.shards.find({_id: "rs0"})
        { "_id" : "rs0", "host" : "rs0/host1.example.com:27017,host2.example.com:27017" }
        > db.shards.update({_id: "rs0"}, { $set: { "host": "rs0/host2.example.com:27017,host1.example.com:27017" }})
        WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

      3. Try to drop a sharded collection on the now-inconsistent shard - you should get

        mongos> db.testcoll.drop()
        Thu Jul 24 10:06:40.696 drop failed: {
            "code" : 13129,
            "ok" : 0,
            "errmsg" : "exception: can't find shard for: rs0/host1.example.com,host2.example.com"
        } at src/mongo/shell/collection.js:383

      Show
      Start a sharded replica set and shard a collection. Update the shards collection in the config database so the shards are in a different order > db.shards.find({_id: "rs0"}) { "_id" : "rs0", "host" : "rs0/host1.example.com:27017,host2.example.com:27017" } > db.shards.update({_id: "rs0"}, { $set: { "host": "rs0/host2.example.com:27017,host1.example.com:27017" }}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) Try to drop a sharded collection on the now-inconsistent shard - you should get mongos> db.testcoll.drop() Thu Jul 24 10:06:40.696 drop failed: { "code" : 13129, "ok" : 0, "errmsg" : "exception: can't find shard for: rs0/host1.example.com,host2.example.com" } at src/mongo/shell/collection.js:383

      Description

      If there's a replicaset reconfiguration, so the order hosts are listed in the connection string changes, then mongos won't be able to find information about the shard, because it does a string comparison of the two connection strings instead of parsing them and comparing the items in the list.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: