<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:02:53 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-43329] renameCollectionWithinDBForApplyOps should not use temp collections on primary</title>
                <link>https://jira.mongodb.org/browse/SERVER-43329</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In the case of renaming a collection when the target exists but has a UUID which does not match the drop target UUID of the op being applied, we rename the old target out of the way.  This is necessary for idempotence in oplog application, but we should not do it when using applyOps on the primary (when opCtx-&amp;gt;writesAreReplicated()) .   Instead, we should return NamespaceExists as the ordinary rename command would. &lt;/p&gt;

&lt;p&gt;Using opCtx-&amp;gt;writesAreReplicated() for the distinction is consistent with how we treat a &quot;renameOpTime&quot; in applyOps.&lt;/p&gt;</description>
                <environment></environment>
        <key id="926624">SERVER-43329</key>
            <summary>renameCollectionWithinDBForApplyOps should not use temp collections on primary</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-server-repl">Backlog - Replication Team</assignee>
                                    <reporter username="matthew.russotto@mongodb.com">Matthew Russotto</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Sep 2019 19:18:54 +0000</created>
                <updated>Tue, 6 Dec 2022 02:48:03 +0000</updated>
                                                                            <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2435170" author="david.golden" created="Thu, 26 Sep 2019 20:18:13 +0000"  >&lt;p&gt;I agree it&apos;s a legitimate bug, but I don&apos;t know how important it is to fix compared to other priorities, so I have no opinion on whether or not to close.  If it&apos;s scheduled, we just need to schedule a mongomirror ticket to account for it, as with do with other applyOps changes.&lt;/p&gt;</comment>
                            <comment id="2435157" author="judah.schvimer" created="Thu, 26 Sep 2019 20:09:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.golden&quot; class=&quot;user-hover&quot; rel=&quot;david.golden&quot;&gt;david.golden&lt;/a&gt;, am I correct that you would like us to close this &quot;Won&apos;t Fix&quot;?&lt;/p&gt;</comment>
                            <comment id="2432012" author="david.golden" created="Wed, 25 Sep 2019 00:52:20 +0000"  >&lt;p&gt;Solution #2 will cause problems for mongomirror, as it won&apos;t know how to handle a failure at 6.&lt;/p&gt;

&lt;p&gt;Though on reflection, I&apos;m not sure the scenario is actually realistic.  Oplog tailing and cloning on node 2 would happen between steps 1 &amp;amp; 2 and the collection list would only include A with UUID1, plus seeing any renames in the oplog during initial sync are immediate failures anyway (because we can&apos;t query by UUID yet).&lt;/p&gt;

&lt;p&gt;However, during tailing, assuming mongomirror is not preserving UUIDs, IIUC any rename would run into this problem because renaming onto an existing target (presumably, with dropTarget true) still wouldn&apos;t have the right target UUID for the drop.  So in this case, the server erroring would mean mongomirror would need to catch the error, send a remove (by name) to the destination, then resend the rename op.  So if this change is made, we&apos;ll need a mongomirror ticket in the project&apos;s 4.4 (or whatever version) epic.&lt;/p&gt;</comment>
                            <comment id="2431450" author="matthew.russotto" created="Tue, 24 Sep 2019 17:22:54 +0000"  >&lt;p&gt;Yes, when we apply a rename operation that includes a UUID, the source collection name is ignored.  Will solution #2 cause a problem with mongomirror?&lt;/p&gt;</comment>
                            <comment id="2431128" author="david.golden" created="Tue, 24 Sep 2019 15:49:27 +0000"  >&lt;p&gt;Based on this scenario, I&apos;m fine with solution #1 (do nothing).&lt;/p&gt;</comment>
                            <comment id="2431024" author="david.golden" created="Tue, 24 Sep 2019 15:43:56 +0000"  >&lt;p&gt;When you say &quot;which renames the temporary to another name&quot; &amp;#8211; you recognize this via the UUID (ignoring the name mismatch)?&lt;/p&gt;</comment>
                            <comment id="2430918" author="matthew.russotto" created="Tue, 24 Sep 2019 15:25:09 +0000"  >&lt;p&gt;The situation occurs when applying a rename operation (using applyOps) which renames a collection, and the target collection exists but either is not expected to or does not have the expected UUID.  This can happen if the oplog is being replayed during recovery, or it can happen in a scenario where data has been copied and then the oplog applied (as in initial sync and mongomirror).  Since collection names must be unique, we handle this by renaming the unexpected collection to some random temporary name.  We expect that in any valid scenario, we will soon get an oplog entry which renames the temporary to another name, or deletes it.  If we do not get such an oplog entry, and this oplog entry gets replicated, we will end up with temporary collections with different names on both primary and secondary, which results in a dbHash mismatch.&lt;/p&gt;

&lt;p&gt;The options on the table are&lt;/p&gt;

&lt;p&gt;1)  Do nothing.  This means users can cause dbHash mismatches using applyOps, but that&apos;s already true.&lt;/p&gt;

&lt;p&gt;2) Prevent applying such oplog entries on a running primary.    In this case, a scenario that causes a rename conflict will fail.  Example:&lt;/p&gt;

&lt;p&gt;On Node 1&lt;br/&gt;
1. User creates collection A with UUID 1&lt;br/&gt;
2. User renames collection A to B&lt;br/&gt;
3. User renames collection B to C&lt;br/&gt;
4. User creates collection B with UUID 2&lt;/p&gt;

&lt;p&gt;On Node 2:&lt;br/&gt;
5. Clone collection B (UUID 2) and C (UUID 1)&lt;br/&gt;
6. Apply rename operation renaming UUID 1 to B&lt;br/&gt;
7. Apply rename operation renaming UUID 1 to C&lt;br/&gt;
8. Apply create operation creating collection B with UUID 2&lt;/p&gt;

&lt;p&gt;With the current code this works; with the proposed solution, if node 2 is primary, this would fail at step 6 with NamespaceExists.&lt;/p&gt;</comment>
                            <comment id="2428948" author="david.golden" created="Mon, 23 Sep 2019 20:08:35 +0000"  >&lt;p&gt;It&apos;s a little hard to follow.  Can you give me some concrete examples of the different options, please?&lt;/p&gt;</comment>
                            <comment id="2428866" author="judah.schvimer" created="Mon, 23 Sep 2019 19:25:12 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.golden&quot; class=&quot;user-hover&quot; rel=&quot;david.golden&quot;&gt;david.golden&lt;/a&gt;, we think this is something that mongomirror would not be affected by, since future operations should fix everything up. Do you have any concerns about us not prioritizing this? We&apos;ve generally been punting on issues of &lt;tt&gt;applyOps&lt;/tt&gt; not validating its inputs.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="488759">SERVER-32952</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>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25128"><![CDATA[Replication]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 23 Sep 2019 19:25:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 19 weeks, 6 days 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/PM-1507'>PM-1507</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_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>
                            4 years, 19 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>25.0</customfieldvalue>

                        </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-repl</customfieldvalue>
            <customfieldvalue>david.golden@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>matthew.russotto@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hvq6mf:</customfieldvalue>

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

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