<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:55:58 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-40791] Chunk migration clone blocks behind prepared transactions</title>
                <link>https://jira.mongodb.org/browse/SERVER-40791</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The current iteration of chunk migration was built with the assumption that cloning can happen in parallel with prepared transactions on the collection, however this is not what happens in practice.&lt;/p&gt;

&lt;p&gt;As part of default command behavior, the moveChunk command will block on reads for documents that are in the prepare state. If any documents in the initial index scan are in prepared transactions, the index scan will &lt;a href=&quot;https://github.com/mongodb/mongo/blob/3f039abef078edbe90b0f70a3a59d1642bb8fc7c/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp#L645-L653&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;block on the completion of those transactions to read these documents&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This means that the beginning of the chunk migration clone phase will infinitely block in the presence of transactions that:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Have documents that exist in the chunk being migrated, and&lt;/li&gt;
	&lt;li&gt;Are already in the prepare state before the chunk cloner started.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;This ticket is to evaluate if this behavior is acceptable, and if not, figure out a way around this behavior. If we decide to allow the moveChunk command to ignore prepare conflicts, then we will need additional machinery to track these prepared transactions.&lt;/p&gt;</description>
                <environment></environment>
        <key id="743948">SERVER-40791</key>
            <summary>Chunk migration clone blocks behind prepared transactions</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="blake.oler@mongodb.com">Blake Oler</assignee>
                                    <reporter username="blake.oler@mongodb.com">Blake Oler</reporter>
                        <labels>
                    </labels>
                <created>Tue, 23 Apr 2019 19:34:07 +0000</created>
                <updated>Sun, 29 Oct 2023 22:21:44 +0000</updated>
                            <resolved>Thu, 20 Jun 2019 18:09:01 +0000</resolved>
                                                    <fixVersion>4.2.0-rc2</fixVersion>
                    <fixVersion>4.3.1</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="2294620" author="xgen-internal-githook" created="Mon, 24 Jun 2019 13:51:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Blake Oler&apos;, &apos;email&apos;: &apos;blake.oler@mongodb.com&apos;, &apos;username&apos;: &apos;BlakeIsBlake&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40791&quot; title=&quot;Chunk migration clone blocks behind prepared transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40791&quot;&gt;&lt;del&gt;SERVER-40791&lt;/del&gt;&lt;/a&gt; Track multi-statement transaction operations for migrations at commit time&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 35424844fd9e10b042c435c83a8f1e23e42fb9e4)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6386b168ec0e701ad8649b8cec58f8913a9f076a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6386b168ec0e701ad8649b8cec58f8913a9f076a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2291779" author="xgen-internal-githook" created="Thu, 20 Jun 2019 18:08:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Blake Oler&apos;, &apos;email&apos;: &apos;blake.oler@mongodb.com&apos;, &apos;username&apos;: &apos;BlakeIsBlake&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40791&quot; title=&quot;Chunk migration clone blocks behind prepared transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40791&quot;&gt;&lt;del&gt;SERVER-40791&lt;/del&gt;&lt;/a&gt; Track multi-statement transaction operations for migrations at commit time&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/35424844fd9e10b042c435c83a8f1e23e42fb9e4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/35424844fd9e10b042c435c83a8f1e23e42fb9e4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2283830" author="blake.oler" created="Thu, 13 Jun 2019 19:00:24 +0000"  >&lt;p&gt;Reverted because the current usage of ignoring prepare conflicts doesn&apos;t allow us to write to the local subsystem. Investigating writes that are happening and will repush with proper behavior.&lt;/p&gt;</comment>
                            <comment id="2283825" author="xgen-internal-githook" created="Thu, 13 Jun 2019 18:58:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Blake Oler&apos;, &apos;email&apos;: &apos;blake.oler@mongodb.com&apos;, &apos;username&apos;: &apos;BlakeIsBlake&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40791&quot; title=&quot;Chunk migration clone blocks behind prepared transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40791&quot;&gt;&lt;del&gt;SERVER-40791&lt;/del&gt;&lt;/a&gt; Track multi-statement transaction operations for migrations at commit time&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit dfa8658c18142c560447c7bf6f34a6f788593d28.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/68d111cd7800e1d91b41d4955cf8cf5921f34130&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/68d111cd7800e1d91b41d4955cf8cf5921f34130&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2281485" author="xgen-internal-githook" created="Wed, 12 Jun 2019 17:04:27 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Blake Oler&apos;, &apos;email&apos;: &apos;blake.oler@mongodb.com&apos;, &apos;username&apos;: &apos;BlakeIsBlake&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40791&quot; title=&quot;Chunk migration clone blocks behind prepared transactions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40791&quot;&gt;&lt;del&gt;SERVER-40791&lt;/del&gt;&lt;/a&gt; Track multi-statement transaction operations for migrations at commit time&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/dfa8658c18142c560447c7bf6f34a6f788593d28&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/dfa8658c18142c560447c7bf6f34a6f788593d28&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2229838" author="siyuan.zhou@10gen.com" created="Tue, 30 Apr 2019 20:12:50 +0000"  >&lt;p&gt;I investigated &lt;tt&gt;transaction_participant.cpp&lt;/tt&gt;, I think we could add a new opObserver function since storage transaction commit can never fail, but I&apos;m concerned that it requires the OpObserver and its caller to know a lot of details of each other, violating the abstraction of observer pattern and making the maintenance of OpObserver harder in the future.&lt;/p&gt;

