<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:38:01 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-15439] mergeChunk command fails if there isn&apos;t an index that exactly matches the shard key</title>
                <link>https://jira.mongodb.org/browse/SERVER-15439</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The mergeChunk command fails if the sharded collection does not have an index that exactly matches the shard key, but has one or more indexes that have the shard key as its prefix.&lt;/p&gt;

&lt;p&gt;The error message is something like this:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&quot;ok&quot; : 0,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&quot;errmsg&quot; : &quot;could not merge chunks, could not count docs in database.collection :: caused by :: 13106 nextSafe(): { $err: \&quot;Unable to execute query: error processing query: ns=database.collection limit=1 skip=0\nTree: $and\nSort: {}\nProj: {}\n planner returned error: unable to fin...\&quot;, code: 17007 }&quot;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Apparently, the query planner is unable to find a relevant index in this situation.&lt;/p&gt;</description>
                <environment></environment>
        <key id="160856">SERVER-15439</key>
            <summary>mergeChunk command fails if there isn&apos;t an index that exactly matches the shard key</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="randolph@mongodb.com">Randolph Tan</assignee>
                                    <reporter username="danielgalinkin@gmail.com">Daniel Galinkin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Sep 2014 14:56:20 +0000</created>
                <updated>Fri, 6 Mar 2015 19:08:15 +0000</updated>
                            <resolved>Thu, 4 Dec 2014 14:56:25 +0000</resolved>
                                    <version>2.6.4</version>
                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="845122" author="ramon.fernandez" created="Fri, 6 Mar 2015 19:08:15 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miketempleman&quot; class=&quot;user-hover&quot; rel=&quot;miketempleman&quot;&gt;miketempleman&lt;/a&gt;, I&apos;m requesting a v2.6 backport of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13385&quot; title=&quot;relax merge chunk constraints&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13385&quot;&gt;&lt;del&gt;SERVER-13385&lt;/del&gt;&lt;/a&gt;, we&apos;ll evaluate the risk/impact and make a decision. Feel free to watch that ticket for updates.&lt;/p&gt;

&lt;p&gt;Note that if you created an index that matches the shard key you may be able to work around this issue, but be aware that creating such index may have a big performance impact on your deployment. If you are going to consider this option I&apos;d strongly advise you to try it out on a testing setup first.&lt;/p&gt;</comment>
                            <comment id="841051" author="miketempleman" created="Tue, 3 Mar 2015 00:24:52 +0000"  >&lt;p&gt;Hi Ramon&lt;/p&gt;

&lt;p&gt;Is there any chance that this fix can be back ported? I have a collection with thousand of empty chunks that I would like to merge but I am encountering the same error. While I really want to upgrade to 3.0 I also don&apos;t want to wait until 3.0 is (1) finally released and (2) 3.0 is thoroughly tested in our staging environment. &lt;/p&gt;</comment>
                            <comment id="778324" author="renctan" created="Thu, 4 Dec 2014 14:56:17 +0000"  >&lt;p&gt;The mergeChunk command was using $min and $max to perform the query to find out if there are any documents. The $min/$max operators need the exact index keys, and thus causing the error. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13385&quot; title=&quot;relax merge chunk constraints&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13385&quot;&gt;&lt;del&gt;SERVER-13385&lt;/del&gt;&lt;/a&gt; now allows merging non-empty chunks, so the counting was completely removed.&lt;/p&gt;</comment>
                            <comment id="778260" author="danielgalinkin@gmail.com" created="Thu, 4 Dec 2014 13:10:30 +0000"  >&lt;p&gt;Ok, I will wait for the 2.8 final release to fix that definitely.&lt;br/&gt;
For now, the workaround that is to just have an index that matches the shard key is enough for me.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;br/&gt;
Daniel&lt;/p&gt;</comment>
                            <comment id="778042" author="ramon.fernandez" created="Thu, 4 Dec 2014 00:55:20 +0000"  >&lt;p&gt;Thanks for the reproducer &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=danielgalinkin%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;danielgalinkin@gmail.com&quot;&gt;danielgalinkin@gmail.com&lt;/a&gt;, and apologies for the late reply. I can observe the behavior you describe in version 2.6.5, but seems to have been fixed already in the 2.7 series. Now 2.7.x versions are for development only and are not recommended for production environments, but we&apos;ve published a 2.8.0-rc1 release candidate for the next stable release (2.8.0) in case you want to give that one a try.&lt;/p&gt;

&lt;p&gt;I need to investigate a bit more to see if this is something that may get backported to the 2.6 series.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="127985">SERVER-13385</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="53212" name="force-empty-chunks-merge-error.js" size="1146" author="danielgalinkin@gmail.com" created="Mon, 29 Sep 2014 14:56:20 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 4 Dec 2014 00:55:20 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 49 weeks, 5 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_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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 49 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>danielgalinkin@gmail.com</customfieldvalue>
            <customfieldvalue>miketempleman</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>randolph@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlmxj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs2mpj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>140086</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;The steps to reproduce this error are:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Ensure the index 
{a: 1, b:1}
&lt;p&gt; on some collection&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;Shard it on 
{a:1}&lt;/li&gt;
	&lt;li&gt;Execute sh.splitAt a few times to force some empty chunks&lt;/li&gt;
	&lt;li&gt;Try to merge any two contiguous chunks. The error will occur.&lt;/li&gt;
	&lt;li&gt;If the index 
{a:1}
&lt;p&gt; is ensured, the mergeChunk functions correctly.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;I&apos;ve attached an script that reproduces these steps and forces this error to occur. To execute it:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Create a sharded environment using mtools (mlaunch init --sharded 1 --single --port 60000)&lt;/li&gt;
	&lt;li&gt;Execute it with mongo localhost:60000 force-empty-chunks-merge-error.js&lt;/li&gt;
&lt;/ol&gt;
</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|hsgm5b:</customfieldvalue>

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