<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:27 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-950] Wrong fetching with limit 1 on sharded environment</title>
                <link>https://jira.mongodb.org/browse/JAVA-950</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;1. Create three Mongo shards on local host. You can use attached file create_local_shards.sh. Be sure all shards are created successfully:&lt;/p&gt;

&lt;p&gt;MongoDB shell version: 2.4.3&lt;br/&gt;
connecting to: test&lt;/p&gt;
{ &quot;shardAdded&quot; : &quot;shard0000&quot;, &quot;ok&quot; : 1 }
{ &quot;shardAdded&quot; : &quot;shard0001&quot;, &quot;ok&quot; : 1 }
{ &quot;shardAdded&quot; : &quot;shard0002&quot;, &quot;ok&quot; : 1 }
{ &quot;ok&quot; : 1 }
{ &quot;collectionsharded&quot; : &quot;shardTest.shardTest&quot;, &quot;ok&quot; : 1 }

&lt;p&gt;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:&lt;/p&gt;

&lt;p&gt;Skip 4000, Limit 1&lt;br/&gt;
Skip 5000, Limit 1&lt;br/&gt;
Skip 6000, Limit 1&lt;br/&gt;
Skip 7000, Limit 1&lt;br/&gt;
Skip 8000, Limit 1&lt;br/&gt;
Skip 9000, Limit 1&lt;br/&gt;
Skip 9999, Limit 1&lt;/p&gt;

&lt;p&gt;Full log you can find in attach.&lt;/p&gt;

&lt;p&gt;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(&amp;gt;=4000).limit(1) returns nothing.&lt;/p&gt;

&lt;p&gt;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. &lt;/p&gt;</description>
                <environment>Win 7 64-bit&lt;br/&gt;
RAM 8 GB&lt;br/&gt;
Mongo 2.4.3&lt;br/&gt;
mongo-java-driver: 2.11.2 and 2.11.3</environment>
        <key id="90888">JAVA-950</key>
            <summary>Wrong fetching with limit 1 on sharded environment</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="susau">siarhei usau</reporter>
                        <labels>
                    </labels>
                <created>Fri, 20 Sep 2013 10:06:40 +0000</created>
                <updated>Wed, 11 Dec 2013 22:41:18 +0000</updated>
                            <resolved>Wed, 11 Dec 2013 20:36:58 +0000</resolved>
                                    <version>2.11.2</version>
                    <version>2.11.3</version>
                                                                        <votes>6</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="469501" author="jeff.yemin" created="Wed, 11 Dec 2013 20:36:58 +0000"  >&lt;p&gt;Closing this, as it&apos;s not a Java driver bug.  The driver is correctly setting numberToReturn to -1, and mongos is not returning a document, as it does when numberToReturn is 1.&lt;/p&gt;</comment>
                            <comment id="469500" author="jeff.yemin" created="Wed, 11 Dec 2013 20:35:14 +0000"  >&lt;p&gt;I&apos;m linking this to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11815&quot; title=&quot;__getitem__  send a limit of -1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11815&quot;&gt;&lt;del&gt;SERVER-11815&lt;/del&gt;&lt;/a&gt;, as I believe this to be a mongos bug not a java driver bug.&lt;/p&gt;</comment>
                            <comment id="466061" author="susau" created="Thu, 5 Dec 2013 07:37:41 +0000"  >&lt;p&gt;db version: v2.4.3 &amp;amp; v2.4.5&lt;br/&gt;
MongoS version: 2.4.3 &amp;amp; 2.4.5&lt;/p&gt;</comment>
                            <comment id="465619" author="jeff.yemin" created="Wed, 4 Dec 2013 18:36:55 +0000"  >&lt;p&gt;Siarhei,&lt;/p&gt;

&lt;p&gt;Can you respond to Jesse&apos;s question, please, so we can move this issue along?&lt;/p&gt;


&lt;p&gt;Jeff&lt;/p&gt;
</comment>
                            <comment id="459811" author="jesse" created="Thu, 21 Nov 2013 16:27:09 +0000"  >&lt;p&gt;What versions of mongos and mongod are you running, please?&lt;/p&gt;</comment>
                            <comment id="428972" author="susau" created="Fri, 20 Sep 2013 11:03:14 +0000"  >&lt;p&gt;What TestOfSkipLimitFetching standalone app does:&lt;br/&gt;
1. Creates or connects to &quot;shardTest&quot; DB and empty it at the beginning.&lt;br/&gt;
2. Loads &quot;json.json&quot; file (at the root of project) and uses it as template for all documents of &quot;shardTest&quot; collection.&lt;br/&gt;
3. Uses hash value (UUID.randomUUID()) in document &quot;_id&quot; index. Exactly this indexed field is shard key (see create_local_shards.sh).&lt;br/&gt;
4. Creates 10000 documents.&lt;br/&gt;
5. Runs several fetches (collection.find().skip(..).limit(..)) for different skip-limit values.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="99352">SERVER-11815</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="35277" name="JAVA-950.json" size="12899474" author="jeff.yemin@mongodb.com" created="Wed, 11 Dec 2013 20:33:38 +0000"/>
                            <attachment id="31609" name="TestOfSkipLimitFetching.zip" size="389261" author="susau" created="Fri, 20 Sep 2013 10:06:40 +0000"/>
                            <attachment id="31610" name="create_local_shards.sh" size="1268" author="susau" created="Fri, 20 Sep 2013 10:06:40 +0000"/>
                            <attachment id="31611" name="log" size="55897" author="susau" created="Fri, 20 Sep 2013 10:06:40 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrgaon:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8640</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>