<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:23:48 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-50869] Background sync may erroneously set applied-through during step-up</title>
                <link>https://jira.mongodb.org/browse/SERVER-50869</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The bgsync _producer() method runs in a loop until stop() is called asynchronously.&lt;/p&gt;

&lt;p&gt;If, after this critical section is run&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L425&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L425&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;stop() is called (as it would be during step-up), then before &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L441&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L441&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;is reached, the primary clears the applied-through time (as it normally does), the applied-through time will be re-set to the last applied optime.  This state will persist until the next time the node becomes secondary and applies a batch.  If the node restarts during that time, it will invariant and need to be re-synced.&lt;/p&gt;

&lt;p&gt;We need to hold the mutex and ensure the producer is running while checking if applied-through is clear and setting it.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1469941">SERVER-50869</key>
            <summary>Background sync may erroneously set applied-through during step-up</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="samy.lanka@mongodb.com">Samyukta Lanka</assignee>
                                    <reporter username="matthew.russotto@mongodb.com">Matthew Russotto</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Sep 2020 18:57:43 +0000</created>
                <updated>Sun, 29 Oct 2023 22:03:22 +0000</updated>
                            <resolved>Wed, 7 Oct 2020 22:49:33 +0000</resolved>
                                    <version>4.2.8</version>
                                    <fixVersion>4.9.0</fixVersion>
                    <fixVersion>4.4.2</fixVersion>
                    <fixVersion>4.2.12</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="3504068" author="xgen-internal-githook" created="Tue, 24 Nov 2020 18:25:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Samy Lanka&apos;, &apos;email&apos;: &apos;samy.lanka@mongodb.com&apos;, &apos;username&apos;: &apos;lankas&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50869&quot; title=&quot;Background sync may erroneously set applied-through during step-up&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50869&quot;&gt;&lt;del&gt;SERVER-50869&lt;/del&gt;&lt;/a&gt; Fix race condition in bgsync when clearing appliedThrough during stepUp&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 4fbb1f65e2ad712f6b4e761d3145191e744b1e7d)&lt;br/&gt;
(cherry picked from commit c4fd5f392d7e71fe49c84d8b939fa72f4809e48e)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6588e91769e070e60508ced4412e7db8f38f153c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6588e91769e070e60508ced4412e7db8f38f153c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3461190" author="xgen-internal-githook" created="Fri, 23 Oct 2020 14:40:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Samy Lanka&apos;, &apos;email&apos;: &apos;samy.lanka@mongodb.com&apos;, &apos;username&apos;: &apos;lankas&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50869&quot; title=&quot;Background sync may erroneously set applied-through during step-up&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50869&quot;&gt;&lt;del&gt;SERVER-50869&lt;/del&gt;&lt;/a&gt; Fix race condition in bgsync when clearing appliedThrough during stepUp&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 4fbb1f65e2ad712f6b4e761d3145191e744b1e7d)&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c4fd5f392d7e71fe49c84d8b939fa72f4809e48e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c4fd5f392d7e71fe49c84d8b939fa72f4809e48e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3433355" author="xgen-internal-githook" created="Wed, 7 Oct 2020 22:04:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Samy Lanka&apos;, &apos;email&apos;: &apos;samy.lanka@mongodb.com&apos;, &apos;username&apos;: &apos;lankas&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50869&quot; title=&quot;Background sync may erroneously set applied-through during step-up&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50869&quot;&gt;&lt;del&gt;SERVER-50869&lt;/del&gt;&lt;/a&gt; Fix race condition in bgsync when clearing appliedThrough during stepUp&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/4fbb1f65e2ad712f6b4e761d3145191e744b1e7d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/4fbb1f65e2ad712f6b4e761d3145191e744b1e7d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3423824" author="samy.lanka" created="Fri, 2 Oct 2020 20:48:26 +0000"  >&lt;p&gt;Holding the mutex while trying to read the appliedThrough doc can cause deadlocks because of the order in which we acquire locks.&lt;/p&gt;

&lt;p&gt;For example, if a node is in the process of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/84494ea46f70d64e181042ed75a0118143b16881/src/mongo/db/repl/replication_coordinator_impl.cpp#L5012&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;transitioning from RECOVERING to SECONDARY&lt;/a&gt;, it will be &lt;a href=&quot;https://github.com/mongodb/mongo/blob/84494ea46f70d64e181042ed75a0118143b16881/src/mongo/db/repl/replication_coordinator_impl.cpp#L4956&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;holding the RSTL in X mode&lt;/a&gt; already when it tries to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/84494ea46f70d64e181042ed75a0118143b16881/src/mongo/db/repl/bgsync.cpp#L848&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;take the bgsync mutex&lt;/a&gt; while clearing the node&apos;s sync source.&lt;/p&gt;

&lt;p&gt;That can happen while the bgsync thread is holding the mutex while waiting for the collection lock (meaning it also needs to get the RSTL in a conflicting mode) when &lt;a href=&quot;https://github.com/mongodb/mongo/blob/84494ea46f70d64e181042ed75a0118143b16881/src/mongo/db/repl/bgsync.cpp#L488&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;trying to read the applied through document&lt;/a&gt;, which is a deadlock.&lt;/p&gt;</comment>
                            <comment id="3399693" author="siyuan.zhou@10gen.com" created="Thu, 17 Sep 2020 18:24:08 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=samy.lanka&quot; class=&quot;user-hover&quot; rel=&quot;samy.lanka&quot;&gt;samy.lanka&lt;/a&gt;, it sounds like the proposed solution holds the mutex while reading the applied-through document on disk. It sounds error-prone. When working on this, could you please confirm that&apos;s fine or figure out an alternative solution.&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="1959081">SERVER-62379</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.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>
    
                        </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>Thu, 17 Sep 2020 18:20:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 11 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, 11 weeks, 1 day 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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>matthew.russotto@mongodb.com</customfieldvalue>
            <customfieldvalue>samy.lanka@mongodb.com</customfieldvalue>
            <customfieldvalue>siyuan.zhou@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hy53yv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxoqzz:</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="4249">Repl 2020-10-05</customfieldvalue>
    <customfieldvalue id="4311">Repl 2020-10-19</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|hy4q87:</customfieldvalue>

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