<!-- 
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-37536] shardCollection command updates config.collections metadata for unsharded collections</title>
                <link>https://jira.mongodb.org/browse/SERVER-37536</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;b&gt;Implementation:&lt;/b&gt;&lt;br/&gt;
1. Add &quot;partitioned&quot;: true to &lt;a href=&quot;https://github.com/10gen/mongo/blob/untracked/src/mongo/db/s/config/configsvr_shard_collection_command.cpp#L258&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this query&lt;/a&gt; to correctly check if there is an existing sharded collection.&lt;/p&gt;

&lt;p&gt;2. Update config.chunks in _shardsvrShardCollection:&lt;br/&gt;
    2a. When &lt;a href=&quot;https://github.com/10gen/mongo/blob/untracked/src/mongo/db/s/shardsvr_shard_collection.cpp#L361-L395&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;checking for existing chunks&lt;/a&gt;, read in all chunks for this namespace rather than the count if this collection already exists. Assert that there exists only 1 chunk with the correct version (version(1, 0)) and chunk range (globalMin -&amp;gt; globalMax).&lt;br/&gt;
    2b. When &lt;a href=&quot;https://github.com/10gen/mongo/blob/untracked/src/mongo/db/s/shardsvr_shard_collection.cpp#L498&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;writing the chunks to the config&lt;/a&gt;, we should send an &lt;a href=&quot;https://github.com/10gen/mongo/blob/untracked/src/mongo/s/catalog/sharding_catalog_client.h#L363&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;update command&lt;/a&gt; (rather than an insert). We need to bump the major chunk version here as a part of this update.&lt;/p&gt;

&lt;p&gt;3. Update config.collections and set the shardKey to the new shardKey and &quot;sharded: true&quot; &lt;a href=&quot;https://github.com/10gen/mongo/blob/untracked/src/mongo/db/s/shardsvr_shard_collection.cpp#L500-L513&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;&lt;b&gt;Testing:&lt;/b&gt;&lt;br/&gt;
We need to test this for an empty unsharded collection and a non-empty sharded collection.&lt;/p&gt;

&lt;p&gt;Set up:&lt;br/&gt;
Empty unsharded collection:&lt;br/&gt;
1. Create a collection.&lt;br/&gt;
2. Assert that there exists the correct entries in config.databases, config.collections (&quot;sharded&quot;: false and dummy shard key), and config.chunks (only one entry with version(1,0) and range (globalMin : globalMax)).&lt;/p&gt;

&lt;p&gt;Non-empty unsharded collection:&lt;br/&gt;
1. Insert some documents into a collection.&lt;br/&gt;
2. Assert that there exists the correct entries in config.databases, config.collections (&quot;sharded&quot;: false and dummy shard key), and config.chunks (only one entry with version(1,0) and range (globalMin : globalMax)).&lt;/p&gt;

&lt;p&gt;Assert shard collection properly updates the metadata for both empty and non-empty collections:&lt;br/&gt;
Run shardCollection with each of the following scenarios:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Range based shard key&lt;/li&gt;
	&lt;li&gt;Hashed shard key&lt;/li&gt;
	&lt;li&gt;Hashed shard key and setting numInitialChunks (only for empty collections)&lt;/li&gt;
	&lt;li&gt;Zoned sharding (only for empty collections)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For each of the above scenarios do:&lt;br/&gt;
1. Shard the collection.&lt;br/&gt;
2. Assert that there exists the correct entries in config.databases, config.collections (&quot;sharded&quot;: true and updated shard key), and config.chunks (expected number of chunks for the way in which we sharded the collection this iteration, the version is bumped, and correct ranges  for the way in which we sharded the collection this iteration).&lt;/p&gt;


&lt;p&gt;&lt;b&gt;Assumptions:&lt;/b&gt;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The collection already exists and is marked in config.collections with 
{sharded: false}&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="616368">SERVER-37536</key>
            <summary>shardCollection command updates config.collections metadata for unsharded collections</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="13203">Gone away</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 23:07:49 +0000</created>
                <updated>Fri, 27 Oct 2023 20:43:13 +0000</updated>
                            <resolved>Wed, 2 Nov 2022 13:01:20 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4947579" author="max.hirschhorn@10gen.com" created="Wed, 2 Nov 2022 13:01:21 +0000"  >&lt;p&gt;This ticket was originally part of PM-1051 but is no longer necessary.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="617198">SERVER-37581</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>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="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, 31 Oct 2018 18:15:46 +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>luke.bonanomi@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|hu9wkv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu08rr:</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="2581">Sharding 2018-11-19</customfieldvalue>
    <customfieldvalue id="2611">Sharding 2018-12-03</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|hu9iu7:</customfieldvalue>

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