<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:24:23 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-30600] mongos does not detect stale config when clients use non-primary read preferences</title>
                <link>https://jira.mongodb.org/browse/SERVER-30600</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Mongos instances which do not receive any requests with the primary read preference do not get their chunk location configuration updated after a chunk migration.  This results in missing data in query results in cases where the query includes the shard key and the mongos routes the query to the wrong shard.  &lt;/p&gt;

&lt;p&gt;The only workarounds I have come up with so far is to hit every mongos instance with a dummy primary read pref query for each sharded collection (or maybe call the refresh command against the mongos) at some regular interval.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Background info:&lt;/b&gt;&lt;br/&gt;
I run a single 5-node replica which spans 3 data centers.  3 nodes in the central &quot;primary&quot; DC, 1 node in each of our regional &quot;secondary&quot; DCs.  My application is read-only, runs in all 3 DCs, has high read performance requirements, and high tolerance for eventual consistency.  As a result, I run with the &quot;nearest&quot; read preference so that my app running in a regional DC will prefer to read from the mongodb secondary replica running in the same DC, rather than going all the way back to the primary mongodb in the central DC. &lt;/p&gt;

&lt;p&gt;We&apos;ve hit VM RAM capacity issues, and are now attempting to shard in-place into 3 shards, with a mongos instance co-located with each app instance.  Everything went smoothly at first, I allowed the balancer to migrate some chunks to the new shards.  After a few chunks I disabled the balancer to verify no production errors, and found that objects which had moved are no longer coming back in queries by shard key.&lt;/p&gt;

