<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:58:39 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-41779] reconstructPreparedTransactions fails to read a prepare oplog entry during initial sync</title>
                <link>https://jira.mongodb.org/browse/SERVER-41779</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;tt&gt;reconstructPreparedTransactions&lt;/tt&gt; could fail to read an oplog entry during initial sync when:&lt;br/&gt;
 1. The first attempt of initial sync fails after applying some oplog entries, which leaves the &lt;tt&gt;localSnapshot&lt;/tt&gt; pointing to the lastApplied.&lt;br/&gt;
 2. The second attempt of initial sync &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/initial_syncer.cpp#L502&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;does try to reset all the optimes&lt;/a&gt; before starting the new attempt. &lt;tt&gt;ReplicationCoordinatorImpl::resetMyLastOpTimes&lt;/tt&gt; relies on calling &lt;tt&gt;ReplicationCoordinatorImpl::_setMyLastAppliedOpTimeAndWallTime&lt;/tt&gt; to reset the lastApplied and the localSnapshot back to OpTime 0. But &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/replication_coordinator_impl.cpp#L1222&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;ReplicationCoordinatorImpl::_setMyLastAppliedOpTimeAndWallTime&lt;/tt&gt; skips resetting the localSnapshot if the given OpTime &lt;tt&gt;isNull()&lt;/tt&gt;&lt;/a&gt;. Because of this bug, the &lt;tt&gt;localSnapshot&lt;/tt&gt; is still pointing to the last oplog entry applied during the first attempt.&lt;br/&gt;
 3. If the second attempt doesn&apos;t need to apply any ops after data cloning, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/initial_syncer.cpp#L1118-L1122&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;it inserts the last oplog entry as the oplog seed document using the timestamp of that oplog entry&lt;/a&gt;. In order to trigger the bug, the last oplog entry that inserted as the seed has to be a prepare oplog entry and its OpTime has to be greater than the OpTimes of the oplog entries applied in (1).&lt;br/&gt;
 4. After the second attempt successfully finishes, &lt;tt&gt;reconstructPreparedTransactions&lt;/tt&gt; is called to reconstruct outstanding prepared transactions. In this case, it needs to read the oplog seed entry.&lt;br/&gt;
 5. &lt;tt&gt;reconstructPreparedTransactions&lt;/tt&gt; uses its own &lt;tt&gt;ReadSourceScope&lt;/tt&gt; but the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/transaction_oplog_application.cpp#L403&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;transactions table read&lt;/a&gt; implicitly changes the read source to &lt;tt&gt;kLastAppled&lt;/tt&gt; which is then used by &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/transaction_oplog_application.cpp#L420&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the oplog read&lt;/a&gt;.&lt;br/&gt;
 6. Because of the bug in (2), oplog read is using the lastApplied timestamp (that was set in (1) but failed to be reset in (2)) that is earlier than the prepare oplog entry and thus fails to read the entry.&lt;/p&gt;

&lt;p&gt;There are two solutions to this:&lt;br/&gt;
1. Fix &lt;tt&gt;reconstructPreparedTransactions&lt;/tt&gt; to explicitly set read source as &lt;tt&gt;kNoTimestamp&lt;/tt&gt; so both &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/transaction_oplog_application.cpp#L403&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the transactions table read&lt;/a&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/transaction_oplog_application.cpp#L420&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the oplog read&lt;/a&gt; would be untimestamped.&lt;br/&gt;
2.&#160;Fix &lt;tt&gt;ReplicationCoordinatorImpl::_setMyLastAppliedOpTimeAndWallTime&lt;/tt&gt; to reset &lt;tt&gt;localSnapshot&lt;/tt&gt; properly even if the given OpTime is 0. (i.e. Moving the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/replication_coordinator_impl.cpp#L1222-L1224&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;if statement&lt;/a&gt; to after &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e065191db38f9a63bccbb6bf027836ca773e9ee/src/mongo/db/repl/replication_coordinator_impl.cpp#L1229&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;updateLocalSnapshot&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And I think maybe we should do both.&lt;/p&gt;</description>
                <environment></environment>
        <key id="803845">SERVER-41779</key>
            <summary>reconstructPreparedTransactions fails to read a prepare oplog entry during initial sync</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="lingzhi.deng@mongodb.com">Lingzhi Deng</assignee>
                                    <reporter username="lingzhi.deng@mongodb.com">Lingzhi Deng</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 Jun 2019 21:33:57 +0000</created>
                <updated>Sun, 29 Oct 2023 22:19:50 +0000</updated>
                            <resolved>Thu, 20 Jun 2019 00:54:52 +0000</resolved>
                                                    <fixVersion>4.2.0-rc2</fixVersion>
                    <fixVersion>4.3.1</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2292903" author="xgen-internal-githook" created="Fri, 21 Jun 2019 14:32:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-41779&quot; title=&quot;reconstructPreparedTransactions fails to read a prepare oplog entry during initial sync&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-41779&quot;&gt;&lt;del&gt;SERVER-41779&lt;/del&gt;&lt;/a&gt;: reconstructPreparedTransactions should use readSource kNoTimestamp&lt;/p&gt;

&lt;p&gt;(cherry picked from commit f1dcaea4a97903fa7c785f31c55f484d275a5aed)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a24ee3ffddee6c04d80aaf8b9ac7dc20d13a807a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a24ee3ffddee6c04d80aaf8b9ac7dc20d13a807a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2290771" author="xgen-internal-githook" created="Thu, 20 Jun 2019 00:53:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-41779&quot; title=&quot;reconstructPreparedTransactions fails to read a prepare oplog entry during initial sync&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-41779&quot;&gt;&lt;del&gt;SERVER-41779&lt;/del&gt;&lt;/a&gt;: reconstructPreparedTransactions should use readSource kNoTimestamp&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/f1dcaea4a97903fa7c785f31c55f484d275a5aed&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/f1dcaea4a97903fa7c785f31c55f484d275a5aed&lt;/a&gt;&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>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.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="16775"><![CDATA[v4.2]]></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>Thu, 20 Jun 2019 00:53:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 33 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_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_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, 33 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>12.0</customfieldvalue>

                        </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>lingzhi.deng@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hv5dvr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hur027:</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="3001">Repl 2019-07-01</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|hv5053:</customfieldvalue>

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