<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:14:58 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-47695] Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint</title>
                <link>https://jira.mongodb.org/browse/SERVER-47695</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If a thread does a write that gets rolled back during stepdown, its client can have&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/0a5ff5f074b671308c843b4ba6d7195b2591e7d4/src/mongo/db/repl/repl_client_info.h#L110&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;_lastOp&lt;/a&gt;&#160;with timestamp higher than the timestamp of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0a5ff5f074b671308c843b4ba6d7195b2591e7d4/src/mongo/db/repl/repl_client_info.h#L91-L100&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;system last opTime&lt;/a&gt;&#160;(if the wallclock on primary is behind the wallclock on the node the threads runs on). So if after stepdown the thread sends a write command to itself, the command will fail&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/9f01b5403b3eb01f4d8f437fe0ef99910130b7cc/src/mongo/db/repl/oplog.cpp#L254-L265&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the ReplicationCoordinator check when trying to write an oplog entry&lt;/a&gt;&#160;but the NotMaster error will get&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/c1fad54e1821500fec2121d2e31a591069bc053d/src/mongo/db/service_entry_point_common.cpp#L818-L826&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;caught in this block in the ServiceEntryPoint::runCommandImpl&lt;/a&gt;. Since the command is a noop, the client&apos;s lastOp will be&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c53fe70e2d6e70b56b3f6a161a74a63d7490cdc/src/mongo/db/service_entry_point_mongod.cpp#L143&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;set to last system opTime&lt;/a&gt;. So after the&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c53fe70e2d6e70b56b3f6a161a74a63d7490cdc/src/mongo/db/write_concern.cpp#L347&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;wait&lt;/a&gt;&#160;for writeConcern&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/04c2af54571329789ad3742589d28802f75882b3/src/mongo/db/repl/replication_coordinator_impl.cpp#L1947-L1955&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;fails&lt;/a&gt;,&#160;the NotMaster error will get propagated up, and the operation will hit&#160;the&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/463cc815528b42c3c2f81dc7137cc27f7e7cc974/src/mongo/db/service_entry_point_common.cpp#L414&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;invariant&lt;/a&gt;&#160;operationTime &amp;gt;= startOperations when trying&#160;&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/c1fad54e1821500fec2121d2e31a591069bc053d/src/mongo/db/service_entry_point_common.cpp#L1260&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;append operationTime to the response&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1325241">SERVER-47695</key>
            <summary>Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint</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="13201">Fixed</resolution>
                                        <assignee username="lingzhi.deng@mongodb.com">Lingzhi Deng</assignee>
                                    <reporter username="cheahuychou.mao@mongodb.com">Cheahuychou Mao</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Apr 2020 04:35:30 +0000</created>
                <updated>Sun, 29 Oct 2023 22:09:12 +0000</updated>
                            <resolved>Mon, 4 May 2020 16:43:59 +0000</resolved>
                                                    <fixVersion>4.0.19</fixVersion>
                    <fixVersion>4.2.7</fixVersion>
                    <fixVersion>3.6.19</fixVersion>
                    <fixVersion>4.4.0-rc4</fixVersion>
                    <fixVersion>4.7.0</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3119519" author="xgen-internal-githook" created="Wed, 27 May 2020 02:30:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47695&quot; title=&quot;Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47695&quot;&gt;&lt;del&gt;SERVER-47695&lt;/del&gt;&lt;/a&gt;: Don&apos;t set lastOp for client backwards in terms of timestamp after rollback&lt;/p&gt;

&lt;p&gt;(cherry picked from commit bd579c0d3f2583c2af7dcd98c7f6cfc55009b406)&lt;br/&gt;
(cherry picked from commit bf3227e11dd689044ff4555c823c682899f41cf9)&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d7ad6f6c417e711218729f2faee7fc59a19a5e5d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d7ad6f6c417e711218729f2faee7fc59a19a5e5d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3119484" author="xgen-internal-githook" created="Wed, 27 May 2020 01:57:22 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47695&quot; title=&quot;Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47695&quot;&gt;&lt;del&gt;SERVER-47695&lt;/del&gt;&lt;/a&gt;: Don&apos;t set lastOp for client backwards in terms of timestamp after rollback&lt;/p&gt;

