<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:25:56 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-31083] Allow passing primary shard to &quot;enableSharding&quot; command for a new database</title>
                <link>https://jira.mongodb.org/browse/SERVER-31083</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;h3&gt;&lt;a name=&quot;Backgroundandmotivation&quot;&gt;&lt;/a&gt;Background and motivation&lt;/h3&gt;
&lt;p&gt;Both replica set and sharded cluster MongoDB installations support implicit database and collection creation. In a sharded cluster, by default, implicitly created &lt;b&gt;databases&lt;/b&gt; do not support creating sharded collections under them and because of this, sharding provides the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/enableSharding/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;enableSharding&lt;/tt&gt;&lt;/a&gt; command, which explicitly creates the database and marks it as permitting sharded collections.&lt;/p&gt;

&lt;p&gt;Currently, both implicitly created databases and those created through &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8b79b65dc042fc8ebb6f4dda2b9a212707e38985/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp#L109&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;enableSharding&lt;/tt&gt;&lt;/a&gt; (partially) use the balancer&apos;s &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8b79b65dc042fc8ebb6f4dda2b9a212707e38985/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp#L847&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;statistics gathering logic&lt;/a&gt; to find the shard with the smallest data size and place the database&apos;s primary on it.&lt;/p&gt;

&lt;p&gt;We have seen pathological cases where multiple concurrent implicit database creations end-up placing all database primaries on the same shard. In addition, because the implicit database placement doesn&apos;t use the complete balancer placement logic, it also does not take into account zones, which may lead to database primaries violating location requirements such as GDPR.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Proposedsolution&quot;&gt;&lt;/a&gt;Proposed solution&lt;/h3&gt;
&lt;p&gt;Expose an optional string parameter called &lt;tt&gt;primaryShard&lt;/tt&gt; on the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8b79b65dc042fc8ebb6f4dda2b9a212707e38985/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp#L49&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;enableSharding&lt;/tt&gt;&lt;/a&gt; command.&lt;/p&gt;

&lt;p&gt;If this parameter is present, it must contain the id of a valid shard, and the new database&apos;s primary should be placed on that shard. If the database already exists and its current primary is the same as the one specified through &lt;tt&gt;primaryShard&lt;/tt&gt;, the command succeeds. Otherwise, the command should fail with error code &lt;tt&gt;NamespaceExists = 48&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;If the parameter is omitted, the command should behave like it does currently and place the database&apos;s primary on the shard with the currently smallest data size.&lt;/p&gt;</description>
                <environment></environment>
        <key id="427218">SERVER-31083</key>
            <summary>Allow passing primary shard to &quot;enableSharding&quot; command for a new database</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="marcos.grillo@mongodb.com">Marcos Jos&#233; Grillo Ramirez</assignee>
                                    <reporter username="asya.kamsky@mongodb.com">Asya Kamsky</reporter>
                        <labels>
                            <label>ShardingRoughEdges</label>
                            <label>high-value</label>
                            <label>neweng</label>
                    </labels>
                <created>Wed, 13 Sep 2017 20:17:46 +0000</created>
                <updated>Mon, 30 Oct 2023 23:13:38 +0000</updated>
                            <resolved>Wed, 6 Nov 2019 17:25:16 +0000</resolved>
                                                    <fixVersion>4.3.1</fixVersion>
                    <fixVersion>4.2.2</fixVersion>
                    <fixVersion>4.0.14</fixVersion>
                                    <component>Sharding</component>
                                        <votes>4</votes>
                                    <watches>18</watches>
                                                                                                                <comments>
                            <comment id="2522761" author="xgen-internal-githook" created="Thu, 7 Nov 2019 17:52:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Marcos Jos&#233; Grillo Ram&#237;rez&apos;, &apos;email&apos;: &apos;marcos.grillo@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31083&quot; title=&quot;Allow passing primary shard to &amp;quot;enableSharding&amp;quot; command for a new database&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31083&quot;&gt;&lt;del&gt;SERVER-31083&lt;/del&gt;&lt;/a&gt; Allow passing primary shard to &quot;enableSharding&quot; command for a new database&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6ef06c9093462bec22c2219c341b0219f1864cca)&lt;br/&gt;
