<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:46:16 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-37535] createCollection command needs to add catalog metadata in sharded cluster</title>
                <link>https://jira.mongodb.org/browse/SERVER-37535</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The &lt;tt&gt;create&lt;/tt&gt; command in sharded cluster first arrives to mongos, and mongos sends it to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.1.4/src/mongo/s/commands/cluster_create_cmd.cpp#L95-L101&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the config server primary&lt;/a&gt;. &lt;br/&gt;
Config server, in turn, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.1.4/src/mongo/db/s/config/configsvr_create_collection_command.cpp#L94&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquires dist locks&lt;/a&gt; and creates catalog metadata and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.1.4/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp#L517-L522&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;sends the create command to a primary shard&lt;/a&gt; for this database. &lt;/p&gt;

&lt;p&gt;The createCollection command in sharded cluster will add catalog metadata that will be enough to route the commands to the node that has the collection&apos;s data. As such the difference between sharded and the unsharded collections will be in the presence of the sharded key.  sharded key applies several restrictions on the data in the collection and on the access patterns. On the other hand it allows to shard the data i.e. split it into multiple chunks. The unsharded collection on the other hand do not have sharded key and hence can not be sharded. To reuse the catalog machinery built for using with sharded collections the sharding key piece will be ignored but the collection itself will be marked as sharded:false per &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37572&quot; title=&quot;Add support for sharded attribute to CollectionType&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37572&quot;&gt;&lt;del&gt;SERVER-37572&lt;/del&gt;&lt;/a&gt;. &lt;br/&gt;
the net effect of the new createCollectionis similar to calling in MongoDB 4.0&lt;br/&gt;
createCollection&lt;br/&gt;
enableSharding&lt;br/&gt;
shardCollection&lt;br/&gt;
with the exception that the collection is still not sharded i.e. its only chunk is not splittable.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Implementation&quot;&gt;&lt;/a&gt;Implementation&lt;/h3&gt;
&lt;p&gt;The method creating a collection in the sharded cluster is &lt;tt&gt;ShardingCatalogManager::createCollection&lt;/tt&gt; . It sends the &lt;tt&gt;create&lt;/tt&gt; command to the primary shard to add a collection to the storage. In addition this method needs to&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;add config.chunks entry&lt;br/&gt;
besides usual defaults for a new chunk it needs to set a key pattern for the shard key. This pattern will be &quot;_id&quot; &lt;/li&gt;
	&lt;li&gt;add config.collections entry&lt;br/&gt;
as the config.databases has already been added the remaining step is adding a config.collections metadata with the _sharded set to false to indicate that this metadata represents unsharded collection&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;&lt;a name=&quot;Test&quot;&gt;&lt;/a&gt;Test&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;Test that createCollection adds an entry to config.collections and this entry has _sharded set to false&lt;/li&gt;
	&lt;li&gt;Test that createCollection adds document to config.chunks&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="616359">SERVER-37535</key>
            <summary>createCollection command needs to add catalog metadata in sharded cluster</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="backlog-server-sharding">[DO NOT USE] Backlog - Sharding Team</assignee>
                                    <reporter username="misha.tyulenev@mongodb.com">Misha Tyulenev</reporter>
                        <labels>
                            <label>MaxH</label>
                            <label>pm-1051-legacy-tickets</label>
                    </labels>
                <created>Tue, 9 Oct 2018 22:35:33 +0000</created>
                <updated>Tue, 6 Dec 2022 03:16:04 +0000</updated>
                            <resolved>Wed, 2 Nov 2022 12:42:52 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="4947541" author="max.hirschhorn@10gen.com" created="Wed, 2 Nov 2022 12:42:52 +0000"  >&lt;p&gt;There will be a separate project for having all collections be sharded upon creation with a single chunk range {&amp;#95;id: MinKey} to {&amp;#95;id: MaxKey}.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="628541">SERVER-37905</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_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25141"><![CDATA[Sharding]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 2 Nov 2022 12:42:52 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 14 weeks 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_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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 14 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-sharding</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
            <customfieldvalue>misha.tyulenev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu9wiv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu08pr:</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_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|hu9is7:</customfieldvalue>

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