&lt;p&gt;If I make an identical query agains the mongos from the shell (which defaults to primary read preference) I see the following in the logs and get correct results:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2017-08-10T17:30:45.750+0000 D QUERY    [conn87] Received error status for query query: { guid: &quot;some_guid&quot; } sort: {} projection: {} on attempt 1 of 10: SendStaleConfig: [MyDb.myCollection] shard version not ok: version mismatch detected for MyDb.myCollection ( ns : MyDb.myCollection, received : 118|0||598b5cf1b6ff8d56d195d96f, wanted : 121|1||598b5cf1b6ff8d56d195d96f, send )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Afterwards, my app&apos;s queries (using readPref=nearest) correctly return the same results.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="415121">SERVER-30600</key>
            <summary>mongos does not detect stale config when clients use non-primary read preferences</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="mark.agarunov">Mark Agarunov</assignee>
                                    <reporter username="skelly">Seth Kelly</reporter>
                        <labels>
                            <label>RF</label>
                    </labels>
                <created>Thu, 10 Aug 2017 19:35:04 +0000</created>
                <updated>Thu, 7 Sep 2017 20:45:52 +0000</updated>
                            <resolved>Thu, 17 Aug 2017 19:15:33 +0000</resolved>
                                    <version>3.4.5</version>
                                                    <component>Querying</component>
                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>11</watches>
                                                                                                                <comments>
                            <comment id="1650820" author="mark.agarunov" created="Thu, 17 Aug 2017 19:15:21 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=skelly&quot; class=&quot;user-hover&quot; rel=&quot;skelly&quot;&gt;skelly&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;As this behavior seems to be due to the same underlying issue as &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-28948&quot; title=&quot;open up secondaries to checking shardVersion&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-28948&quot;&gt;&lt;del&gt;SERVER-28948&lt;/del&gt;&lt;/a&gt;, I&apos;ve closed this ticket as a duplicate. Please follow &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-28948&quot; title=&quot;open up secondaries to checking shardVersion&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-28948&quot;&gt;&lt;del&gt;SERVER-28948&lt;/del&gt;&lt;/a&gt; for updates on this issue.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Mark&lt;/p&gt;</comment>
                            <comment id="1646896" author="schwerin" created="Sat, 12 Aug 2017 14:51:51 +0000"  >&lt;p&gt;I think that&apos;s your best choice today. Disable the balancer if your data naturally has an even distribution, maybe.&lt;/p&gt;</comment>
                            <comment id="1646563" author="skelly" created="Fri, 11 Aug 2017 18:53:36 +0000"  >&lt;p&gt;Do any of you have any recommendation for a workaround in the meantime?  I was thinking I could run a separate thread that makes a simple query against each mongos using the primary read preference at some reasonable interval.  Thoughts on that approach?&lt;/p&gt;</comment>
                            <comment id="1646557" author="skelly" created="Fri, 11 Aug 2017 18:49:10 +0000"  >&lt;p&gt;Great thanks a lot guys for the quick response.  I&apos;m hoping I can develop a reasonable workaround until the feature comes along.  I expect chunk migrations will be rare in my deployment anyway, at least after the initial balancing of the data.&lt;/p&gt;</comment>
                            <comment id="1646404" author="schwerin" created="Fri, 11 Aug 2017 16:56:16 +0000"  >&lt;p&gt;OK. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=skelly&quot; class=&quot;user-hover&quot; rel=&quot;skelly&quot;&gt;skelly&lt;/a&gt;, this is a duplicate of a feature request that we&apos;ve been developing for the 3.6 release. It&apos;s sufficiently complicated that it cannot be back ported, I&apos;m afraid, but should be available later this year.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dianna.hohensee&quot; class=&quot;user-hover&quot; rel=&quot;dianna.hohensee&quot;&gt;dianna.hohensee&lt;/a&gt;, can you help &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mark.agarunov&quot; class=&quot;user-hover&quot; rel=&quot;mark.agarunov&quot;&gt;mark.agarunov&lt;/a&gt; out by selecting an appropriate ticket that is duplicated by this one, so Seth can track this work if he wants?&lt;/p&gt;</comment>
                            <comment id="1646112" author="dianna.hohensee" created="Fri, 11 Aug 2017 13:35:28 +0000"  >&lt;p&gt;Yes, it will be resolved by our safe secondary reads project in v3.6. Secondaries do not currently (v3.4 or earlier) use routing information to filter results, and in v3.6 they will. To fully resolve his problem, he will likely need to use after cluster time reads (also a v3.6 feature) in order to ensure secondaries are not lagging behind their primaries, in case a mongos that is used to do the secondary reads has a stale shardVersion.&lt;/p&gt;</comment>
                            <comment id="1646055" author="schwerin" created="Fri, 11 Aug 2017 12:21:10 +0000"  >&lt;p&gt;I believe the safe secondary reads project will resolve this. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dianna.hohensee&quot; class=&quot;user-hover&quot; rel=&quot;dianna.hohensee&quot;&gt;dianna.hohensee&lt;/a&gt;?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="377150">SERVER-28948</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 11 Aug 2017 12:21:10 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 25 weeks, 6 days 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>backlog-server-pm</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 25 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>dianna.hohensee@mongodb.com</customfieldvalue>
            <customfieldvalue>mark.agarunov</customfieldvalue>
            <customfieldvalue>skelly</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htcrfz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht4j1j:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Stand up and configure the following MongoDB configuration:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Two 3-node replica sets&lt;/li&gt;
	&lt;li&gt;Two mongos instances&lt;/li&gt;
	&lt;li&gt;One config server replica set&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Create an unsharded database and populate a collection with enough test data that it would be split into multiple chunks upon sharding.&lt;br/&gt;
from the first mongos, shard the collection and wait for a chunk to auto-balance over to the second shard.&lt;br/&gt;
using the second mongos, query for data that is in the migrated chunk by shard key using readPreference=secondary.  0 results will be returned.&lt;br/&gt;
using the second mongos, query for data that is in the migrated chunk by shard key using readPreference=primary.  The correct results will be returned. &lt;br/&gt;
using the second mongos, again query for data that is in the migrated by shard key chunk using readPreference=secondary.  Correct results will now be returned&lt;/p&gt;</customfieldvalue>

                        </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|htcdin:</customfieldvalue>

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