<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:53:17 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-39847] Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog</title>
                <link>https://jira.mongodb.org/browse/SERVER-39847</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Note: description is based on v4.0 code, code organization in current master changed a little bit, but the story is the same.&lt;/p&gt;

&lt;p&gt;1. Shard0 does retryable write on stmt: 0.&lt;br/&gt;
2. Shard0 migrates chunk to Shard1.&lt;br/&gt;
3. History of stmt: 0 gets transferred to Shard1.&lt;br/&gt;
4. Time passes such that history of stmt: 0 in the oplog gets rolled over.&lt;br/&gt;
5. Shard0 migrates chunk to Shard1 again. (Note: to trigger this bug, shard0 should not have rolled over the oplog yet!)&lt;br/&gt;
6. Shard1 checks &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.0.6/src/mongo/db/session.cpp#L444&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;if stmt is already executed&lt;/a&gt;.&lt;br/&gt;
7. Shard1 has stmt already in the cached map, but when &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.0.6/src/mongo/db/session.cpp#L526&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;it tries to retrieve the actual oplog&lt;/a&gt;, it&apos;ll realize that the oplog was already truncated and throw IncompleteTransactionHistory.&lt;br/&gt;
8. The exception gets caught but &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.0.6/src/mongo/db/session.cpp#L453&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;it lets it through&lt;/a&gt; as an attempt to &quot;repair/recover&quot; lost history.&lt;br/&gt;
9. However, after it inserts the oplog entry and the commit callback gets executed, it will find out &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.0.6/src/mongo/db/session.cpp#L1423&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;that the stmt is already in the map and triggers the fassert&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="705102">SERVER-39847</key>
            <summary>Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog</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="13201">Fixed</resolution>
                                        <assignee username="randolph@mongodb.com">Randolph Tan</assignee>
                                    <reporter username="randolph@mongodb.com">Randolph Tan</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Feb 2019 19:04:59 +0000</created>
                <updated>Sun, 29 Oct 2023 22:23:31 +0000</updated>
                            <resolved>Thu, 28 Feb 2019 15:35:40 +0000</resolved>
                                                    <fixVersion>3.6.12</fixVersion>
                    <fixVersion>4.0.7</fixVersion>
                    <fixVersion>4.1.9</fixVersion>
                                    <component>Sharding</component>
                                        <votes>1</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="2174962" author="xgen-internal-githook" created="Thu, 7 Mar 2019 20:17:52 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;username&apos;: &apos;renctan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-39847&quot; title=&quot;Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-39847&quot;&gt;&lt;del&gt;SERVER-39847&lt;/del&gt;&lt;/a&gt; Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 1466c2b24eef41805dfac73e2fb43256d6d8fae7)&lt;br/&gt;
(cherry picked from commit 8187116fe23a02f60bc2ed6dcdfa32d91b6e2c43)&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/557dedf9b693ecfc6f8a170a125a59c3faefd0b8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/557dedf9b693ecfc6f8a170a125a59c3faefd0b8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2166239" author="xgen-internal-githook" created="Thu, 28 Feb 2019 15:34:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;username&apos;: &apos;renctan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-39847&quot; title=&quot;Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-39847&quot;&gt;&lt;del&gt;SERVER-39847&lt;/del&gt;&lt;/a&gt; Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 1466c2b24eef41805dfac73e2fb43256d6d8fae7)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8187116fe23a02f60bc2ed6dcdfa32d91b6e2c43&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8187116fe23a02f60bc2ed6dcdfa32d91b6e2c43&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2165448" author="xgen-internal-githook" created="Wed, 27 Feb 2019 22:38:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;username&apos;: &apos;renctan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-39847&quot; title=&quot;Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-39847&quot;&gt;&lt;del&gt;SERVER-39847&lt;/del&gt;&lt;/a&gt; Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1466c2b24eef41805dfac73e2fb43256d6d8fae7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1466c2b24eef41805dfac73e2fb43256d6d8fae7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2163526" author="renctan" created="Tue, 26 Feb 2019 20:50:54 +0000"  >&lt;p&gt;I have confirmed that this is a problem in 4.0 and master. Code in v3.6 looks very similar to v4.0, so I imagine it has the problem as well.&lt;/p&gt;</comment>
                            <comment id="2163483" author="kaloian.manassiev" created="Tue, 26 Feb 2019 20:22:21 +0000"  >&lt;p&gt;I prefer the second option for the following considerations:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;It will result in a much simpler code that we don&apos;t have to worry about backporting&lt;/li&gt;
	&lt;li&gt;The recipient shard&apos;s history in most cases will still be &quot;incomplete&quot; even if we start differentiating these two cases and append the history from the donor&lt;/li&gt;
	&lt;li&gt;Incomplete histories arise as a result of oplog truncation combined with session expiration. With reasonably-sized oplog, there should still be plenty of time for a caller, which received an error to retry the operation&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;This is a problem in both 3.6 and 4.0, right?&lt;/p&gt;</comment>
                            <comment id="2163452" author="renctan" created="Tue, 26 Feb 2019 19:59:07 +0000"  >&lt;p&gt;One way to fix this is to be &quot;smart&quot; and differentiate between &quot;I know I have written this before but forgot about it&quot; vs &quot;I don&apos;t know about this write but unsure because my history is incomplete&quot;. Or flat out just ignore the incoming transaction history if the retryableWrite state is in the state where it has incompleteHistory (basically we are treating the incoming write history as &quot;lost&quot; as well).&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="722189">SERVER-40324</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="210015" name="small_oplog.js" size="2002" author="randolph@mongodb.com" created="Tue, 26 Feb 2019 19:51:42 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.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_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="15640"><![CDATA[v4.0]]></customfieldvalue>
    <customfieldvalue key="15141"><![CDATA[v3.6]]></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_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000dH5fWQAS, 5002K00000dDuXPQA0, 5002K00000fGm6mQAC]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 26 Feb 2019 20:22:21 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 48 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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 48 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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@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|huot67:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huejjj:</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="2824">Sharding 2019-03-11</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|huoffj:</customfieldvalue>

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