<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:44:55 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-58586] Improve ClientCursor on mongoD to store and restore the readPreference</title>
                <link>https://jira.mongodb.org/browse/SERVER-58586</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For a ClusterClientCursor on mongoS, we store the readPreference and readConcern on the cursor and restore them for getMores:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/s/query/cluster_client_cursor_params.h#L73-L74&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/s/query/cluster_client_cursor_params.h#L73-L74&lt;/a&gt; &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/s/query/cluster_find.cpp#L449-L451&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/s/query/cluster_find.cpp#L449-L451&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At present, for a ClientCursor on mongoD,&#160;we only store and restore the readConcern on the cursor, but not the readPreference:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/db/commands/getmore_cmd.cpp#L226&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/e5c7116913d04d66eb1c9d5cc15250167c37e2c3/src/mongo/db/commands/getmore_cmd.cpp#L226&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We noticed this limitation when implementing&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55309&quot; title=&quot;Re-order post-image lookup stage when expanding $changeStream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55309&quot;&gt;&lt;del&gt;SERVER-55309&lt;/del&gt;&lt;/a&gt;&#160;. We were able to work around this limitation in short term by changing AsyncResultsMerger::_askForNextBatch() to manually add the readPreference to the &apos;getmore&apos; command before it sends the getmore command to the remote machine, but this was not the ideal fix to the underlying issue:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/50315039df4c36d9cde809eaaf56c439ee767340/src/mongo/s/query/async_results_merger.cpp#L452&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/50315039df4c36d9cde809eaaf56c439ee767340/src/mongo/s/query/async_results_merger.cpp#L452&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The goal of this task is to update&#160;ClientCursors on mongoD to store and restore the readPreference on a cursor, and to back out the work-around in&#160;AsyncResultsMerger::_askForNextBatch() that&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55309&quot; title=&quot;Re-order post-image lookup stage when expanding $changeStream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55309&quot;&gt;&lt;del&gt;SERVER-55309&lt;/del&gt;&lt;/a&gt;&#160;introduced.&lt;/p&gt;

&lt;p&gt;For reference, here is the Jira ticket where the ClientCursor on mongoD was updated to store and restore the readConcern: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31665&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-31665&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1820275">SERVER-58586</key>
            <summary>Improve ClientCursor on mongoD to store and restore the readPreference</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="13201">Fixed</resolution>
                                        <assignee username="hana.pearlman@mongodb.com">Hana Pearlman</assignee>
                                    <reporter username="andrew.paroski@mongodb.com">Drew Paroski</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Jul 2021 15:01:18 +0000</created>
                <updated>Sun, 29 Oct 2023 21:50:50 +0000</updated>
                            <resolved>Mon, 23 Aug 2021 12:05:04 +0000</resolved>
                                                    <fixVersion>5.1.0-rc0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="4106843" author="JIRAUSER1259052" created="Wed, 6 Oct 2021 18:10:29 +0000"  >&lt;p&gt;Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it&#8217;s been triggered. For more active release information, please keep an eye on #server-release. Thank you!&lt;/p&gt;</comment>
                            <comment id="4013034" author="xgen-internal-githook" created="Fri, 20 Aug 2021 14:48:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Hana Pearlman&apos;, &apos;email&apos;: &apos;hana.pearlman@mongodb.com&apos;, &apos;username&apos;: &apos;HanaPearlman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58586&quot; title=&quot;Improve ClientCursor on mongoD to store and restore the readPreference&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58586&quot;&gt;&lt;del&gt;SERVER-58586&lt;/del&gt;&lt;/a&gt;: Improve ClientCursor on mongoD to store and restore the&#8230;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c3af4467a404fffebd8b8584fc8c24160d02e850&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c3af4467a404fffebd8b8584fc8c24160d02e850&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3960413" author="bernard.gorman" created="Fri, 23 Jul 2021 18:01:20 +0000"  >&lt;p&gt;Problem here is that only the initial &lt;tt&gt;aggregate&lt;/tt&gt; has a &lt;tt&gt;readPreference&lt;/tt&gt; set on it, but not subsequent &lt;tt&gt;getMores&lt;/tt&gt;. Since the shards don&apos;t store &lt;tt&gt;readPreference&lt;/tt&gt; for the cursor, any sub-operations executed during a &lt;tt&gt;getMore&lt;/tt&gt; will default to &lt;tt&gt;primary&lt;/tt&gt; &lt;tt&gt;readPreference&lt;/tt&gt;. Only the &lt;tt&gt;mongoS&lt;/tt&gt; retains its &lt;tt&gt;readPreference&lt;/tt&gt; across &lt;tt&gt;getMores&lt;/tt&gt;, since we store the &lt;tt&gt;readPref&lt;/tt&gt; on the cursor.&lt;/p&gt;

&lt;p&gt;It seems likely this will also be an issue for sharded &lt;tt&gt;$lookup&lt;/tt&gt;. Unsure why it hasn&apos;t manifested before for &lt;tt&gt;$unionWith&lt;/tt&gt; - do we establish the remote cursors during the initial &quot;parent&quot; &lt;tt&gt;aggregate&lt;/tt&gt;, when the &lt;tt&gt;opCtx&lt;/tt&gt; has the &lt;tt&gt;readPreference&lt;/tt&gt; that was sent with the command from &lt;tt&gt;mongoS&lt;/tt&gt;?&lt;/p&gt;

&lt;p&gt;We should probably at least consider banning &lt;tt&gt;readPreference&lt;/tt&gt; on a &lt;tt&gt;getMore&lt;/tt&gt;, assuming that this doesn&apos;t have driver implications, since it doesn&apos;t really make sense.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1857908">SERVER-59499</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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 23 Jul 2021 18:01:20 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 18 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-282</customfieldvalue>
                        </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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 18 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>bernard.gorman@mongodb.com</customfieldvalue>
            <customfieldvalue>andrew.paroski@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>hana.pearlman@mongodb.com</customfieldvalue>
            <customfieldvalue>vivian.ge@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzshnb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzcqlj:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="5261">Query Optimization 2021-08-09</customfieldvalue>
    <customfieldvalue id="5335">QO 2021-08-23</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|hzs3wf:</customfieldvalue>

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