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

Collection drop doesn't clean the shard version on empty shards

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • ALL
    • Hide

      Run attached js script.

      Show
      Run attached js script.
    • 0

      In a sharded collection, if all chunks on the primary shard has been migrated to non-primary shards, collection drop command on mongos will not send "drop" command to the empty primary shard, but set its shard version to unsharded/dropped state 0|0||0000... However, an empty shard has the shard version 0|0||epoch and thinks the new shard version is compatible with its current one, so the empty shard doesn't drop its metadata.

      In this situation, another insert and query to the just dropped (now unsharded) collection will go to the primary that has stale metadata. The inserted doc will be skipped because the shard doesn't think this doc belongs to it (it thinks it's empty) based on its stale metadata.

        1. coll_drop.js
          1 kB
          Siyuan Zhou

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: