<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:55:50 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-62700] The rename DDL violates some ShardServerCatalogCacheLoader constraints when the cached metadata collections are UUID-based</title>
                <link>https://jira.mongodb.org/browse/SERVER-62700</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When we enable the long names support, all &lt;tt&gt;config.cache.chunks.*&lt;/tt&gt; collections are UUID-based. This is problematic for the rename DDL operation, let me try to describe the problem:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;We have a collection &lt;tt&gt;&quot;A&quot;&lt;/tt&gt; with UUID=42 that it is going to be renamed to &lt;tt&gt;&quot;B&quot;&lt;/tt&gt; (let&apos;s assume that &lt;tt&gt;&quot;B&quot;&lt;/tt&gt; doesn&apos;t exist yet).&lt;/li&gt;
	&lt;li&gt;We acquire the critical section blocking reads/writes over both namespaces.&lt;/li&gt;
	&lt;li&gt;After locally renaming the collection, we commit those changes in the CSRS.&lt;/li&gt;
	&lt;li&gt;Once the operation is committed, we have two namespaces that from the point of view of the &lt;tt&gt;ShardServerCatalogCacheLoader&lt;/tt&gt; refer to the same cached chunks collection: &lt;tt&gt;config.cache.chunks.42&lt;/tt&gt;. This is problematic because despite the fact that we are holding the critical section we could trigger a &lt;tt&gt;CatalogCache&lt;/tt&gt; refresh. Then:
	&lt;ul&gt;
		&lt;li&gt;We could have a thread refreshing the namespace &lt;tt&gt;&quot;A&quot;&lt;/tt&gt;. In this case it will see that the collection was removed (i.e. not present anymore on &lt;tt&gt;config.collections&lt;/tt&gt; and will spawn an async task to drop &lt;tt&gt;config.cache.chunks.42&lt;/tt&gt;.&lt;/li&gt;
		&lt;li&gt;Let&apos;s assume that at the same time we have another thread refreshing the namespace &lt;tt&gt;&quot;B&quot;&lt;/tt&gt;. This one is going to find it on the CSRS and it is going to check whether &lt;tt&gt;config.cache.chunks.42&lt;/tt&gt; is created or not, and then it will append the new metadata (if any) to this collection. This is problematic because we don&apos;t synchronize the reads that we perform on this collection with the task spawned before. We didn&apos;t have this problem before because each namespace had its own and unique cached chunks collection, so it couldn&apos;t happen that two different namespaces shared the same cached chunks collection.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I spotted this problem some time ago (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-58465&quot; title=&quot;Fix the cleanup of the Routing Info in the rename operation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-58465&quot;&gt;&lt;del&gt;SERVER-58465&lt;/del&gt;&lt;/a&gt;) and thought that because we were holding the critical section this shouldn&apos;t be a problem. I was wrong, if the shard executes some &quot;routing code&quot; (i.e. we get the &lt;tt&gt;CatalogCache&lt;/tt&gt; and do some refreshes)&#160;we can totally hit it.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rui.liu&quot; class=&quot;user-hover&quot; rel=&quot;rui.liu&quot;&gt;rui.liu&lt;/a&gt; found this problem &lt;a href=&quot;https://logkeeper.mongodb.org/lobster/build/42457b2598355179dca5e91d96d2afda/test/61e5acb954f24864c446d707#bookmarks=0%2C50580%2C50581%2C50582%2C50659%2C50660%2C50661%2C50662%2C50836%2C50868%2C50869%2C50898%2C50899%2C50900%2C50926%2C50933%2C50937%2C50940%2C50963%2C50974%2C50982%2C50983%2C50984%2C50993%2C50994%2C51243%2C114270&amp;amp;f~=100~j0%3As0%3Aprim.%2AfsmDB_1.sharded_coll_1&amp;amp;f~=100~featureCompatibilityVersion&amp;amp;f~=100~j0%3As0%3Aprim.%2AShardServerCatalogCacheLoader&amp;amp;f~=100~j0%3As0%3Aprim.%2AfsmDB_1.sharded_coll_0&amp;amp;h~=100~fsmDB_1.sharded_coll_1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;in this execution.&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1965602">SERVER-62700</key>
            <summary>The rename DDL violates some ShardServerCatalogCacheLoader constraints when the cached metadata collections are UUID-based</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="antonio.fuschetto@mongodb.com">Antonio Fuschetto</assignee>
                                    <reporter username="sergi.mateo-bellido@mongodb.com">Sergi Mateo Bellido</reporter>
                        <labels>
                            <label>SSCCL-BUG</label>
                    </labels>
                <created>Tue, 18 Jan 2022 13:25:53 +0000</created>
                <updated>Fri, 17 Jun 2022 15:59:25 +0000</updated>
                            <resolved>Mon, 24 Jan 2022 08:21:23 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4308499" author="JIRAUSER1256927" created="Mon, 24 Jan 2022 07:13:56 +0000"  >&lt;p&gt;Pierlauro and myself discussed about the approach above but wasn&apos;t complete. &lt;/p&gt;

&lt;p&gt;A solution that would work would be to name the &lt;tt&gt;config.cache.chunks.*&lt;/tt&gt; collections with a hash of the namespace instead of the UUID. We would probably want to persist also this hash in &lt;tt&gt;config.cache.collections&lt;/tt&gt; for post-mortem analysis though.&lt;/p&gt;</comment>
                            <comment id="4305315" author="pierlauro.sciarelli" created="Fri, 21 Jan 2022 12:08:34 +0000"  >&lt;p&gt;Would it be an acceptable trick to update the uuid field for the document representing &lt;tt&gt;A&lt;/tt&gt; in the &lt;tt&gt;config.cache.collections&lt;/tt&gt; at some point during the rename? E.g. set it to UUID(0) so that the async drop tries to delete &lt;tt&gt;config.cache.chunks.0&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Note that this would not affect the rename operation because:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The actual UUID in the collection catalog would not be modified.&lt;/li&gt;
	&lt;li&gt;The correct &lt;a href=&quot;https://github.com/mongodb/mongo/blob/6c1a9ae8b2ab96e87c99a10b0e7e1ea3c9df7b73/src/mongo/db/s/rename_collection_coordinator.cpp#L172&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;collection UUID&lt;/a&gt; and the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/6c1a9ae8b2ab96e87c99a10b0e7e1ea3c9df7b73/src/mongo/db/s/rename_collection_coordinator.cpp#L179&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;source collection entry&lt;/a&gt; are snapshotted in the first phase of the rename coordinator.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It seems an easy way to get rid of the race condition with no side effects. I believe it could be done by the DDL coordinator after renaming the metadata on the CSRS and before unblocking CRUDs (around &lt;a href=&quot;https://github.com/mongodb/mongo/blob/6c1a9ae8b2ab96e87c99a10b0e7e1ea3c9df7b73/src/mongo/db/s/rename_collection_coordinator.cpp#L327&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 21 Jan 2022 12:08:34 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 2 weeks, 2 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2384</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>kaloian.manassiev@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 2 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>antonio.fuschetto@mongodb.com</customfieldvalue>
            <customfieldvalue>pierlauro.sciarelli@mongodb.com</customfieldvalue>
            <customfieldvalue>sergi.mateo-bellido@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0h5bj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i009a7:</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="5682">Sharding EMEA 2022-01-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|i0grgv:</customfieldvalue>

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