<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:40:22 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-35608] Invariant that term from lastAppliedOptime is never greater than our current term</title>
                <link>https://jira.mongodb.org/browse/SERVER-35608</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;As a sanity check in case a user manually modifies their local database in a way that puts them into this state&lt;/p&gt;</description>
                <environment></environment>
        <key id="559734">SERVER-35608</key>
            <summary>Invariant that term from lastAppliedOptime is never greater than our current term</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="suganthi.mani@mongodb.com">Suganthi Mani</assignee>
                                    <reporter username="spencer@mongodb.com">Spencer Brody</reporter>
                        <labels>
                            <label>neweng</label>
                    </labels>
                <created>Thu, 14 Jun 2018 22:06:35 +0000</created>
                <updated>Sun, 29 Oct 2023 22:30:46 +0000</updated>
                            <resolved>Tue, 11 Dec 2018 17:11:08 +0000</resolved>
                                                    <fixVersion>3.4.19</fixVersion>
                    <fixVersion>3.6.11</fixVersion>
                    <fixVersion>4.0.6</fixVersion>
                    <fixVersion>4.1.7</fixVersion>
                                    <component>Replication</component>
                                        <votes>2</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="2124244" author="xgen-internal-githook" created="Wed, 23 Jan 2019 16:11:17 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;smani87&apos;, &apos;email&apos;: &apos;suganthi.mani@mongodb.com&apos;, &apos;name&apos;: &apos;Suganthi Mani&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35608&quot; title=&quot;Invariant that term from lastAppliedOptime is never greater than our current term&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35608&quot;&gt;&lt;del&gt;SERVER-35608&lt;/del&gt;&lt;/a&gt; Added an invariant to make sure that optime with lower and higher term than the current lastAppliedOpTime will have lower and higher timestamp respectively. And, provided both the optime and the current lastAppliedOpTime terms are in pv1.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit b91aaa5bbc54a176cc61e5051cb6be857747b068)&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1ce959ee43baeaa6679d8b50c2e80d4650e94e3a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1ce959ee43baeaa6679d8b50c2e80d4650e94e3a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2109389" author="xgen-internal-githook" created="Wed, 9 Jan 2019 02:03:22 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;smani87&apos;, &apos;email&apos;: &apos;suganthi.mani@mongodb.com&apos;, &apos;name&apos;: &apos;Suganthi Mani&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35608&quot; title=&quot;Invariant that term from lastAppliedOptime is never greater than our current term&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35608&quot;&gt;&lt;del&gt;SERVER-35608&lt;/del&gt;&lt;/a&gt; Added an invariant to make sure that optime with lower and higher term than the current lastAppliedOpTime will have lower and higher timestamp respectively. And, provided both the optime and the current lastAppliedOpTime terms are in pv1.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit b91aaa5bbc54a176cc61e5051cb6be857747b068)&lt;br/&gt;
