<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:51:23 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-83153] Consider handling WouldChangeOwningShard errors at a lower level</title>
                <link>https://jira.mongodb.org/browse/SERVER-83153</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I&apos;m filing this ticket as a suggestion to be considered whenever PM-2015 is done and we switch to using the internal transactions API for handling shard key updates that change a document&apos;s owning shard.&#160;&lt;/p&gt;

&lt;p&gt;Currently, the logic to handle WouldChangeOwningShard errors lives at the command processing layer on mongos. I think this logic is arguably better suited to live at the execution layer (batch_write_exec / bulk_write_exec) of the code.&lt;/p&gt;

&lt;p&gt;Conceptually, I think this type of write is similar to other types of special writes we handle at the execution layer, such as writes that use the two-phase protocol or retryable timeseries updates, where we have a single user write statement that ends up getting executed as multiple transactional write statements.&lt;/p&gt;

&lt;p&gt;I think WCOS could be treated like a &quot;retryable error&quot; akin to StaleConfig where, once we receive that error on our first attempt to execute the write, we mark it is a WouldChangeOwningShard write and save the WCOS info, and indicate that it needs retargeting, and then on our next round of targeting/execution we can execute it as the transactional delete + insert.&lt;/p&gt;

&lt;p&gt;I think this change would help to lift the restriction we currently have that WCOS writes must be sent in their own batch from the client. The current design contributes to that restriction because for an ordered batch/bulk write, the execution layer code will always stop execution of the batch after seeing an error.&#160; We can&apos;t just tell that logic to continue after seeing WCOS though, because we don&apos;t know whether the logic to handle the WCOS will end up succeeding later or not and so if we execute the later writes before WCOS is handled we can end up violating the contract of ordered writes. If the execution layer were to handle WCOS directly, then it could just continue to process more writes in the batch as normal after performing the WCOS update, without having to return control to the command layer.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2497775">SERVER-83153</key>
            <summary>Consider handling WouldChangeOwningShard errors at a lower level</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="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-cluster-scalability">Backlog - Cluster Scalability</assignee>
                                    <reporter username="kaitlin.mahar@mongodb.com">Kaitlin Mahar</reporter>
                        <labels>
                    </labels>
                <created>Sun, 12 Nov 2023 16:12:09 +0000</created>
                <updated>Tue, 12 Dec 2023 15:43:34 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5882154" author="kaitlin.mahar" created="Wed, 15 Nov 2023 15:16:40 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=max.hirschhorn%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;max.hirschhorn@mongodb.com&quot;&gt;max.hirschhorn@mongodb.com&lt;/a&gt; Nice! That sounds even better.&lt;/p&gt;</comment>
                            <comment id="5879784" author="max.hirschhorn@10gen.com" created="Tue, 14 Nov 2023 18:50:06 +0000"  >&lt;p&gt;I agree with Kaitlin that the WouldChangeOwningShard error ought to be handled at a lower layer of the system. I think we can get the behavior of updating a document&apos;s shard key value to be handled internally by mongod once shards are able to add new participants to transactions (PM-2844) when the client operation is already inside a transaction. When the client operation is part of a retryable write then a retryable internal transaction can be issued between the two shards by the shard which currently owns the document.&lt;/p&gt;

&lt;p&gt;To say it another way, I expect we can eventually remove the WouldChangeOwningShard error altogether and instead do the write on the remote shard within UpdateStage directly.&lt;/p&gt;</comment>
                            <comment id="5879561" author="jason.zhang" created="Tue, 14 Nov 2023 17:51:26 +0000"  >&lt;p&gt;I do like this idea, since we already have precedent with special cased writes (timeseries, writewithoutshardkey, _id, etc.) It would require us  to add in a new write type (WouldChangeOwningShard) that transactionally executes the delete and insert likely using the transaction API. Certainly do-able just would require a bit of work to add in and track this new write type (and delete the old path).&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26583"><![CDATA[Cluster Scalability]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 14 Nov 2023 17:51:26 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2844</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>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-cluster-scalability</customfieldvalue>
            <customfieldvalue>jason.zhang@mongodb.com</customfieldvalue>
            <customfieldvalue>kaitlin.mahar@mongodb.com</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i302hr:</customfieldvalue>

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

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