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

Auto- and User-Generated-Shard Names May Colide

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.4.9
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      echo "===> create directories"
      mkdir config s1 s2 s3
       
      echo "===> start mongodb instances:"
      mongod --logpath s1.log --dbpath s1 --port 27016 --fork
      mongod --logpath s2.log --dbpath s2 --port 27015 --fork
      mongod --logpath s3.log --dbpath s3 --port 27014 --fork
       
      mongod --logpath config.log --dbpath config --configsvr --port 27013 --fork
       
      mongos --logpath mongos.log --port 27012 --configdb localhost:27013 --fork
       
      ps -ef | grep mongo
      echo -e "-----\n"
       
      echo "===> add first shard with manual name"
      mongo --port 27012 admin --eval 'printjson(db.runCommand({addShard: "127.0.0.1:27016", name: "shard1"}));'
      echo -e "-----\n"
       
      echo "===> add second shard with automatic name"
      mongo --port 27012 admin --eval 'printjson(sh.addShard("127.0.0.1:27015"));'
      echo -e "-----\n"
       
      echo "===> add third shard with automatic name"
      mongo --port 27012 admin --eval 'printjson(sh.addShard("127.0.0.1:27014"));'
      echo -e "-----\n"
       
      echo "===> sh.status()"
      mongo --port 27012 admin --eval 'printjson(sh.status());'
      echo -e "-----\n"
       
      echo "shutting things down:"
      for port in 27016 27015 27014 27013 27012; do
          echo "shutting down server on $port"
          mongo --port $port admin --quiet --eval "db.shutdownServer()"
      done
      echo -e "-----\n"
       
      ps -ef | grep mongo
      

      Show
      echo "===> create directories" mkdir config s1 s2 s3   echo "===> start mongodb instances:" mongod --logpath s1.log --dbpath s1 --port 27016 --fork mongod --logpath s2.log --dbpath s2 --port 27015 --fork mongod --logpath s3.log --dbpath s3 --port 27014 --fork   mongod --logpath config.log --dbpath config --configsvr --port 27013 --fork   mongos --logpath mongos.log --port 27012 --configdb localhost:27013 --fork   ps -ef | grep mongo echo -e "-----\n"   echo "===> add first shard with manual name" mongo --port 27012 admin --eval 'printjson(db.runCommand({addShard: "127.0.0.1:27016", name: "shard1"}));' echo -e "-----\n"   echo "===> add second shard with automatic name" mongo --port 27012 admin --eval 'printjson(sh.addShard("127.0.0.1:27015"));' echo -e "-----\n"   echo "===> add third shard with automatic name" mongo --port 27012 admin --eval 'printjson(sh.addShard("127.0.0.1:27014"));' echo -e "-----\n"   echo "===> sh.status()" mongo --port 27012 admin --eval 'printjson(sh.status());' echo -e "-----\n"   echo "shutting things down:" for port in 27016 27015 27014 27013 27012; do echo "shutting down server on $port" mongo --port $port admin --quiet --eval "db.shutdownServer()" done echo -e "-----\n"   ps -ef | grep mongo

      Description

      When I add a third shard to a cluster where the first one was explicitly named and the second wasn't I get a duplicate key error and cannot add the shard.

      I saw this starting a cluster with mlaunch then adding a second shard.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-sharding Backlog - Sharding Team
            Reporter:
            john.page John Page
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: