<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:57:01 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-41178] TransactionHistoryIterator should do untimestamped reads during rollback recovery</title>
                <link>https://jira.mongodb.org/browse/SERVER-41178</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If we are recovering, the lastApplied timestamp could be ahead of the common point in the case of rollback recovery because we do not update the lastAppliedOpTime until after we are done recovering the oplog. TransactionHistoryIterator by default does timestamped reads on the oplog using lastApplied. So this could race with the config.transactions table update (run by a different replication writer thread) whose commitTimestamp is less than the common point and thus less than the read timestamp of the TransactionHistoryIterator. WiredTiger enforces that the commit timestamp of non-prepared transactions (which is the case for config.transactions update) is newer than the latest active reader. See &lt;a href=&quot;https://jira.mongodb.org/browse/WT-4780&quot; title=&quot;Enable assertion that commit timestamp is newer than all readers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;WT-4780&quot;&gt;&lt;del&gt;WT-4780&lt;/del&gt;&lt;/a&gt;. So, we need to make TransactionHistoryIterator read untimestamped to avoid violating WiredTiger rules. This is safe because there should be no concurrent write to the oplog and all oplog entries we need on the transaction oplog chain should also be visible under untimestamped reads.&lt;/p&gt;</description>
                <environment></environment>
        <key id="769745">SERVER-41178</key>
            <summary>TransactionHistoryIterator should do untimestamped reads during rollback recovery</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="lingzhi.deng@mongodb.com">Lingzhi Deng</assignee>
                                    <reporter username="tess.avitabile@mongodb.com">Tess Avitabile</reporter>
                        <labels>
                    </labels>
                <created>Thu, 16 May 2019 14:35:20 +0000</created>
                <updated>Sun, 29 Oct 2023 22:20:59 +0000</updated>
                            <resolved>Wed, 29 May 2019 22:45:30 +0000</resolved>
                                                    <fixVersion>4.1.13</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2264546" author="xgen-internal-githook" created="Wed, 29 May 2019 22:44:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-41178&quot; title=&quot;TransactionHistoryIterator should do untimestamped reads during rollback recovery&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-41178&quot;&gt;&lt;del&gt;SERVER-41178&lt;/del&gt;&lt;/a&gt;: TransactionHistoryIterator should do untimestamped reads during rollback recovery&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/97d1373931ac47dd2bc659dfd82a0086d58cf1dd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/97d1373931ac47dd2bc659dfd82a0086d58cf1dd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2251751" author="alexander.gorrod" created="Sun, 19 May 2019 22:24:18 +0000"  >&lt;p&gt;Thanks for the write up &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=samy.lanka&quot; class=&quot;user-hover&quot; rel=&quot;samy.lanka&quot;&gt;samy.lanka&lt;/a&gt; - it&apos;s very helpful.&lt;/p&gt;</comment>
                            <comment id="2251326" author="samy.lanka" created="Fri, 17 May 2019 22:45:00 +0000"  >&lt;p&gt;I haven&apos;t had time to create a repro, but I think &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8899b34e1044b08aec7ad9f8546652456472702c/jstests/replsets/rollback_recovery_commit_transaction_before_stable_timestamp.js&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this test&lt;/a&gt; would fail consistently if we set a failpoint to hang the applier thread if the collection is the transactions table and let the other applier thread complete applying the commitTransaction first. That way, we could ensure that the latest active read timestamp is set &quot;in the future&quot; by the TransactionHistoryIterator before trying to commit the wuow for the update to the transactions table, thus ensuring that &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8899b34e1044b08aec7ad9f8546652456472702c/src/third_party/wiredtiger/src/txn/txn_timestamp.c#L624-L634&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this WT assertion&lt;/a&gt; is triggered. Note, this repro should be done on a base commit from before WT removed the assertion to make the build green again.&lt;/p&gt;</comment>
                            <comment id="2251320" author="samy.lanka" created="Fri, 17 May 2019 22:39:40 +0000"  >&lt;p&gt;Took another look with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt; and we were able to determine the actual cause of the assertion failure. &lt;/p&gt;

&lt;p&gt;The WT assertion fails not on the commitTransaction, but on the update to the config.transactions table. There is a race between the writer thread for the commitTransaction and the thread for the update to the transactions table. If the thread applying the commitTransaction goes first, it will do a timestamped read at the lastApplied timestamp while using the TransasctionHistoryIterator. But since &lt;a href=&quot;https://github.com/mongodb/mongo/blob/32ade4aa6b6a73c3620486117388908ad9ad438c/src/mongo/db/repl/rollback_impl.cpp#L235-L253&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;we do not update the lastAppliedOpTime on the rolling back node until after we&apos;re done recovering the oplog&lt;/a&gt;, the read will use a timestamp that is ahead of the common point (and therefore in the future when replaying the oplog). When the other thread tries to commit the wuow for the update to the transactions table, WiredTiger will complain that the commit timestamp is before the latest active reader.&lt;/p&gt;

&lt;p&gt;Our first idea for a solution is to set the lastAppliedOpTime on the rollback node when it recovers to the stable timestamp. &lt;/p&gt;

&lt;p&gt;Another potential solution would be for the TransactionHistoryIterator to read without a timestamp. Because it&#8217;s an oplog read, it should be safe to not make it a timestamp read.&lt;/p&gt;</comment>
                            <comment id="2250404" author="tess.avitabile" created="Fri, 17 May 2019 15:08:31 +0000"  >&lt;p&gt;That&apos;s correct, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt;. The issue described in the ticket is likely not the cause of the assertion failure. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=samy.lanka&quot; class=&quot;user-hover&quot; rel=&quot;samy.lanka&quot;&gt;samy.lanka&lt;/a&gt; will continue to investigate.&lt;/p&gt;</comment>
                            <comment id="2250237" author="judah.schvimer" created="Fri, 17 May 2019 13:57:36 +0000"  >&lt;p&gt;The &lt;tt&gt;stable_timestamp&lt;/tt&gt; is null for the entirety of initial sync because all timestamps during initial sync are inconsistent, but we advance the &lt;tt&gt;oldest_timestamp&lt;/tt&gt; with &lt;tt&gt;lastApplied&lt;/tt&gt;. &lt;/p&gt;

&lt;p&gt;We do set &lt;tt&gt;roundup_timestamps=true&lt;/tt&gt; though before committing during replication recovery and initial sync, and interestingly I now see that we do put transactions in prepare before committing them &lt;a href=&quot;https://github.com/mongodb/mongo/blob/aa9f6a202e0709adf14046cb27504864adaf732b/src/mongo/db/repl/transaction_oplog_application.cpp#L115-L129&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;there too.&lt;/a&gt; Is this not the problematic code path for this ticket?&lt;/p&gt;</comment>
                            <comment id="2250213" author="tess.avitabile" created="Fri, 17 May 2019 13:37:25 +0000"  >&lt;p&gt;Another important reason to make this change is to avoid committing an unprepared transaction behind the stable timestamp. When replaying a commit oplog entry in rollback recovery for a transaction that was prepared before the stable timestamp, the commit timestamp may also be behind the stable timestamp. Thus it&apos;s necessary to prepare the transaction with &lt;tt&gt;roundup_timestamps=true&lt;/tt&gt; before committing. (Actually, I&apos;m confused about how rollback_recovery_commit_transaction_before_stable_timestamp.js could ever succeed if we do not prepare the transaction before committing.)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=samy.lanka&quot; class=&quot;user-hover&quot; rel=&quot;samy.lanka&quot;&gt;samy.lanka&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt;, my understanding is this issue affects startup recovery as well. Does it also affect initial sync? That is, when a commit oplog entry for a prepared transaction is applied during initial sync, do we commit the transaction operations without putting them through the prepare stage and timestamp them with a time that may be behind &lt;tt&gt;oldest_timestamp&lt;/tt&gt;?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="767554">WT-4780</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.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>Fri, 17 May 2019 13:57:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 37 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1032</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, 37 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>alexander.gorrod@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
            <customfieldvalue>samy.lanka@mongodb.com</customfieldvalue>
            <customfieldvalue>tess.avitabile@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|huztlb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hugk1r:</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="2999">Repl 2019-06-03</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|huzfun:</customfieldvalue>

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