&lt;p&gt;(cherry picked from commit bd579c0d3f2583c2af7dcd98c7f6cfc55009b406)&lt;br/&gt;
(cherry picked from commit bf3227e11dd689044ff4555c823c682899f41cf9)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2794691b14a8dedc25b136a03fe2e89fa9c8fd6c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2794691b14a8dedc25b136a03fe2e89fa9c8fd6c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3072362" author="xgen-internal-githook" created="Wed, 6 May 2020 18:11:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47695&quot; title=&quot;Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47695&quot;&gt;&lt;del&gt;SERVER-47695&lt;/del&gt;&lt;/a&gt;: Don&apos;t set lastOp for client backwards in terms of timestamp after rollback&lt;/p&gt;

&lt;p&gt;(cherry picked from commit bd579c0d3f2583c2af7dcd98c7f6cfc55009b406)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/bf3227e11dd689044ff4555c823c682899f41cf9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/bf3227e11dd689044ff4555c823c682899f41cf9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3072355" author="xgen-internal-githook" created="Wed, 6 May 2020 18:06:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47695&quot; title=&quot;Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47695&quot;&gt;&lt;del&gt;SERVER-47695&lt;/del&gt;&lt;/a&gt;: Don&apos;t set lastOp for client backwards in terms of timestamp after rollback&lt;/p&gt;

&lt;p&gt;(cherry picked from commit bd579c0d3f2583c2af7dcd98c7f6cfc55009b406)&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5fdc82329bb92d7887e6b6b57725e52d668b1823&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5fdc82329bb92d7887e6b6b57725e52d668b1823&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3067454" author="xgen-internal-githook" created="Mon, 4 May 2020 16:42:07 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Lingzhi Deng&apos;, &apos;email&apos;: &apos;lingzhi.deng@mongodb.com&apos;, &apos;username&apos;: &apos;ldennis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47695&quot; title=&quot;Write commands run by threads that can survive rollback can fail operationTime invariant in ServiceEntryPoint&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47695&quot;&gt;&lt;del&gt;SERVER-47695&lt;/del&gt;&lt;/a&gt;: Don&apos;t set lastOp for client backwards in terms of timestamp after rollback&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/bd579c0d3f2583c2af7dcd98c7f6cfc55009b406&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/bd579c0d3f2583c2af7dcd98c7f6cfc55009b406&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3050846" author="lingzhi.deng" created="Wed, 22 Apr 2020 14:05:22 +0000"  >&lt;p&gt;Ok, so it seems that the problem was because the invariant only compares the timestamp not OpTime.&lt;/p&gt;</comment>
                            <comment id="3050354" author="lingzhi.deng" created="Wed, 22 Apr 2020 05:13:47 +0000"  >&lt;blockquote&gt;&lt;p&gt;Since the command is a noop, the client&apos;s lastOp will be&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/5c53fe70e2d6e70b56b3f6a161a74a63d7490cdc/src/mongo/db/service_entry_point_mongod.cpp#L143&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;set to last system opTime&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;But we already have logic in &lt;tt&gt;setLastOpToSystemLastOpTime&lt;/tt&gt; that &lt;a href=&quot;https://github.com/mongodb/mongo/blob/759af0dcb8dd4e13fdcdb8a77907b6dabaf7101e/src/mongo/db/repl/repl_client_info.cpp#L100-L104&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;handles rollback and prevents the &lt;tt&gt;_lastOp&lt;/tt&gt; from going backwards&lt;/a&gt;. So I don&apos;t see how it would hit the invariant. Can you elaborate?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="420429">SERVER-30842</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>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="18953"><![CDATA[v4.4]]></customfieldvalue>
    <customfieldvalue key="16775"><![CDATA[v4.2]]></customfieldvalue>
    <customfieldvalue key="15640"><![CDATA[v4.0]]></customfieldvalue>
    <customfieldvalue key="15141"><![CDATA[v3.6]]></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>Wed, 22 Apr 2020 05:13:47 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 37 weeks, 1 day 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></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>
                            3 years, 37 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>

                        </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>cheahuychou.mao@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxh1av:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hx4gsf:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3882">Repl 2020-05-18</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|hxgnk7:</customfieldvalue>

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