(cherry picked from commit 89a83b368a3d71fcf47ced4245235ccbb7b6961c)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/253e674104d298e2f6882b5c8207a2058e648b42&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/253e674104d298e2f6882b5c8207a2058e648b42&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2522088" author="xgen-internal-githook" created="Thu, 7 Nov 2019 11:29:59 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Marcos Jos&#233; Grillo Ram&#237;rez&apos;, &apos;email&apos;: &apos;marcos.grillo@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31083&quot; title=&quot;Allow passing primary shard to &amp;quot;enableSharding&amp;quot; command for a new database&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31083&quot;&gt;&lt;del&gt;SERVER-31083&lt;/del&gt;&lt;/a&gt; Allow passing primary shard to &quot;enableSharding&quot; command for a new database&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6ef06c9093462bec22c2219c341b0219f1864cca)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/89a83b368a3d71fcf47ced4245235ccbb7b6961c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/89a83b368a3d71fcf47ced4245235ccbb7b6961c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2520383" author="xgen-internal-githook" created="Wed, 6 Nov 2019 16:51:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;marcos.grillo@10gen.com&apos;, &apos;name&apos;: &apos;Marcos Jos&#233; Grillo Ram&#237;rez&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31083&quot; title=&quot;Allow passing primary shard to &amp;quot;enableSharding&amp;quot; command for a new database&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31083&quot;&gt;&lt;del&gt;SERVER-31083&lt;/del&gt;&lt;/a&gt; Allow passing primary shard to &quot;enableSharding&quot; command for a new database&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6ef06c9093462bec22c2219c341b0219f1864cca&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6ef06c9093462bec22c2219c341b0219f1864cca&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2504794" author="kaloian.manassiev" created="Mon, 28 Oct 2019 14:24:06 +0000"  >&lt;p&gt;For people who are following this ticket, I updated the description with the way we intend to implement this.&lt;/p&gt;</comment>
                            <comment id="1785428" author="schwerin" created="Thu, 25 Jan 2018 22:02:46 +0000"  >&lt;p&gt;The point of this ticket was to make sure the primary shard for a database ended up in the desired place. I think the target zone sent to enableSharding for a non-existent database would just ensure that the selected primary shard was in that zone. If the database already existed, I imagined that enableSharding would fail if the primary shard weren&apos;t in the zone.&lt;/p&gt;</comment>
                            <comment id="1785189" author="kaloian.manassiev" created="Thu, 25 Jan 2018 19:24:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=schwerin&quot; class=&quot;user-hover&quot; rel=&quot;schwerin&quot;&gt;schwerin&lt;/a&gt;, this sounds like a better approach than passing the primary id. However, technically it is not databases that contain data, but the collections themselves.&lt;/p&gt;

&lt;p&gt;Assuming we start tracking unsharded collections like sharded, are you suggesting that we introduce something like a &quot;default zone&quot; for database, so that each new collection is created on a shard from the zone and if there are further per-collection zones, they take precedence?&lt;/p&gt;</comment>
                            <comment id="1784883" author="schwerin" created="Thu, 25 Jan 2018 16:22:38 +0000"  >&lt;p&gt;I think that we should get away from requesting specific shards, and instead if we do this, move towards requiring specific &lt;em&gt;zones&lt;/em&gt;. How does that sound, &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;?&lt;/p&gt;</comment>
                            <comment id="1784275" author="asya" created="Wed, 24 Jan 2018 23:59:02 +0000"  >&lt;p&gt;Couldn&apos;t selection of shard as primary for DB be important for location/zone purposes?  I suppose then the option should exist on &quot;createDatabase&quot; for cases where the database won&apos;t ever be sharded.&lt;/p&gt;</comment>
                            <comment id="1732012" author="kaloian.manassiev" created="Tue, 21 Nov 2017 19:20:55 +0000"  >&lt;p&gt;The location of the data for a sharded database/collection should not be a concern of the application and it is the job of the sharding balancer logic to make that selection as efficient as possible. Introducing a knob like the one proposed runs the risk of introducing imbalance across the sharded cluster. Because of this I am marking this ticket as &apos;features we are not sure of&apos; and instead I plan on us giving more priority to the linked &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31020&quot; title=&quot;Sharding database creation is slow because of shard disk-usage statistics gathering&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31020&quot;&gt;SERVER-31020&lt;/a&gt; plus the 3.8 work to make unsharded collections tracked by the server, which would make the selection of a primary shard even less relevant.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10320">
                    <name>Documented</name>
                                                                <inwardlinks description="is documented by">
                                        <issuelink>
            <issuekey id="1046454">DOCS-13276</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="425996">SERVER-31020</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.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="16775"><![CDATA[v4.2]]></customfieldvalue>
    <customfieldvalue key="15640"><![CDATA[v4.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_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000b8911IAA, 5002K00000elZqaQAE, 5002K00000fHVyiQAG]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 13 Sep 2017 22:59:31 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 13 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_17052" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Downstream Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Please document the newly introduced parameter, but include a notice box to warn users that they shouldn&amp;#39;t have to specify it and instead should let the balancer choose the primary shard.</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16942"><![CDATA[Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1489</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>
                            4 years, 13 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
            <customfieldvalue>marcos.grillo@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hterpj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht6m8f:</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="3307">Sharding 2019-11-04</customfieldvalue>
    <customfieldvalue id="3308">Sharding 2019-11-18</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_17051" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Teams Impacted</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16944"><![CDATA[Docs]]></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|htedsv:</customfieldvalue>

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