<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:17:35 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-48603] Rollback via refetch can result in out of order timestamps</title>
                <link>https://jira.mongodb.org/browse/SERVER-48603</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This is a hypothetical that I&apos;m documenting for investigation. The idea was inspired by &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;&apos;s discovery in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48518&quot; title=&quot;Rollback via refetch (EMRC = false) can make readers to see the rolled back data even after the rollback node catches up to primary.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48518&quot;&gt;&lt;del&gt;SERVER-48518&lt;/del&gt;&lt;/a&gt;. Unlike &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48518&quot; title=&quot;Rollback via refetch (EMRC = false) can make readers to see the rolled back data even after the rollback node catches up to primary.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48518&quot;&gt;&lt;del&gt;SERVER-48518&lt;/del&gt;&lt;/a&gt;, this out of order timestamp condition is only problematic when WT is running with durable history. &lt;/p&gt;

&lt;p&gt;Consider the following sequence where a primary accepts some writes, rolls them back, and then as a secondary replicates writes that use the same key-space.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;As primary&lt;/li&gt;
	&lt;li&gt;Insert {_id: 1, doc: &quot;A&quot;} @ TS 20 RecordId(5)&lt;/li&gt;
	&lt;li&gt;Delete {_id: 1, doc: &quot;A&quot;} @ TS 30&lt;/li&gt;
	&lt;li&gt;Stepdown, perform Rollback via refetch to back to TS 10&lt;/li&gt;
	&lt;li&gt;Rolls back delete &amp;#8211; refetch {_id: 1} from sync source. The document does not exist &amp;#8211; do nothing&lt;/li&gt;
	&lt;li&gt;Rolls back insert &amp;#8211; the {_id: 1} document doesn&apos;t exist in the index &amp;#8211; do nothing&lt;/li&gt;
	&lt;li&gt;Become secondary&lt;/li&gt;
	&lt;li&gt;Replicate Insert {_id: 1, doc: &quot;B&quot;} @ TS 15 &lt;del&gt;RecordId(5)&lt;/del&gt; RecordId(6)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In this state, there are two update chains with out of order timestamps:&lt;br/&gt;
&lt;del&gt;RecordStore: RecordId(5) V3(15) -&amp;gt; V2(30) -&amp;gt; V1(20)&lt;/del&gt; See comments&lt;br/&gt;
Index: KeyString(1) V3(15) -&amp;gt; V2(30) -&amp;gt; V1(20)&lt;/p&gt;

&lt;p&gt;Note the out of order updates in the RecordStore case are not alleviated by &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48453&quot; title=&quot;Lazily initialize a record store&amp;#39;s auto incrementing counter on deletes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48453&quot;&gt;&lt;del&gt;SERVER-48453&lt;/del&gt;&lt;/a&gt; as this problem would still exist without lazy-initialization.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1372845">SERVER-48603</key>
            <summary>Rollback via refetch can result in out of order timestamps</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-server-repl">Backlog - Replication Team</assignee>
                                    <reporter username="daniel.gottlieb@mongodb.com">Daniel Gottlieb</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Jun 2020 02:30:06 +0000</created>
                <updated>Tue, 6 Dec 2022 02:25:03 +0000</updated>
                                                                            <component>Replication</component>
                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="3195411" author="daniel.gottlieb@10gen.com" created="Mon, 8 Jun 2020 17:38:43 +0000"  >&lt;p&gt;I don&apos;t know if that&apos;s actually a thing.  &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alexander.gorrod&quot; class=&quot;user-hover&quot; rel=&quot;alexander.gorrod&quot;&gt;alexander.gorrod&lt;/a&gt;?&lt;/p&gt;</comment>
                            <comment id="3195388" author="judah.schvimer" created="Mon, 8 Jun 2020 17:32:18 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=daniel.gottlieb&quot; class=&quot;user-hover&quot; rel=&quot;daniel.gottlieb&quot;&gt;daniel.gottlieb&lt;/a&gt;, would it be possible to turn off durable history when using eMRC=false?&lt;/p&gt;</comment>
                            <comment id="3192573" author="daniel.gottlieb@10gen.com" created="Fri, 5 Jun 2020 15:53:49 +0000"  >&lt;p&gt;I misdiagnosed the problem on the record store. Because RollbackViaRefetch does not restart the catalog, the next id doesn&apos;t reset to an earlier value in this case. So the problem within a process lifetime is limited to the &lt;tt&gt;_id&lt;/tt&gt; index. That can be solved with a MongoDB only fix of regenerating the &lt;tt&gt;_id&lt;/tt&gt; index key and throwing an untimestamped delete on top of the update chain.&lt;/p&gt;</comment>
                            <comment id="3191597" author="daniel.gottlieb@10gen.com" created="Fri, 5 Jun 2020 03:12:38 +0000"  >&lt;p&gt;Brainstorming some solutions (including the bad ones). The common goal across all of them is either:&lt;br/&gt;
A) Prune all of the update chains in front of the common point.&lt;br/&gt;
B) Write a 0-timestamped tombstone on each WT document touched in the operations being rolled back. Note: only writing tombstones are of interest. If the correct post-state is a non-tombstone, rollback via refetch is guaranteed to bring the data into that state.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Disallow eMRC=false (effectively pruning, A)&lt;br/&gt;
Uncertain if this will happen in 4.4&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;After RvR force back stable_timestamp to the common point (that&apos;s already done). Call rollback_to_stable (A)&lt;br/&gt;
Does this work? Would this also fix &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;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;If RvRefetching the delete finds nothing - can read at TS(delete)-1 to find the record and restore it with a 0 timestamp write. (B)&lt;br/&gt;
If TS(delete) &amp;gt; oldest_timestamp, this works?&lt;br/&gt;
If TS(delete) &amp;lt; oldest_timestamp, no guarantee WT has wiped the history:&lt;br/&gt;
Try after forcing back the oldest_timestamp to the common point? Only works if WT has kept the index entry. If the index entry was pruned, but not the record itself, the record will dangle.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;If the above strategy when rolling back the delete doesn&apos;t work, RvRefetching the insert, generate the _id keystring, insert + delete it at TS(0) (B)&lt;br/&gt;
Don&apos;t know the RecordId -&amp;gt; Doesn&apos;t work on the record store document, nor secondary indexes&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;(Eagerly) Crash (A)&lt;br/&gt;
Works iff calling rollback_to_stable works?&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Optimistically proceed with &quot;unstable&quot; update chains. Have WT WT_ROLLBACK/WriteConflictException on out of order timestamps. (A)&lt;br/&gt;
Would work if the node became a primary. Would (lazily) crash a secondary.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1368137">SERVER-48518</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1364075">SERVER-48453</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1375406">WT-6388</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>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>Mon, 8 Jun 2020 17:32:18 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 35 weeks, 2 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1769</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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 35 weeks, 2 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>daniel.gottlieb@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxolmv:</customfieldvalue>

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

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