<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:45:31 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>[SERVER-37279] suboptimal read isolation when using $in with shard keys</title>
                <link>https://jira.mongodb.org/browse/SERVER-37279</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Say I have a collection with a hashed shard key on field &quot;S&quot;.&lt;/p&gt;

&lt;p&gt;If I send a query such as: db.coll.find({&quot;S&quot;: {$in: &lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt;}}) with&lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt; being a relative lengthy list (couple of hundred entries). It seems like all entries in there are send to all shards instead of mongos splitting the query appropriately. As a result, each shard has to check for each of the values.&lt;/p&gt;</description>
                <environment></environment>
        <key id="608855">SERVER-37279</key>
            <summary>suboptimal read isolation when using $in with shard keys</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="3">Duplicate</resolution>
                                        <assignee username="nick.brewer">Nick Brewer</assignee>
                                    <reporter username="rmsmith">Richard Smith</reporter>
                        <labels>
                    </labels>
                <created>Mon, 24 Sep 2018 08:36:38 +0000</created>
                <updated>Wed, 3 Oct 2018 15:34:11 +0000</updated>
                            <resolved>Wed, 3 Oct 2018 15:34:11 +0000</resolved>
                                    <version>4.0.2</version>
                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2022318" author="nick.brewer" created="Wed, 3 Oct 2018 15:34:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rmsmith&quot; class=&quot;user-hover&quot; rel=&quot;rmsmith&quot;&gt;rmsmith&lt;/a&gt; Thanks for the thorough clarification and steps to reproduce. The behavior you&apos;re seeing is in fact expected - we currently have a ticket open to track improvements that would allow &lt;tt&gt;$in&lt;/tt&gt; queries to split more efficiently: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1007&quot; title=&quot;rewrite $in queries on shard key to only include keys on each shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1007&quot;&gt;SERVER-1007&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can vote for that ticket, and follow along with it for updates. For now I&apos;ll close this ticket as a duplicate - feel free to let us know if you have any questions. &lt;/p&gt;

&lt;p&gt;-Nick&lt;/p&gt;</comment>
                            <comment id="2020729" author="rmsmith" created="Tue, 2 Oct 2018 15:50:12 +0000"  >&lt;p&gt;I uploaded a couple of files.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;there is fill_data.py, which I used to fill a demo collection with data which reproduces the issue.&lt;/li&gt;
	&lt;li&gt;there is setup.log, which shows show I sharded the collection afterwards&lt;/li&gt;
	&lt;li&gt;there is shard_distribution.log which shows the output of getShardDistribution for the collection in question&lt;/li&gt;
	&lt;li&gt;there are just_rs1.log and just_rs2.log with execution stats for&#160;db.coll.find({&quot;xy&quot;: {$in:&#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;1:1&amp;quot;&amp;#93;&lt;/span&gt;}}) and&#160;db.coll.find({&quot;xy&quot;: {$in:&#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;999:999&amp;quot;&amp;#93;&lt;/span&gt;}}), respectively. The execution stats indicate that each of the queries hits just one rs.&lt;/li&gt;
	&lt;li&gt;there is both.log with the execution stats for&#160;db.coll.find({&quot;xy&quot;: {$in:&#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;1:1&amp;quot;, &amp;quot;999:999&amp;quot;&amp;#93;&lt;/span&gt;}}). the stats indicate that both rs search for both values (&quot;1:1&quot; and &quot;999:999&quot;) even though the query router should be aware that sending &quot;1:1&quot; to rs2 and &quot;999:999&quot; to rs1 is unnecessary.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="2012412" author="nick.brewer" created="Mon, 24 Sep 2018 18:35:48 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rmsmith&quot; class=&quot;user-hover&quot; rel=&quot;rmsmith&quot;&gt;rmsmith&lt;/a&gt; With a hashed shard key, it is expected that documents that are &quot;close&quot; based on the key value will not be on the same shard. The behavior of checking with each shard most likely indicates that your hashed key is working correctly, as the hashed field is distributed across the shards in your cluster. If you&apos;re seeing something in your logs that leads you to believe otherwise, it would be useful if you provide the relevant log lines here. &lt;/p&gt;

&lt;p&gt;I believe what you&apos;re seeing here is by design; however if you&apos;d like us to take a closer look, please upload:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The output of &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/db.collection.getShardDistribution/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;getShardDistribution&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;An actual query you&apos;re using that results in this behavior&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;As this ticket is public, you can upload this information to our &lt;a href=&quot;https://10gen-httpsupload.s3.amazonaws.com/upload_forms/b62c16f0-911b-477a-b333-aeaf77c4d830.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;secure portal&lt;/a&gt; if you&apos;d prefer - information shared there is only available to MongoDB employees, and is automatically removed after a period of time. &lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
-Nick&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="11768">SERVER-1007</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="197637" name="both.log" size="6914" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                            <attachment id="197638" name="fill_data.py" size="304" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                            <attachment id="197639" name="just_rs1.log" size="3725" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                            <attachment id="197640" name="just_rs2.log" size="3748" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                            <attachment id="197641" name="setup.log" size="2355" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                            <attachment id="197642" name="shard_distribution.log" size="609" author="rmsmith" created="Tue, 2 Oct 2018 15:42:45 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 24 Sep 2018 18:35:48 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 19 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>nick.brewer</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 19 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>nick.brewer</customfieldvalue>
            <customfieldvalue>rmsmith</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu8ohj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htz407:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu8aqv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>