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

couldn't move chunk when doing shardCollection with hashed sharding key

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.9
    • Component/s: Sharding
    • Labels:
      None
    • ALL

      when I do sh.shardCollection with one collection on many process at a same time. It almost happens.

      How to:

      ➜  ~ cat shardCollection.js
      sh.enableSharding("log")
      sh.shardCollection("log.log", {db: "hashed"})
      sh.shardCollection("log.log2", {db: "hashed"})
      sh.shardCollection("log.log3", {db: "hashed"})
      sh.shardCollection("log.log4", {db: "hashed"})
      sh.shardCollection("log.log5", {db: "hashed"})
      sh.shardCollection("log.log6", {db: "hashed"})
      
      ➜  ~ cat test_shardColl.sh 
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      mongo --port 27105  shardCollection.js &
      

      then just execute test_shardColl.sh:

      bash test_shardColl.sh
      

      when you setLogLevel(5, "sharding") , you can see logs like this:

      2017-04-05T18:09:43.889+0800 W COMMAND  [conn20] couldn't move chunk ns: log.log5, shard: shard0001:localhost:27102, lastmod: 1|3||000000000000000000000000, min: { db: 1844674407370955160 }, max: { db: 5534023222112865480 } to shard shard0002:localhost:27103 while sharding collection log.log5. Reason: { ok: 0.0, errmsg: "migration already in progress" }
      

      I suppose that something wrong with ShardCollectionCmd::run() on mongo/s/commands_admin.cpp:

      if (to == chunk->getShard())
          continue;
      

            Assignee:
            mark.agarunov Mark Agarunov
            Reporter:
            coolxwu Martin Wu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: