<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:16:47 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-48318] Risk of StaleChunkHistory errors in sharded transactions</title>
                <link>https://jira.mongodb.org/browse/SERVER-48318</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;While reviewing the changes for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47785&quot; title=&quot;Keep minSnapshotHistoryWindowInSeconds of chunk history on config servers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47785&quot;&gt;&lt;del&gt;SERVER-47785&lt;/del&gt;&lt;/a&gt; with&#160;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=renctan&quot; class=&quot;user-hover&quot; rel=&quot;renctan&quot;&gt;renctan&lt;/a&gt;, we wondered if the previous version of the code had a bug. Before, ShardingCatalogManager::commitChunkMigration removed &lt;b&gt;all&lt;/b&gt; chunk history entries older than 10 seconds whenever it writes a new entry. Even after, it removes all but &lt;b&gt;one&lt;/b&gt; of them.&lt;/p&gt;

&lt;p&gt;A new transaction always chooses a recent timestamp, even with readConcern majority. This is the &quot;speculative majority&quot; behavior. But transactions have a default 60-second lifetime, and chunk history only lasts 10 seconds. Do we see the following?:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Start a sharded transaction&lt;/li&gt;
	&lt;li&gt;Choose transaction read timestamp T&lt;/li&gt;
	&lt;li&gt;10 seconds pass&lt;/li&gt;
	&lt;li&gt;A chunkMove clears history entries before T for chunk C&lt;/li&gt;
	&lt;li&gt;The transaction continues and targets C&lt;/li&gt;
	&lt;li&gt;ChunkInfo::getShardIdAt tries to read at T, throws StaleChunkHistory error&lt;/li&gt;
	&lt;li&gt;mongos returns error to the client with TransientTransactionError label&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Transactions cannot retry StaleChunkHistory (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-39704&quot; title=&quot;Allow mongos to retry on stale version and snapshot errors within a transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-39704&quot;&gt;SERVER-39704&lt;/a&gt;) and I think this particular case could never be retried, since the history is truly gone.&lt;/p&gt;

&lt;p&gt;If the client uses a driver&apos;s withTransaction API then TransientTransactionError will compel it to retry the transaction from the start and probably succeed. It can retry for up to 120 seconds. It would have to be unlucky for the sequence above to repeat for that long.&lt;/p&gt;

&lt;p&gt;However, I think we can reduce the incidence of retries by keeping chunk history for at least transactionLifetimeLimitSeconds.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1357086">SERVER-48318</key>
            <summary>Risk of StaleChunkHistory errors in sharded transactions</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="13201">Fixed</resolution>
                                        <assignee username="cheahuychou.mao@mongodb.com">Cheahuychou Mao</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                            <label>sharding-wfbf-day</label>
                    </labels>
                <created>Wed, 20 May 2020 12:52:04 +0000</created>
                <updated>Sun, 29 Oct 2023 22:07:58 +0000</updated>
                            <resolved>Wed, 9 Sep 2020 19:14:19 +0000</resolved>
                                                    <fixVersion>4.7.0</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3387709" author="xgen-internal-githook" created="Fri, 11 Sep 2020 17:08:44 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;cheahuychou.mao@mongodb.com&apos;, &apos;username&apos;: &apos;cheahuychou&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48318&quot; title=&quot;Risk of StaleChunkHistory errors in sharded transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48318&quot;&gt;&lt;del&gt;SERVER-48318&lt;/del&gt;&lt;/a&gt; Make snapshot window equal to max of minSnapshotHistoryWindowInSeconds and transactionLifetimeLimitSeconds&lt;br/&gt;
