<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:24:41 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-30692] mapReduce&apos;s postProcessCollection() should take db write lock instead of global write lock</title>
                <link>https://jira.mongodb.org/browse/SERVER-30692</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;mapReduce&apos;s postProcessCollection() on mongod &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.11/src/mongo/db/commands/mr.cpp?#L610-L611&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;may take a global write lock&lt;/a&gt;. The comment above it says it&apos;s because &lt;b&gt;renaming&lt;/b&gt; the temp collection to the final output collection may be a rename &lt;b&gt;across databases.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;However, I believe it&apos;s enough to just hold a &lt;b&gt;database&lt;/b&gt; lock (not &lt;b&gt;global&lt;/b&gt; lock) here. The temp collection is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.11/src/mongo/db/commands/mr.cpp?#L312&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;always created in the &lt;b&gt;same database&lt;/b&gt; as the final output collection&lt;/a&gt;, so the rename should never actually be across databases.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/mapReduce/#output-to-a-collection-with-an-action&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;online docs&lt;/a&gt; suggest that if the &apos;nonAtomic&apos; option to mapReduce is true, only a database (of the final output collection) will be locked.&lt;/p&gt;

&lt;p&gt;Further, it looks like the comment about renaming across databases was introduced in &lt;a href=&quot;https://github.com/mongodb/mongo/commit/493b1f4bb89d721e630bcd99b1aac2808c8a5161#diff-fa484e07a7ba9d76db642e344bcd2b30R598&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this commit&lt;/a&gt;, and prior to that, &lt;a href=&quot;https://github.com/mongodb/mongo/blame/dfe9b688956e19095e2d37e21bb40c7b7ad17900/src/mongo/db/commands/mr.cpp#L636&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Eliot had commented&lt;/a&gt; that a global lock probably did not need to be taken.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;This is important because renaming a collection across databases does not preserve the collection&apos;s UUID. For the UUIDs project, I am assuming that the global lock taken here is errant, and that the rename can never be across databases.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;CC &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=marko.vojvodic&quot; class=&quot;user-hover&quot; rel=&quot;marko.vojvodic&quot;&gt;marko.vojvodic&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="417122">SERVER-30692</key>
            <summary>mapReduce&apos;s postProcessCollection() should take db write lock instead of global write lock</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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-query">Backlog - Query Team</assignee>
                                    <reporter username="esha.maharishi@mongodb.com">Esha Maharishi</reporter>
                        <labels>
                            <label>query-44-grooming</label>
                    </labels>
                <created>Wed, 16 Aug 2017 15:11:45 +0000</created>
                <updated>Mon, 30 Oct 2023 23:14:15 +0000</updated>
                            <resolved>Mon, 9 Mar 2020 20:34:18 +0000</resolved>
                                    <version>3.5.11</version>
                                    <fixVersion>4.4.0</fixVersion>
                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2955525" author="charlie.swanson" created="Mon, 9 Mar 2020 20:34:18 +0000"  >&lt;p&gt;This is no longer a problem after completing a recent project where we created a new implementation of mapReduce backed by the aggregation framework.&lt;/p&gt;</comment>
                            <comment id="1652841" author="esha.maharishi@10gen.com" created="Mon, 21 Aug 2017 14:19:14 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=james.wahlin&quot; class=&quot;user-hover&quot; rel=&quot;james.wahlin&quot;&gt;james.wahlin&lt;/a&gt;, it&apos;s not critically important to fix - it&apos;s just incorrect and misleading in the code, especially since now some behavior (UUID consistency) depends on the rename not being across databases. Some future reader may think there&apos;s a bug in preserving UUIDs when really it&apos;s a misleading comment and a bug in taking the wrong lock.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=asya&quot; class=&quot;user-hover&quot; rel=&quot;asya&quot;&gt;asya&lt;/a&gt;, yes, however if a different output db is specified, the temp collection is created in that output db (see &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.11/src/mongo/db/commands/mr.cpp?#L312&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/r3.5.11/src/mongo/db/commands/mr.cpp?#L312&lt;/a&gt;).&lt;/p&gt;</comment>
                            <comment id="1652830" author="asya" created="Mon, 21 Aug 2017 14:16:07 +0000"  >&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/mapReduce/#mapreduce-out-cmd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/command/mapReduce/#mapreduce-out-cmd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In fact, mapReduce allows specifying a different DB than the one the command is running on.   If not specified then it will output in the same DB.&lt;/p&gt;</comment>
                            <comment id="1651432" author="james.wahlin@10gen.com" created="Fri, 18 Aug 2017 14:46:57 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt; - can you provide more background on why this change is important? Does it impact Cloud/Atlas? Or is there a performance problem related to this behavior?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25143"><![CDATA[Query]]></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>Fri, 18 Aug 2017 14:46:57 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 48 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_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_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>
                            3 years, 48 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>james.wahlin@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htd3pj:</customfieldvalue>

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

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