<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:35:13 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-33991] Pass txnNumber all the getMore command on mongos</title>
                <link>https://jira.mongodb.org/browse/SERVER-33991</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Old Description:&lt;/p&gt;

&lt;p&gt;txnNumber must be passed through getMore command to implement global snapshot reads. &lt;/p&gt;


&lt;p&gt;Proposed approach:&lt;/p&gt;

&lt;p&gt;1. Add boost::optional private field &lt;tt&gt;_txnNumber&lt;/tt&gt; to:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;AsyncResultsMerger&lt;/li&gt;
	&lt;li&gt;ClusterClientCursor(Impl / Mock)&lt;/li&gt;
	&lt;li&gt;ClusterCursorManager::PinnedCursor&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;2. In the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d91bc3cde8d453919fe00a6bd89357d41e79bb19/src/mongo/s/query/cluster_client_cursor_impl.cpp#L73-L94&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ClusterClientCursorImpl constructors&lt;/a&gt;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Take the txnNumber from the opCtx&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;3. In &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d91bc3cde8d453919fe00a6bd89357d41e79bb19/src/mongo/s/query/async_results_merger.cpp#L83-L108&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;AsyncResultsMerger constructor&lt;/a&gt;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Take the txnNumber from the opCtx
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;I&apos;m pretty sure this is guaranteed to be the same opCtx and txnNumber as the one used in the ClusterClientCursorImpl constructors, but if it&apos;s not, I can also thread the txnNumber from the ClusterClientCursor down into the AsyncResultsMerger some other way. Using the opCtx seemed cleaner for a first attempt though.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note: I need to store it in two places because the ARM needs the txnNumber to attach it to getMore requests and the ClusterClientCursor needs it to surface it to the PinnedCursor checked out in ClusterFind::runGetMore so we can validate the txnNumber sent by the user in subsequent getMores&lt;/p&gt;

&lt;p&gt;4. In AsyncResultsMerger::_askForNextBatch&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;If the ARM has a txnNumber, attach it to the getMore request (by std::moving the getMore cmdObj into a BSONObjBuilder to avoid copying) &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d91bc3cde8d453919fe00a6bd89357d41e79bb19/src/mongo/s/query/async_results_merger.cpp#L354&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;5. In ClusterFind::runGetMore&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Assert the txnNumber on the opCtx equals the txnNumber on the checked out pinned cursor &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d91bc3cde8d453919fe00a6bd89357d41e79bb19/src/mongo/s/query/cluster_find.cpp#L490&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If they don&apos;t match, return the cursor to the CursorManager so it isn&apos;t deleted and can be used by subsequent requests (this seems to match the behavior on mongod)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;6. Delete getMore txnNumber check in ShardingTaskExecutor &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d91bc3cde8d453919fe00a6bd89357d41e79bb19/src/mongo/s/sharding_task_executor.cpp#L134-L139&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here&apos;s a POC I made that passes the existing global snapshot reads tests we have, if this approach is approved, I&apos;ll add more testing, esp. unit tests: &lt;a href=&quot;https://mongodbcr.appspot.com/201070002&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodbcr.appspot.com/201070002&lt;/a&gt;&lt;/p&gt;
</description>
                <environment></environment>
        <key id="513656">SERVER-33991</key>
            <summary>Pass txnNumber all the getMore command on mongos</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="jack.mulrow@mongodb.com">Jack Mulrow</assignee>
                                    <reporter username="misha.tyulenev@mongodb.com">Misha Tyulenev</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Mar 2018 22:58:35 +0000</created>
                <updated>Sun, 29 Oct 2023 22:33:34 +0000</updated>
                            <resolved>Mon, 23 Apr 2018 18:33:36 +0000</resolved>
                                                    <fixVersion>3.7.6</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1871726" author="xgen-internal-githook" created="Mon, 23 Apr 2018 18:31:16 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;jack.mulrow@mongodb.com&apos;, &apos;username&apos;: &apos;jsmulrow&apos;, &apos;name&apos;: &apos;Jack Mulrow&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33991&quot; title=&quot;Pass txnNumber all the getMore command on mongos&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33991&quot;&gt;&lt;del&gt;SERVER-33991&lt;/del&gt;&lt;/a&gt; Pass txnNumber in getMore requests through mongos&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8941fac630e0ac31649a1e32b0ea54c3930bdfec&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8941fac630e0ac31649a1e32b0ea54c3930bdfec&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1862832" author="charlie.swanson" created="Thu, 12 Apr 2018 18:50:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jack.mulrow&quot; class=&quot;user-hover&quot; rel=&quot;jack.mulrow&quot;&gt;jack.mulrow&lt;/a&gt; this plan sounds reasonable to me. We will likely have to do the same thing in the ARM for the lsid for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34204&quot; title=&quot;Tailable cursor fails on getMore against a sharded cluster&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34204&quot;&gt;&lt;del&gt;SERVER-34204&lt;/del&gt;&lt;/a&gt;. I wonder if we should consolidate all the things that should be the same into one object to attach to each getMore? e.g. batchSize, lsid, and txnNumber, possibly maxTimeMS for tailable cursors. I can take a stab at that for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34204&quot; title=&quot;Tailable cursor fails on getMore against a sharded cluster&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34204&quot;&gt;&lt;del&gt;SERVER-34204&lt;/del&gt;&lt;/a&gt; though.&lt;/p&gt;</comment>
                            <comment id="1861965" author="jack.mulrow" created="Wed, 11 Apr 2018 21:07:41 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=misha.tyulenev&quot; class=&quot;user-hover&quot; rel=&quot;misha.tyulenev&quot;&gt;misha.tyulenev&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=charlie.swanson&quot; class=&quot;user-hover&quot; rel=&quot;charlie.swanson&quot;&gt;charlie.swanson&lt;/a&gt;, can you guys review the approach / POC above? Thanks!&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="506614">SERVER-33702</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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>Wed, 11 Apr 2018 21:07:41 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 42 weeks, 2 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-675</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>
                            5 years, 42 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jack.mulrow@mongodb.com</customfieldvalue>
            <customfieldvalue>misha.tyulenev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htt20n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht92dz:</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="2217">Sharding 2018-04-23</customfieldvalue>
    <customfieldvalue id="2257">Sharding 2018-05-07</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|htso7z:</customfieldvalue>

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