<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:25:14 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-51349] An OpCtx&apos;s UncommittedCollections are retained after transaction resource stashing.</title>
                <link>https://jira.mongodb.org/browse/SERVER-51349</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When a command inside a running transaction returns a response, its (uncommitted) state is stashed into some map on session&apos;s in a structure called &lt;tt&gt;TxnResources&lt;/tt&gt;. This stash includes things like locks, the current storage engine transaction and any collections the transaction has created.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/75eb9e18187b7853ed8e317825a2e282a54f92f0/src/mongo/db/transaction_participant.cpp#L752&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Stashing the uncommitted collections&lt;/a&gt; will create a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/75eb9e18187b7853ed8e317825a2e282a54f92f0/src/mongo/db/catalog/uncommitted_collections.h#L73&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;new shared pointer&lt;/a&gt; for the TxnResources to hold onto.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/75eb9e18187b7853ed8e317825a2e282a54f92f0/src/mongo/db/transaction_participant.cpp#L817&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Unstashing&lt;/a&gt; the uncommitted collections &lt;a href=&quot;https://github.com/mongodb/mongo/blob/75eb9e18187b7853ed8e317825a2e282a54f92f0/src/mongo/db/catalog/uncommitted_collections.h#L77&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;asserts that the OperationContext does not know of any existing uncommitted collections&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The stash -&amp;gt; unstash works so long as an operation context is destroyed after each &quot;statement&quot;. This is the typical case as each new request over the wire creates a new operation context. However, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/75eb9e18187b7853ed8e317825a2e282a54f92f0/src/mongo/db/s/config/sharding_catalog_manager.cpp#L64-L87&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;internal code&lt;/a&gt; can send commands directly into the local system. This entry point executes all of the transaction related stashing logic, but also allows for the caller to provide the same operation context for each statement.&lt;/p&gt;

&lt;p&gt;The latter case can run into the above assertion when the transaction attempts (explicitly, or implicitly) to create a collection. This ticket is to make the stashing logic appropriately clean up the UncommittedCollections associated with an OpCtx.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Original Description&lt;/b&gt;&lt;br/&gt;
Assumptions exist for creating collections in replica set transactions that are outside of the scope of completion for Resharding&apos;s Milestone 1. In order to avoid spending too much time trying to debug collection creation in transactions, collection creation at the beginning of a resharding operation must be done outside of a transaction.&lt;/p&gt;

&lt;p&gt;Right now, this includes creating the config.reshardingOperations collection before attempting to insert to that collection &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9cc6fab62d3c66d5ed3517271f6e0fdfa62cd27b/src/mongo/db/s/resharding/resharding_coordinator_service.cpp#L408&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Whoever works on this ticket must also find other places where collections are being written to in transactions as part of resharding, and assess whether it&apos;s possible that an operation leads to implicit collection creation. If so, the resharding collection must be optimistically outside of a transaction.&lt;/p&gt;

&lt;p&gt;For questions about how to implement this, and for code review, refer to Dan Gottlieb.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1501849">SERVER-51349</key>
            <summary>An OpCtx&apos;s UncommittedCollections are retained after transaction resource stashing.</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="13201">Fixed</resolution>
                                        <assignee username="daniel.gottlieb@mongodb.com">Daniel Gottlieb</assignee>
                                    <reporter username="blake.oler@mongodb.com">Blake Oler</reporter>
                        <labels>
                            <label>PM-234-M1</label>
                            <label>PM-234-T-lifecycle</label>
                    </labels>
                <created>Mon, 5 Oct 2020 14:31:12 +0000</created>
                <updated>Sun, 29 Oct 2023 22:02:24 +0000</updated>
                            <resolved>Wed, 7 Oct 2020 02:45:04 +0000</resolved>
                                                    <fixVersion>4.9.0</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3429659" author="xgen-internal-githook" created="Wed, 7 Oct 2020 00:02:08 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Daniel Gottlieb&apos;, &apos;email&apos;: &apos;daniel.gottlieb@mongodb.com&apos;, &apos;username&apos;: &apos;dgottlieb&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51349&quot; title=&quot;An OpCtx&amp;#39;s UncommittedCollections are retained after transaction resource stashing.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51349&quot;&gt;&lt;del&gt;SERVER-51349&lt;/del&gt;&lt;/a&gt;: Have UncommittedCollections release its resources when stashing to TxnResources.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9616997f36141394f54e793f9e502ebd55570cc4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9616997f36141394f54e793f9e502ebd55570cc4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3425771" author="blake.oler" created="Mon, 5 Oct 2020 16:49:44 +0000"  >&lt;p&gt;Here is a patch that for now triggers the invariant that led to us discovering this issue. In this patch is:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;The code for Alex&apos;s ticket &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51210&quot; title=&quot;Call setInitialChunksAndZones from the config server reshardCollection command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51210&quot;&gt;&lt;del&gt;SERVER-51210&lt;/del&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;A local fix for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51345&quot; title=&quot;Change all IDL object types to owned object types in Resharding classes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51345&quot;&gt;&lt;del&gt;SERVER-51345&lt;/del&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;A local fix for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51347&quot; title=&quot;Allow writes on a collection string-matching &amp;quot;.system.resharding.&amp;quot; for Resharding&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51347&quot;&gt;&lt;del&gt;SERVER-51347&lt;/del&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;A &lt;em&gt;commented out&lt;/em&gt; fix for this ticket&lt;/li&gt;
	&lt;li&gt;Some local debugging code&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;To get the invariant, run &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/jstests/sharding/reshard_collection_basic.js&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this jstest&lt;/a&gt;. If you uncomment the code, you will bypass this invariant, which currently leads to an &lt;em&gt;unrelated&lt;/em&gt; stacktrace involving shard_id.h. &lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/281385/281385_invariant.diff&quot; title=&quot;invariant.diff attached to SERVER-51349&quot;&gt;invariant.diff&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="1494823">SERVER-51209</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1494876">SERVER-51210</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1501852">SERVER-51350</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="281385" name="invariant.diff" size="10015" author="blake.oler@mongodb.com" created="Mon, 5 Oct 2020 16:49:43 +0000"/>
                    </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_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>Tue, 6 Oct 2020 13:54:04 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 18 weeks, 1 day 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-234</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, 18 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>blake.oler@mongodb.com</customfieldvalue>
            <customfieldvalue>daniel.gottlieb@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hyajpb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxwwhb:</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="4254">Sharding 2020-10-19</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|hya5yn:</customfieldvalue>

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