Wrong fetching with limit 1 on sharded environment

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • None
    • Affects Version/s: 2.11.2, 2.11.3
    • Component/s: None
    • None
    • Environment:
      Win 7 64-bit
      RAM 8 GB
      Mongo 2.4.3
      mongo-java-driver: 2.11.2 and 2.11.3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      1. Create three Mongo shards on local host. You can use attached file create_local_shards.sh. Be sure all shards are created successfully:

      MongoDB shell version: 2.4.3
      connecting to: test

      { "shardAdded" : "shard0000", "ok" : 1 } { "shardAdded" : "shard0001", "ok" : 1 } { "shardAdded" : "shard0002", "ok" : 1 } { "ok" : 1 } { "collectionsharded" : "shardTest.shardTest", "ok" : 1 }

      2. Run main.java.sharding.test.Starter#main metod of TestOfSkipLimitFetching standalone app. On mine machine I see the range of empty responses for following skip-limits:

      Skip 4000, Limit 1
      Skip 5000, Limit 1
      Skip 6000, Limit 1
      Skip 7000, Limit 1
      Skip 8000, Limit 1
      Skip 9000, Limit 1
      Skip 9999, Limit 1

      Full log you can find in attach.

      So as you see limit of one doc works well on small skip values (till 3000). Then from 4000 of skipped docs we faced with this issue - collection.find().skip(>=4000).limit(1) returns nothing.

      NOTE: We can reproduce it only on sharded Mongo environment. Actually such behavior we reproduced on more than one machines (Unix and Win) with local shards and distributed between 12 different hosts.

        1. TestOfSkipLimitFetching.zip
          380 kB
        2. log
          55 kB
        3. JAVA-950.json
          12.30 MB
        4. create_local_shards.sh
          1 kB

            Assignee:
            Unassigned
            Reporter:
            siarhei usau
            None
            Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: