<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:24: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-73484] Serialize createIndexes and dropIndexes with movePrimary</title>
                <link>https://jira.mongodb.org/browse/SERVER-73484</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The cloning phase of the &lt;tt&gt;movePrimary&lt;/tt&gt; command conflicts with some operations, e.g. &lt;tt&gt;createIndexes&lt;/tt&gt; and &lt;tt&gt;dropIndexes&lt;/tt&gt;, which must fail or be serialized. For this purpose, when the cloning phase of the &lt;tt&gt;movePrimary&lt;/tt&gt; command runs, it sets the in-memory &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; flag, which is checked by potentially conflicting operations. Conversely, when the cloning phases is completed, the flag is unset.&lt;/p&gt;

&lt;p&gt;The status of this flag is not persisted, exposing the cluster to the following potential:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Node_1 is the primary and runs a &lt;tt&gt;movePrimary&lt;/tt&gt; operation&lt;/li&gt;
	&lt;li&gt;Node_1 sets the &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; flag&lt;/li&gt;
	&lt;li&gt;Node_1 steps down while the flag is still set&lt;/li&gt;
	&lt;li&gt;Node_2 is elected as a primary and recovers the operation (so, sets the flag)&lt;/li&gt;
	&lt;li&gt;Node_2 completes the operation and unsets the flag (locally)&lt;/li&gt;
	&lt;li&gt;Sooner or later, Node_1 steps up again ==&amp;gt; the &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; flag is still set&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The strategic solution is to reimplement the &lt;tt&gt;createIndexes&lt;/tt&gt; and &lt;tt&gt;dropIndexes&lt;/tt&gt; commands leveraging the DDL coordinator. In this way, these would be serialized automatically with the &lt;tt&gt;MovePrimary&lt;/tt&gt; operations and it would no longer be necessary to use the &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; flag.&lt;/p&gt;

&lt;p&gt;However, a short-term (tactical) solution might be to enhance these commands using the DDL locking. This would avoid using the DDL coordinator (expensive implementation), but still allow these operations to be serialized with the &lt;tt&gt;movePrimary&lt;/tt&gt;, making the flag &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; redundant.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2248318">SERVER-73484</key>
            <summary>Serialize createIndexes and dropIndexes with movePrimary</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="3">Duplicate</resolution>
                                        <assignee username="antonio.fuschetto@mongodb.com">Antonio Fuschetto</assignee>
                                    <reporter username="antonio.fuschetto@mongodb.com">Antonio Fuschetto</reporter>
                        <labels>
                    </labels>
                <created>Tue, 31 Jan 2023 15:46:20 +0000</created>
                <updated>Thu, 14 Sep 2023 12:27:11 +0000</updated>
                            <resolved>Thu, 14 Sep 2023 12:27:11 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5703563" author="JIRAUSER1259062" created="Thu, 14 Sep 2023 12:03:04 +0000"  >&lt;p&gt;After double checking the code, both the non-resilient and resilient &lt;tt&gt;movePrimary&lt;/tt&gt; implementations reset the &lt;tt&gt;MovePrimaryInProgress&lt;/tt&gt; in-memory flag in the event of a step-down. Specifically:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Version 6.0 (non-resilient version): the flag is reset in the &lt;a href=&quot;https://github.com/10gen/mongo/blob/10ad9c7e9e513363374fd7d879a08f17b3d36c38/src/mongo/db/s/move_primary_source_manager.cpp#L512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cleanup procedure&lt;/a&gt;, that is invoked in case of any error.&lt;/li&gt;
	&lt;li&gt;Version 7.2 (resilient version): the flag is reset when the &lt;a href=&quot;https://github.com/10gen/mongo/blob/e0bb873df809c28503df3d5bae8ddfb77451542e/src/mongo/db/s/move_primary_coordinator.cpp#L221&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cloning phase is left&lt;/a&gt;, both in case of success or error.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Consequently, the described problematic scenario cannot occur.&lt;/p&gt;

&lt;p&gt;In the context of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75675&quot; title=&quot;Ensure indexes are created in all shards&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75675&quot;&gt;SERVER-75675&lt;/a&gt;, both the &lt;tt&gt;createIndex&lt;/tt&gt; and &lt;tt&gt;dropIndex&lt;/tt&gt; commands will be implemented on the top of the DDL coordinator, offering the serialization with any other DDL operation.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="2307084">SERVER-75675</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>1.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_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25133"><![CDATA[Sharding EMEA]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 2 Feb 2023 11:17:18 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        20 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/PM-2850'>PM-2850</a></s>]]></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>antonio.fuschetto@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            20 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>antonio.fuschetto@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i1t7lj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1bp6g:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="7194">Sharding EMEA 2023-09-04</customfieldvalue>
    <customfieldvalue id="7718">Sharding EMEA 2023-09-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|i1stqv:</customfieldvalue>

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