Branch: v3.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ee1e46cee281560bf13529c6db75cfb317703780&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ee1e46cee281560bf13529c6db75cfb317703780&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2109360" author="xgen-internal-githook" created="Tue, 8 Jan 2019 23:56:34 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;smani87&apos;, &apos;email&apos;: &apos;suganthi.mani@mongodb.com&apos;, &apos;name&apos;: &apos;Suganthi Mani&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35608&quot; title=&quot;Invariant that term from lastAppliedOptime is never greater than our current term&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35608&quot;&gt;&lt;del&gt;SERVER-35608&lt;/del&gt;&lt;/a&gt; Added an invariant to make sure that optime with lower and higher term than the current lastAppliedOpTime will have lower and higher timestamp respectively. And, provided both the optime and the current lastAppliedOpTime terms are in pv1.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit b91aaa5bbc54a176cc61e5051cb6be857747b068)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/938f2b25a50a4c907b736ffe81546ae4c42e4f0c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/938f2b25a50a4c907b736ffe81546ae4c42e4f0c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2087194" author="xgen-internal-githook" created="Tue, 11 Dec 2018 17:07:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Suganthi Mani&apos;, &apos;email&apos;: &apos;suganthi.mani@mongodb.com&apos;, &apos;username&apos;: &apos;smani87&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35608&quot; title=&quot;Invariant that term from lastAppliedOptime is never greater than our current term&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35608&quot;&gt;&lt;del&gt;SERVER-35608&lt;/del&gt;&lt;/a&gt; Added an invariant to make sure that optime with lower and higher term than the current lastAppliedOpTime will have lower and higher timestamp respectively. And, provided both the optime and the current lastAppliedOpTime terms are in pv1.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/b91aaa5bbc54a176cc61e5051cb6be857747b068&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/b91aaa5bbc54a176cc61e5051cb6be857747b068&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2087144" author="suganthi.mani" created="Tue, 11 Dec 2018 16:40:11 +0000"  >&lt;p&gt;We considered adding the invariant &quot;lastAppliedOptime&apos;s term should be always less than or equal to our current term&quot; in 2 places&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/c06a21f2efa258f8ea13ad1cda900b537ad00a94/src/mongo/db/repl/replication_coordinator_impl.cpp#L1148&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ReplicationCoordinatorImpl::_setMyLastAppliedOpTime_inlock&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/c06a21f2efa258f8ea13ad1cda900b537ad00a94/src/mongo/db/repl/replication_coordinator_impl.cpp#L641&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ReplicationCoordinatorImpl::_finishLoadLocalConfig&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Adding the invariant in ReplicationCoordinatorImpl::_setMyLastAppliedOpTime_inlock may cause failure for below valid cases at which the lastAppliedOptime&apos;s term can be greater than the current term.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Downgrade (pv1-&amp;gt; pv0)&lt;br/&gt;
 On secondaries, learning the term via heartbeat and the oplog application is asynchronous. Consider the case, where the secondaries learnt their current term -1 (i.e) pv0&#160; via the heartbeat response from primary followed by oplog application of a batch having oplog entries from its previous protocol version pv1 where the term is greater than -1.&#160;&lt;/li&gt;
	&lt;li&gt;Upgrade (pv0 -&amp;gt; pv1)&lt;br/&gt;
 Consider the case, where the secondaries apply the oplog entries( having optime with term equal to 0) from current protocol version pv1 followed by the heartbeat response which inform secondary about the new term 0 (i.e) pv1.&lt;/li&gt;
	&lt;li&gt;Downgrade, upgrade (pv1-&amp;gt;pv0-&amp;gt;pv1)&lt;br/&gt;
 Consider the case, where the secondaries learnt their current term 0 (i.e) pv1&#160; via the heartbeat response from primary while still applying the oplog entries from the first protocol version pv1 which will have optime &amp;gt;=1.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Adding the invariant only in ReplicationCoordinatorImpl::_finishLoadLocalConfig may cause failure for below valid downgrade sequence at which the lastAppliedOptime&apos;s term can be greater than the current term.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Start a replica set in pv1.&lt;/li&gt;
	&lt;li&gt;Insert some document in pv1 (for term =1).&lt;/li&gt;
	&lt;li&gt;Downgrade to pv0 while secondary is still replicating the documents from previous protocol version pv1 (term =1)&lt;/li&gt;
	&lt;li&gt;Secondary learn its new term 0 (i.e) pv0 via heartbeat response and persists the information in&#160; &quot;system.replset&quot; collection.&lt;/li&gt;
	&lt;li&gt;Secondary crashes.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;When secondary reboots, the current term will be -1(pv0) with the last entry in the &quot;oplog&quot; collection from pv1 (which will be set as our lastAppliedOpTime). This is similar to the problem described in&#160;&lt;b&gt;HELP-6818&#160;.&lt;/b&gt;&#160; It&apos;s tough for us to distinguish between the manual and the self induced case.&#160;&lt;/p&gt;

&lt;p&gt;In order to prevent from data loss for the cases like in&#160;&lt;b&gt;HELP-6818&#160;,&lt;/b&gt;&#160;&lt;b&gt;our new fix is to fail at the time of data insertion instead of failing at the time of node&apos;s startup phase.&lt;/b&gt; The contract we have right now is that, in pv1, oplog entries are ordered by non-decreasing term and strictly increasing timestamp. So, added an invariant such that that optime with lower and higher term than the current lastAppliedOpTime will have lower and higher timestamp respectively. And, provided both the optime and the current lastAppliedOpTime terms are in pv1.&lt;/p&gt;</comment>
                            <comment id="2073170" author="greg.mckeon" created="Tue, 27 Nov 2018 19:10:11 +0000"  >&lt;p&gt;This work revealed bug(s) in upgrade/downgrade/upgrade of protocol version.&lt;/p&gt;</comment>
                            <comment id="2063543" author="suganthi.mani" created="Thu, 15 Nov 2018 18:38:24 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=greg.mckeon&quot; class=&quot;user-hover&quot; rel=&quot;greg.mckeon&quot;&gt;greg.mckeon&lt;/a&gt;, aiming for the patch to be in CR by EOD.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="642035">SERVER-38366</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="648914">SERVER-38504</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="648967">SERVER-38505</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>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.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>
    <customfieldvalue key="14340"><![CDATA[v3.4]]></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[[500A000000auWdlIAE]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 13 Nov 2018 16:28:06 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 3 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-1185</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 3 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg.mckeon@mongodb.com</customfieldvalue>
            <customfieldvalue>spencer@mongodb.com</customfieldvalue>
            <customfieldvalue>suganthi.mani@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu0ob3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr8exr:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="2543">Repl 2018-11-05</customfieldvalue>
    <customfieldvalue id="2605">Repl 2018-11-19</customfieldvalue>
    <customfieldvalue id="2606">Repl 2018-12-03</customfieldvalue>
    <customfieldvalue id="2607">Repl 2018-12-17</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|hu0akf:</customfieldvalue>

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