<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:13:04 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-47025] moveChunk after refine shard key can hang indefinitely due to missing shard key index</title>
                <link>https://jira.mongodb.org/browse/SERVER-47025</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When the resumable range deleter is disabled, the recipient of a chunk &lt;a href=&quot;https://github.com/mongodb/mongo/blob/198a9d8ae3619362e00bd3a14e15e633ab731d18/src/mongo/db/s/migration_destination_manager.cpp#L891-L894&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;starts by removing potentially orphaned documents&lt;/a&gt;. After that, it &lt;a href=&quot;https://github.com/mongodb/mongo/blob/198a9d8ae3619362e00bd3a14e15e633ab731d18/src/mongo/db/s/migration_destination_manager.cpp#L938&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;clones necessary indexes from the donor&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;However, the range deleter &lt;a href=&quot;https://github.com/mongodb/mongo/blob/198a9d8ae3619362e00bd3a14e15e633ab731d18/src/mongo/db/s/range_deletion_util.cpp#L134-L140&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;relies on the shard key index in order to perform deletions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This can lead to the following scenario:&lt;br/&gt;
1. A moveChunk begins&lt;br/&gt;
2. The shard key is refined&lt;br/&gt;
3. The moveChunk fails on the recipient for some reason, causing the entire moveChunk to fail&lt;br/&gt;
4. The moveChunk is restarted, now with a refined shard key&lt;br/&gt;
5. The recipient of the moveChunk attempts to delete the incoming range using the range deleter with the refined shard key&lt;br/&gt;
6. The range deleter loops infinitely because it is unable to find a shard key index.&lt;/p&gt;

&lt;p&gt;There may be less convoluted scenarios that could cause this as well but I&apos;m having trouble thinking of one.&lt;/p&gt;

&lt;p&gt;Repro attached.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1284247">SERVER-47025</key>
            <summary>moveChunk after refine shard key can hang indefinitely due to missing shard key index</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="13201">Fixed</resolution>
                                        <assignee username="backlog-server-sharding-emea">[DO NOT USE] Backlog - Sharding EMEA</assignee>
                                    <reporter username="matthew.saltz@mongodb.com">Matthew Saltz</reporter>
                        <labels>
                            <label>PM-2144-Milestone-0</label>
                    </labels>
                <created>Fri, 20 Mar 2020 19:52:51 +0000</created>
                <updated>Sun, 29 Oct 2023 22:10:29 +0000</updated>
                            <resolved>Tue, 4 Jul 2023 10:45:03 +0000</resolved>
                                                    <fixVersion>6.2.0-rc0</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="5542312" author="JIRAUSER1257318" created="Tue, 4 Jul 2023 10:44:01 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-69768&quot; title=&quot;Include key pattern in range deletion task documents&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-69768&quot;&gt;&lt;del&gt;SERVER-69768&lt;/del&gt;&lt;/a&gt; fixed this bug by persisting the shardKeyPattern on the range deletion task document and later using it to find a suitable index for executing the range deletion. This way, the range deletion task for the migration that started before refineCollectionShardKey would have the pre-refine shardKeyPattern. After refine, the range deleter is still able to find the pre-refine index on the recipient shard.&lt;/p&gt;</comment>
                            <comment id="3497146" author="esha.maharishi@10gen.com" created="Thu, 19 Nov 2020 05:12:47 +0000"  >&lt;p&gt;Bringing this back into Needs Scheduling - it had been on my todo list but never ended up getting finished.&lt;/p&gt;

&lt;p&gt;I had discussed with Andy that the range deleter should fall back to a collection scan if there is no shard key index, and with Charlie that the range deleter should use a higher-level interface into the query system than &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9e5304de6d7a212ce87dc3647ea37d97afc1e51b/src/mongo/db/s/range_deletion_util.cpp#L184&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;deleteWithIndexScan&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I tested making the range deleter use getExecutorDelete with a range query, allowing the query system to choose an index if available, but it&#160;&lt;a href=&quot;https://evergreen.mongodb.com/version/5ea0ad6fe3c33161a66e4f7b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;didn&apos;t work&lt;/a&gt; if the shard key was hashed.&lt;/p&gt;

&lt;p&gt;The issue was, the range to delete is stored in terms of the hashed shard key, and I was trying to create a query with $gte and $lt those hashed values. So the query was comparing the hashed values to the actual values and returning nonsense.&lt;/p&gt;

&lt;p&gt;Andy mentioned the query language should have a $hash operator that applies a hash to the actual values, so that a later pipeline stage can compare two hashed values.&lt;/p&gt;

&lt;p&gt;A $toHashedIndexKey operator was actually implemented this past summer, see the &lt;a href=&quot;https://docs.google.com/document/d/1CcJTFuDjjj1fT8PMITdvIgs353gNak6BeyYfa0phNTE/edit#heading=h.wtq2vbtosuas&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;syntax doc&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-49214&quot; title=&quot;Add $toHashedIndexKey expression&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-49214&quot;&gt;&lt;del&gt;SERVER-49214&lt;/del&gt;&lt;/a&gt; that added it.&lt;/p&gt;

&lt;p&gt;This may help in falling back to a collection scan, though since pipeline-style removes are not currently supported, it would require using an agg to find the _id&apos;s of documents to delete, then a delete to delete them.&lt;/p&gt;</comment>
                            <comment id="3493147" author="esha.maharishi@10gen.com" created="Tue, 17 Nov 2020 06:14:49 +0000"  >&lt;p&gt;I filed a separate ticket (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-52906&quot; title=&quot;moveChunk after failed migration that rolled back cloning indexes can hang indefinitely due to missing shard key index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-52906&quot;&gt;&lt;del&gt;SERVER-52906&lt;/del&gt;&lt;/a&gt;) for the bug Blake mentioned and re-linked BF-17537 to that ticket.&lt;/p&gt;</comment>
                            <comment id="3206111" author="blake.oler" created="Thu, 11 Jun 2020 21:27:04 +0000"  >&lt;p&gt;Linking BF-17537 to this ticket &amp;#8211; a similar scenario lands us in the same infinite loop.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;A recovery doc is persisted for a migration.&lt;/li&gt;
	&lt;li&gt;A migration aborts after cloning indexes, but before majority committing that index creation.&lt;/li&gt;
	&lt;li&gt;On step up, the index creation gets rolled back.&lt;/li&gt;
	&lt;li&gt;The stepped-up node attempts to delete the ranges from the aborted migration.&lt;/li&gt;
	&lt;li&gt;The deletion infinitely fails because the shard key index doesn&apos;t exist on the stepped-up node.&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="3080073" author="esha.maharishi@10gen.com" created="Tue, 12 May 2020 04:43:46 +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; probably not; I&apos;m moving it 4.4 Required.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="2138905">SERVER-69768</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2407361">SERVER-79632</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1543779">SERVER-52906</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="252980" name="range_deleter_refine_missing_index_repro.js" size="3476" author="matthew.saltz@mongodb.com" created="Fri, 20 Mar 2020 19:46:22 +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_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10.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_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="18953"><![CDATA[v4.4]]></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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 11 May 2020 21:51:53 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        31 weeks, 1 day 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/SERVER-69768'>SERVER-69768</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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2144</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>
                            31 weeks, 1 day 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>backlog-server-sharding-emea</customfieldvalue>
            <customfieldvalue>blake.oler@mongodb.com</customfieldvalue>
            <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>jordi.serra-torrens@mongodb.com</customfieldvalue>
            <customfieldvalue>matthew.saltz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxa7gn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxdf9b:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3745">Sharding 2020-04-06</customfieldvalue>
    <customfieldvalue id="3837">Sharding 2020-04-20</customfieldvalue>
    <customfieldvalue id="3841">Sharding 2020-05-04</customfieldvalue>
    <customfieldvalue id="3842">Sharding 2020-05-18</customfieldvalue>
    <customfieldvalue id="3954">Sharding 2020-07-13</customfieldvalue>
    <customfieldvalue id="3955">Sharding 2020-06-01</customfieldvalue>
    <customfieldvalue id="3956">Sharding 2020-06-15</customfieldvalue>
    <customfieldvalue id="3957">Sharding 2020-06-29</customfieldvalue>
    <customfieldvalue id="4135">Sharding 2020-07-27</customfieldvalue>
    <customfieldvalue id="4137">Sharding 2020-08-24</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|hx9tpz:</customfieldvalue>

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