<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:48:08 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-38162] Acquire ReplicationStateTransitionLock on shutdown in mode X</title>
                <link>https://jira.mongodb.org/browse/SERVER-38162</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description></description>
                <environment></environment>
        <key id="634734">SERVER-38162</key>
            <summary>Acquire ReplicationStateTransitionLock on shutdown in mode X</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="samy.lanka@mongodb.com">Samyukta Lanka</reporter>
                        <labels>
                            <label>prepare_durability</label>
                    </labels>
                <created>Thu, 15 Nov 2018 20:55:25 +0000</created>
                <updated>Sun, 29 Oct 2023 22:26:31 +0000</updated>
                            <resolved>Thu, 17 Jan 2019 22:42:42 +0000</resolved>
                                                    <fixVersion>4.1.8</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2119272" author="xgen-internal-githook" created="Thu, 17 Jan 2019 22:40:44 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;lankas&apos;, &apos;email&apos;: &apos;samy.lanka@mongodb.com&apos;, &apos;name&apos;: &apos;Samy Lanka&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38162&quot; title=&quot;Acquire ReplicationStateTransitionLock on shutdown in mode X&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38162&quot;&gt;&lt;del&gt;SERVER-38162&lt;/del&gt;&lt;/a&gt; Acquire RSTL on shutdown in mode X&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5918fda8a354db2e3ecc95ac0c384b412bfe0684&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5918fda8a354db2e3ecc95ac0c384b412bfe0684&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2081798" author="siyuan.zhou@10gen.com" created="Wed, 5 Dec 2018 20:58:20 +0000"  >&lt;p&gt;There are places where &lt;tt&gt;canAcceptWritesFor&lt;/tt&gt; is called after holding locks. The contract used to be if this check is true, writing into oplog will succeed. Adding &lt;tt&gt;checkForInterrupt()&lt;/tt&gt; in lopOp breaks the contract. For example, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/ca1cccb8a18be76c584f587e04b14512e59d8424/src/mongo/db/catalog/rename_collection.cpp#L147&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;renameCollection&lt;/a&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/a66a5578d5b006cef85b16eac05c96b58c877ebe/src/mongo/db/catalog/drop_database.cpp#L288&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;dropCollection&lt;/a&gt; follow this pattern. &lt;a href=&quot;https://github.com/mongodb/mongo/blob/ca1cccb8a18be76c584f587e04b14512e59d8424/src/mongo/db/catalog/multi_index_block_impl.cpp#L156&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MultiIndexBlockImpl&lt;/a&gt; is another example where &lt;tt&gt;UninterruptibleLockGuard&lt;/tt&gt; is used to avoid interruption of writing an oplog entry.&lt;/p&gt;