&lt;p&gt;Another idea is to move &lt;tt&gt;onPreparedTransactionCommit()&lt;/tt&gt; before committing the storage transaction. Since we don&apos;t allow storage transaction commit to fail, both data WT transaction and oplog WT transaction will commit. To make sure the oplog write isn&apos;t visible before the data change so that afterCluterTime read are respected, we need to reserve an OplogSlot without using it and release it after both data and oplog writes commit as we will do in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40870&quot; title=&quot;OpObserverImpl::onTransactionPrepare() reserves OplogSlots rather than using the one reserved by its caller&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40870&quot;&gt;&lt;del&gt;SERVER-40870&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The third idea is to release the recovery unit and the locker from the WUOW and manage them manually on prepared commit, so that we only commit the recovery unit in &lt;tt&gt;_commitStorageTransaction()&lt;/tt&gt; instead of committing the WUOW and have the locker outlive both data and oplog writes. We&apos;ll need storage team to weigh in about this.&lt;/p&gt;

&lt;p&gt;I&apos;d prefer Blake&apos;s second solution to always add recovery unit onCommit handlers on multi-statement transaction CRUD ops if we can avoid unowned BSON copies, since when onCommit() is called on recovery unit, it&apos;s the right time to check committed data by design, avoiding blurring the boundary of sharding and transaction as we saw in other alternatives.&lt;/p&gt;</comment>
                            <comment id="2229740" author="blake.oler" created="Tue, 30 Apr 2019 19:11:36 +0000"  >&lt;p&gt;After some in-person discussion with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=renctan&quot; class=&quot;user-hover&quot; rel=&quot;renctan&quot;&gt;renctan&lt;/a&gt;, and myself, we have decided on the following:&lt;/p&gt;

&lt;p&gt;We want to be know the amount and complexity of work it would take to allow migrations to start cloning while ignoring prepare conflicts.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt; will investigate if it is possible to create a new opObserver function that can run &lt;a href=&quot;https://github.com/mongodb/mongo/blob/f7a4c4a9632f75996ed607ffc77e2a3cab15ea88/src/mongo/db/transaction_participant.cpp#L1263-L1266&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;before we commit the storage transaction&lt;/a&gt; on prepared transaction commit. This will allow us to avoid locking issues that were found in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-39926&quot; title=&quot;Migrations may not transfer writes from prepared transactions committed during cloning phase&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-39926&quot;&gt;&lt;del&gt;SERVER-39926&lt;/del&gt;&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;I will investgate if it is possible to forgo hooking onto the onCommit/onPrepare observers completely. I will mock up a POC to see if it possible and performant to &lt;em&gt;always&lt;/em&gt; add &lt;a href=&quot;https://github.com/mongodb/mongo/blob/f7a4c4a9632f75996ed607ffc77e2a3cab15ea88/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp#L106-L141&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;RecoveryUnit onCommit handlers&lt;/a&gt; on multi-statement transaction CRUD ops. This way, we could check if a migration exists &lt;em&gt;while executing callback handlers&lt;/em&gt;, guaranteeing that we will never miss committed transaction writes that concern a chunk being migrated.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;After our separate investigations, we will decide which approach is the better approach to pursue.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2100837">SERVER-68361</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2376240">SERVER-78414</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2376241">SERVER-78415</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2173451">SERVER-71028</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="214937" name="prepare_transaction_then_migrate.js" size="1931" author="blake.oler@mongodb.com" created="Tue, 23 Apr 2019 20:04:33 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16775"><![CDATA[v4.2]]></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, 26 Apr 2019 14:40:33 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 33 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>
                            4 years, 33 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.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>blake.oler@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>siyuan.zhou@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|huvfav:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huj1zr:</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="2967">Sharding 2019-06-03</customfieldvalue>
    <customfieldvalue id="3002">Sharding 2019-06-17</customfieldvalue>
    <customfieldvalue id="3003">Sharding 2019-07-01</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|huv1k7:</customfieldvalue>

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