<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:08:07 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-45181] Rollback via refetch should set initial data timestamp to max(minvalid, local oplog&apos;s top) on rollback success.</title>
                <link>https://jira.mongodb.org/browse/SERVER-45181</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Currently&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1519-L1520&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, rollback via refetch sets the initial data timestamp to max(rollback sync source oplog&apos;s top, local oplog&apos;s top). As a result, we do 2 unnecessary things&lt;/p&gt;

&lt;p&gt;1) We perform a network call to sync source to get the oplog&apos;s top.&lt;br/&gt;
2) We delay the stable check point. Because, for a stable check point to happen, we need &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp#L431-L436&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stable ts to be &amp;gt;= initial data timestamp&lt;/a&gt;. So, if many operations happened on sync source &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1133-L1135&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;after rollback start&lt;/a&gt;, then the local min valid will be lesser than sync source oplog&apos;s top.&lt;/p&gt;

&lt;p&gt;Instead, we should set the initial data timestamp to max(local minvalid, local oplog&apos;s top). Because the rolling back node&apos;s minvalid gets updated to the sync source&apos;s &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L669&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;top of oplog value&lt;/a&gt; after refetching the documents from sync source.&lt;/p&gt;

&lt;p&gt;Note: This is just an optimization ticket.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1056668">SERVER-45181</key>
            <summary>Rollback via refetch should set initial data timestamp to max(minvalid, local oplog&apos;s top) on rollback success.</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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, 16 Dec 2019 20:07:49 +0000</created>
                <updated>Tue, 6 Dec 2022 02:39:55 +0000</updated>
                            <resolved>Mon, 30 Dec 2019 18:44:34 +0000</resolved>
                                                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2643471" author="suganthi.mani" created="Wed, 18 Dec 2019 15:20:01 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=william.schultz&quot; class=&quot;user-hover&quot; rel=&quot;william.schultz&quot;&gt;william.schultz&lt;/a&gt; Your understanding is correct. Basically, we update the rolling back node&apos;s minvalid to sync source&apos;s top of oplog  after refetching documents from sync source.&lt;br/&gt;
1) After refetching the documents from sync source and before rollback fix up writes - &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1133&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;br/&gt;
2) Another refetching of documents from sync source to update the collection metadata info - &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1314&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Both the above the calls are made before setting our initialDataTimestamp. the optimization is to remove the redundant call &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;FYI, I noticed it while reading the code.&lt;/p&gt;

</comment>
                            <comment id="2643329" author="william.schultz" created="Wed, 18 Dec 2019 14:03:08 +0000"  >&lt;p&gt;Also, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=suganthi.mani&quot; class=&quot;user-hover&quot; rel=&quot;suganthi.mani&quot;&gt;suganthi.mani&lt;/a&gt;, is there anything particular motivation for making this optimization, or was it just something you noticed when reading the code?&lt;/p&gt;</comment>
                            <comment id="2643312" author="william.schultz" created="Wed, 18 Dec 2019 14:01:34 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=suganthi.mani&quot; class=&quot;user-hover&quot; rel=&quot;suganthi.mani&quot;&gt;suganthi.mani&lt;/a&gt; If I understand correctly you are saying that we have already fetched minValid from our sync source &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1314&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, before setting our initialDataTimestamp and making another call to fetch the last operation from our sync source &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/a484dd081e3d39e4f9034075f19f75f825c7e5ea/src/mongo/db/repl/rollback_source_impl.cpp#L69&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;RollbackSourceImpl::getLastOperation&lt;/a&gt; function is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/59152df7655101ee551d6432727170b42fcd136f/src/mongo/db/repl/rs_rollback.cpp#L834&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;called inside&lt;/a&gt; &lt;tt&gt;checkRbidAndUpdateMinValid&lt;/tt&gt; to set our minValid, so the optimization is to get rid of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d38d7026a4fcd5e524b3d35e405d49e4ac8989c3/src/mongo/db/repl/rs_rollback.cpp#L1512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the latter,&lt;/a&gt; redundant call to &lt;tt&gt;getLastOperation&lt;/tt&gt; and use the existing value of minValid.&lt;/p&gt;</comment>
                            <comment id="2636200" author="daniel.gottlieb@10gen.com" created="Tue, 17 Dec 2019 14:05:59 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Because local minvalid is none other than the rollback sync source oplog&apos;s top before the rollback start.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;del&gt;I believe this is what the previous logic did resulting in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38925&quot; title=&quot;Rollback via refetch can cause _id duplication when enableMajorityReadConcern:false&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38925&quot;&gt;&lt;del&gt;SERVER-38925&lt;/del&gt;&lt;/a&gt;. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=william.schultz&quot; class=&quot;user-hover&quot; rel=&quot;william.schultz&quot;&gt;william.schultz&lt;/a&gt; left a very good write-up. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=suganthi.mani&quot; class=&quot;user-hover&quot; rel=&quot;suganthi.mani&quot;&gt;suganthi.mani&lt;/a&gt; please take a look at that ticket to see if your intended change with this ticket would reintroduce that bug.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;My interpretation was incorrect. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=suganthi.mani&quot; class=&quot;user-hover&quot; rel=&quot;suganthi.mani&quot;&gt;suganthi.mani&lt;/a&gt; explained that the local/rolling back node&apos;s minvalid is updated to the sync source&apos;s top of oplog value after refetching documents. I believe this optimization is safe.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="669232">SERVER-38925</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.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>Tue, 17 Dec 2019 14:05:59 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 8 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_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, 8 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-repl</customfieldvalue>
            <customfieldvalue>daniel.gottlieb@mongodb.com</customfieldvalue>
            <customfieldvalue>suganthi.mani@mongodb.com</customfieldvalue>
            <customfieldvalue>william.schultz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hwbjon:</customfieldvalue>

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

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