&lt;p&gt;I think we need to audit all 47 occurrences of UninterruptibleLockGuard in production code. Not all of them can conflict with transaction locks, e.g. asking for IS or IX modes, working on a temp collection, or writing oplog entries. If we can fix those DDL that require strong locks to be killable, these non-conflicting operations can go in after killing all operations. 18 occurrences are for sharding that I haven&apos;t look into yet. One noticeable conflicting case is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/dcf7e0dd89d34f58b592f1adb3d41e5edd6e2012/src/mongo/db/s/collection_sharding_runtime.cpp#L191&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CollectionCriticalSection&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2081385" author="samy.lanka" created="Wed, 5 Dec 2018 16:46:14 +0000"  >&lt;p&gt;After talking with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tess.avitabile&quot; class=&quot;user-hover&quot; rel=&quot;tess.avitabile&quot;&gt;tess.avitabile&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt;, we are going to keep the shutdown order the same as what I proposed above. Instead of preventing DDL operations from acquiring locks released by prepared transactions, we will make sure that they can&apos;t write an oplog entry if they were killed. To do this, we plan to check for interrupts during &lt;tt&gt;logOp&lt;/tt&gt;, in a place that already &lt;tt&gt;uasserts&lt;/tt&gt; if a write is not allowed (so we know that it is interruptible there).&lt;/p&gt;</comment>
                            <comment id="2081282" author="samy.lanka" created="Wed, 5 Dec 2018 15:51:06 +0000"  >&lt;p&gt;Sorry I forgot to update that, the new proposed order (without Tess&apos;s idea) is:&lt;br/&gt;
 1) Shutdown replication coordinator&lt;br/&gt;
 2) Enqueue RSTL in mode X&lt;br/&gt;
 3) Kill all operations&lt;br/&gt;
 4) Kill sessions and shutdown all transactions&lt;br/&gt;
 5) Wait until RSTL is acquired&lt;br/&gt;
 6) Acquire GlobalLock&lt;/p&gt;</comment>
                            <comment id="2081235" author="judah.schvimer" created="Wed, 5 Dec 2018 15:30:46 +0000"  >&lt;p&gt;On a separate note, &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;, as you pointed out, steps 3 and 4 should be swapped, correct?&lt;/p&gt;</comment>
                            <comment id="2081101" author="tess.avitabile" created="Wed, 5 Dec 2018 14:20:34 +0000"  >&lt;p&gt;Is it possible to wait to abort prepared transactions until after the RSTL is acquired? This means that in step (3), we would need to just abort non-prepared transactions.&lt;/p&gt;</comment>
                            <comment id="2080589" author="samy.lanka" created="Tue, 4 Dec 2018 23:19:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt; and I were discussing whether we have actually solved the problem of DDL operations sneaking in after aborting prepared transactions on shutdown and we think that they are still a problem even after this work goes in.&lt;/p&gt;

&lt;p&gt;Some DDL operations are protected by an &lt;tt&gt;UninterruptibleLockGuard&lt;/tt&gt; like &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4c5d05f9bb8457a389cb02d43f9d59aabbfec82c/src/mongo/db/catalog/drop_database.cpp#L114&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;dropDatabase&lt;/tt&gt;&lt;/a&gt;, which means that they won&apos;t have been killed when we try to kill all operations. This means that after we have aborted all transactions, they could still succeed. &lt;/p&gt;</comment>
                            <comment id="2079226" author="judah.schvimer" created="Mon, 3 Dec 2018 22:06:05 +0000"  >&lt;p&gt;Per discussion with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt;, before step 3 above we will need to implement a way to release the resources of all sessions, regardless of if they were &lt;tt&gt;markedUnkillable&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="2076842" author="samy.lanka" created="Fri, 30 Nov 2018 16:15:11 +0000"  >&lt;p&gt;The current order of shutdown is:&lt;br/&gt;
1) Shutdown replication coordinator&lt;br/&gt;
2) Kill sessions and shutdown all transactions&lt;br/&gt;
3) Kill all operations&lt;br/&gt;
4) Acquire GlobalLock&lt;/p&gt;

&lt;p&gt;This is what the new order will be:&lt;br/&gt;
1) Shutdown replication coordinator&lt;br/&gt;
2) Enqueue RSTL in mode X&lt;br/&gt;
3) Kill sessions and shutdown all transactions&lt;br/&gt;
4) Kill all operations&lt;br/&gt;
5) Wait until RSTL is acquired&lt;br/&gt;
6) Acquire GlobalLock&lt;/p&gt;</comment>
                            <comment id="2076186" author="siyuan.zhou@10gen.com" created="Thu, 29 Nov 2018 22:44:31 +0000"  >&lt;p&gt;Just want to add a comment to remind ourselves that it should be impossible to let&#160;dropCollections sneak in after aborting prepared transactions on shutdown.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="611497">SERVER-37381</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="685557">SERVER-39424</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>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.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>Thu, 29 Nov 2018 22:44:31 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 3 weeks, 6 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-1032</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>
                            5 years, 3 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>samy.lanka@mongodb.com</customfieldvalue>
            <customfieldvalue>siyuan.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>tess.avitabile@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hud17b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu33qn:</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="2607">Repl 2018-12-17</customfieldvalue>
    <customfieldvalue id="2701">Repl 2019-01-14</customfieldvalue>
    <customfieldvalue id="2702">Repl 2019-01-28</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|hucngn:</customfieldvalue>

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