<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:25:34 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-30957] Causal consistency can be broken by migration</title>
                <link>https://jira.mongodb.org/browse/SERVER-30957</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The configuration&lt;br/&gt;
client(C), router(R), replica set shard1(S1), replica set shard2(S2), Balancer(B)&lt;/p&gt;

&lt;p&gt;The scenario:&lt;br/&gt;
The client submits the write command to the router and learns the  operationTime T1 returned from this write performed on the shard1&lt;/p&gt;

&lt;p&gt;Then the balancer initiates migration of the data from S1 to S2 that includes the written by the write.&lt;/p&gt;

&lt;p&gt;Client issues a read with (afterClusterTime = T1, readPreference=secondary) &lt;br/&gt;
The read will end up on the another shard than the write but the T1 may not be old enough as it has different oplog that may have already data in the time T1.&lt;/p&gt;

&lt;p&gt;In this case the read will return the result that will not be causally consistent with the write as it  will not have the written values.&lt;/p&gt;

&lt;p&gt;One possible solution to the issue will be modifying the afterClusterTime on the router if the requested time is less than the routing information change for the requested data.&lt;br/&gt;
I.e. shards may have different clusterTime as we can not assume that they are communicating. However the routing data change is indirect communication that the client is unaware. So the afterClusterTime should be adjusted accordingly. An analogy is moving the clock in the different time zones.&lt;/p&gt;

&lt;p&gt;Implementation details:&lt;br/&gt;
There are 2 parts:&lt;br/&gt;
1. keep the operationTime of the routing metadata refresh.&lt;/p&gt;

&lt;p&gt;2. inspect all incoming messages that have afterClusterTime and if there is a chance that the requested data has been moved then update afterClusterTime to the operationTime of the routing metadata refresh.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="423797">SERVER-30957</key>
            <summary>Causal consistency can be broken by migration</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="13203">Gone away</resolution>
                                        <assignee username="misha.tyulenev@mongodb.com">Misha Tyulenev</assignee>
                                    <reporter username="misha.tyulenev@mongodb.com">Misha Tyulenev</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Sep 2017 21:23:51 +0000</created>
                <updated>Fri, 27 Oct 2023 20:43:54 +0000</updated>
                            <resolved>Wed, 27 Sep 2017 19:06:15 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="1683562" author="dianna.hohensee" created="Wed, 27 Sep 2017 19:05:45 +0000"  >&lt;p&gt;I created &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31275&quot; title=&quot;Causal Consistency with secondary reads is broken by chunk migration commit&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31275&quot;&gt;&lt;del&gt;SERVER-31275&lt;/del&gt;&lt;/a&gt; (linked) with the new scenario, so I&apos;m closing this ticket.&lt;/p&gt;</comment>
                            <comment id="1682439" author="dianna.hohensee" created="Tue, 26 Sep 2017 19:38:44 +0000"  >&lt;p&gt;Reading the ticket summary, the scenario described is indeed safe because the shard version protocol extends to secondaries.&lt;/p&gt;

&lt;p&gt;I had a different scenario in mind for causal consistency being broken than the one you&apos;re describing, however, so I&apos;m going to have to revisit my notes/scribbles.&lt;/p&gt;</comment>
                            <comment id="1682311" author="esha.maharishi@10gen.com" created="Tue, 26 Sep 2017 18:14:18 +0000"  >&lt;p&gt;I believe &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=misha.tyulenev&quot; class=&quot;user-hover&quot; rel=&quot;misha.tyulenev&quot;&gt;misha.tyulenev&lt;/a&gt;&apos;s comment is correct: if the read is versioned, the secondary will wait until it has received the routing table updates that correspond to the fresh version, at which point it must have already received the data that corresponds to the fresh version.&lt;/p&gt;

&lt;p&gt;I think there is only one known unversioned read, which is geoNear. The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/jstests/sharding/safe_secondary_reads_drop_recreate.js&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;safe_secondary_reads_drop_recreate.js&lt;/a&gt; test specifies what kind of behavior (versioned, unversioned, or unsharded only) each read command has.&lt;/p&gt;</comment>
                            <comment id="1682138" author="misha.tyulenev" created="Tue, 26 Sep 2017 16:25:01 +0000"  >&lt;p&gt;An update based on the offline discussion with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=redbeard0531&quot; class=&quot;user-hover&quot; rel=&quot;redbeard0531&quot;&gt;redbeard0531&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=dianna.hohensee&quot; class=&quot;user-hover&quot; rel=&quot;dianna.hohensee&quot;&gt;dianna.hohensee&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt;&lt;br/&gt;
The scenario in the description should work with versioned reads, because secondary chunk aware will guarantee that the data on the secondary of S2 is consistent with the metadata on the R.&lt;br/&gt;
I.e. if the R has updated the metadata and the targeted chunk is on the S2 then the S2 secondary also must have the data (i.e the replication has already performed)&lt;br/&gt;
if R has the old metadata then it will have a stale sharding error will refresh metadata and retry.&lt;br/&gt;
Hence there is no outstanding issue in this scenario.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="433277">SERVER-31275</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_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>Tue, 26 Sep 2017 18:14:18 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 20 weeks 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>dianna.hohensee@mongodb.com</customfieldvalue>
            <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>misha.tyulenev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hte8kn:</customfieldvalue>

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

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