<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:49:09 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-38505] For pv1, to determine if the oplog  entries are applied  out of order, we should compare both  the term and timestamp of firstOpTimeInBatch and lastAppliedOpTimeAtStartOfBatch </title>
                <link>https://jira.mongodb.org/browse/SERVER-38505</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Consider the below upgrade-&amp;gt;downgrade-&amp;gt;upgrade (pv1-&amp;gt;pv0-&amp;gt;pv1 ) sequence.&lt;/p&gt;

&lt;p&gt;1) Start a replica set in pv1.&lt;/p&gt;

&lt;p&gt;2) Insert some document in pv1 (for term =1)&lt;/p&gt;

&lt;p&gt;3) Downgrade to pv0 while the secondaries are still replicating the documents from previous pv1 (term =1)&lt;/p&gt;

&lt;p&gt;4) Upgrade to pv1 before the secondaries downgrade to pv0.&lt;/p&gt;

&lt;p&gt;5) Secondaries learns the new term (term 0) from the heartbeat received from primary while their lastAppliedOpTimes are still in term 1.&lt;/p&gt;

&lt;p&gt;6) Lets say, on secondaries, the node&apos;s lastAppliedOpTime &amp;amp; lastFetchedOpTime is (100, t:1). And, when they try to replicate the oplog entries from primary, it adds a filter in the find command to&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/70098eb6ececc680a61bc5dad608b43d3885a07c/src/mongo/db/repl/oplog_fetcher.cpp#L362&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;fetch only the oplog entries&#160; having timestamp greater than or equal to&#160; our lastFetchedOpTime&apos;s timestamp &quot;100&quot;.&lt;/a&gt;&#160;When secondaries receive a batch combining oplog entries from step 2(pv1), step3 (pv0) and step4(pv1) (say&#160;(100, t:1)| (101, t:1) || (102, t:-1) || (103, t:0)), we apply those entries and try to move &lt;a href=&quot;https://github.com/mongodb/mongo/blob/70098eb6ececc680a61bc5dad608b43d3885a07c/src/mongo/db/repl/replication_coordinator_impl.cpp#L1082&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;forward our lastAppliedOpTime&lt;/a&gt;&#160;to the last entry in the batch (103,t:0). But, unfortunately, &lt;b&gt;we can&apos;t move forward our lastAppliedOpTime&lt;/b&gt; as (103,t:0) &amp;lt;&#160;(100, t:1).&lt;/p&gt;

&lt;p&gt;7) Assume, that secondary receives next batch starting with (104, t:0). Before applying the batch, we verify that the &lt;b&gt;oplog entries are not applied out of order&lt;/b&gt; by checking that &lt;a href=&quot;https://github.com/mongodb/mongo/blob/70098eb6ececc680a61bc5dad608b43d3885a07c/src/mongo/db/repl/sync_tail.cpp#L914&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;first entry&apos;s optime in the batch&#160; is lesser or equal to the lastAppliedOptime&lt;/a&gt;.&#160; Since (104, t:0) is less than our lastAppliedOpTime (100, t:1), it leads to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/70098eb6ececc680a61bc5dad608b43d3885a07c/src/mongo/db/repl/sync_tail.cpp#L914-L923&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;fassert failure&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&#160;Here we see 2 problems&lt;/p&gt;

&lt;p&gt;&#160; &#160; 1) Step6 where the lastAppliedOpTime is not moving forward because a batch has oplog entries (from previous pv1, pv0, pv1).&lt;/p&gt;

&lt;p&gt;&#160; &#160; 2) Step7 where we get fassert failure stating that oplog entries are applied out of order.&lt;/p&gt;

&lt;p&gt;Problem 2 won&apos;t occur as we would invariant during step 6 while trying to move forward our lastAppliedOptime (see&#160;&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;).&lt;/p&gt;</description>
                <environment></environment>
        <key id="648967">SERVER-38505</key>
            <summary>For pv1, to determine if the oplog  entries are applied  out of order, we should compare both  the term and timestamp of firstOpTimeInBatch and lastAppliedOpTimeAtStartOfBatch </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="2">Won&apos;t Fix</resolution>
                                        <assignee username="backlog-server-repl">Backlog - Replication Team</assignee>
                                    <reporter username="suganthi.mani@mongodb.com">Suganthi Mani</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 Dec 2018 18:28:47 +0000</created>
                <updated>Tue, 6 Dec 2022 03:11:03 +0000</updated>
                            <resolved>Thu, 30 May 2019 20:27:01 +0000</resolved>
                                    <version>3.6.9</version>
                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="2265964" author="tess.avitabile" created="Thu, 30 May 2019 20:27:01 +0000"  >&lt;p&gt;We have not seen this in the field. Our documentation advises users to ensure that an oplog entry from the new protocol version has replicated to all nodes before doing a second change in protocol version.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="559734">SERVER-35608</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="649305">DOCS-12253</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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25128"><![CDATA[Replication]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 30 May 2019 20:27:01 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 36 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>backlog-server-repl</customfieldvalue>
            <customfieldvalue>suganthi.mani@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|huffjz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu5jhz:</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_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|huf1tb:</customfieldvalue>

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