Branch: svilen-optimizer-poc&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2795d76c634e778a6d0bf672cd26c45c8193d2f4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2795d76c634e778a6d0bf672cd26c45c8193d2f4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3383840" author="xgen-internal-githook" created="Wed, 9 Sep 2020 19:09:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;cheahuychou.mao@mongodb.com&apos;, &apos;username&apos;: &apos;cheahuychou&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48318&quot; title=&quot;Risk of StaleChunkHistory errors in sharded transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48318&quot;&gt;&lt;del&gt;SERVER-48318&lt;/del&gt;&lt;/a&gt; Make snapshot window equal to max of minSnapshotHistoryWindowInSeconds and transactionLifetimeLimitSeconds&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2795d76c634e778a6d0bf672cd26c45c8193d2f4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2795d76c634e778a6d0bf672cd26c45c8193d2f4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3364500" author="max.hirschhorn@10gen.com" created="Fri, 28 Aug 2020 17:07:23 +0000"  >&lt;p&gt;There&apos;s a concern that users who modify transactionLifetimeLimitSeconds won&apos;t know to do the same on their CSRS and so using the higher of minSnapshotHistoryWindowInSeconds and transactionLifetimeLimitSeconds for the minSnapshotHistoryWindowInSeconds setting won&apos;t be effective.&lt;/p&gt;

&lt;p&gt;&lt;del&gt;Raising the default value for minSnapshotHistoryWindowInSeconds to 60 seconds to match transactionLifetimeLimitSeconds would satisfy the default case without much code complexity. And we should consider requesting a DOCS ticket to mention changing minSnapshotHistoryWindowInSeconds for sharded clusters in situations where a user would be changing transactionLifetimeLimitSeconds.&lt;/del&gt; &lt;b&gt;Edit&lt;/b&gt;: Raising the default value for minSnapshotHistoryWindowInSeconds has other implications for history retention in WiredTiger. We&apos;re still wanting the&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To set the parameter for a sharded cluster, the parameter must be modified for all shard replica set members.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/parameters/#param.transactionLifetimeLimitSeconds&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/parameters/#param.transactionLifetimeLimitSeconds&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;line to be updated to mention raising the transactionLifetimeLimitSeconds on the config servers as well with a rationale of something along the lines of &quot;so that routing table history on the config server is maintained for at least as long as the transaction lifetime limit on shards.&quot;&lt;/p&gt;</comment>
                            <comment id="3314614" author="renctan" created="Thu, 30 Jul 2020 20:27:03 +0000"  >&lt;p&gt;We should consider increasing &lt;a href=&quot;https://github.com/mongodb/mongo/blob/3012da79e0b640bf2429f2b83a59ef1ba60271cc/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp#L824&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the window&lt;/a&gt; to be max(transactionLifetime, snapshotWindow, 10). However, it is worth nothing that transactionLifetime and snapshotWidonw setting is per mongod, so it&apos;s only best effort. I don&apos;t think this will substantially increase the size of the chunkHistory unless the same chunk gets moved multiple times during the window.&lt;/p&gt;</comment>
                            <comment id="3222158" author="renctan" created="Wed, 24 Jun 2020 15:54:56 +0000"  >&lt;p&gt;I think this makes sense and probably won&apos;t have a negative impact unless the same chunk is moved being moved constantly.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10320">
                    <name>Documented</name>
                                                                <inwardlinks description="is documented by">
                                        <issuelink>
            <issuekey id="1467994">DOCS-13868</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.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, 24 Jun 2020 15:54:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 21 weeks, 5 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_17052" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Downstream Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>The snapshot history window is now the max of (minSnapshotHistoryWindowInSeconds, transactionLifetimeLimitSeconds, 10) where 10 seconds is the hardcoded lower bound for snapshot history window. Please refer to Max&amp;#39;s comment here &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48318?focusedCommentId=3364500&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-3364500&quot;&gt;https://jira.mongodb.org/browse/SERVER-48318?focusedCommentId=3364500&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-3364500&lt;/a&gt; for the information that should be included in the documentation for transactionLifetimeLimitSeconds. </customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16942"><![CDATA[Needed]]></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>
                            3 years, 21 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>jesse@mongodb.com</customfieldvalue>
            <customfieldvalue>cheahuychou.mao@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
            <customfieldvalue>randolph@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxm5nr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxdfcf:</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="4252">Sharding 2020-09-21</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_17051" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Teams Impacted</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16944"><![CDATA[Docs]]></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|hxlrx3:</customfieldvalue>

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