<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:38:16 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-78407] Skip read only shard commit phase for two phase writes</title>
                <link>https://jira.mongodb.org/browse/SERVER-78407</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The two phase write protocol for single writes without a shard key match do a broadcast read and then write to a single shard with a matching document. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48340&quot; title=&quot;Re-enable single-write-shard transaction commit optimization&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48340&quot;&gt;&lt;del&gt;SERVER-48340&lt;/del&gt;&lt;/a&gt; restores the single write shard commit optimization, which lets two phase writes skip two phase commit, since they will always write to at most one shard.&lt;/p&gt;

&lt;p&gt;The single write shard optimization has two phases: a round of commits on the read only shards, then if all read only commits were successful, sending commit to the one write shard. Two phase writes can be further optimized to skip the first commit phase because single writes don&apos;t care if read only shards not chosen to perform the write are able to commit. To satisfy the guarantees of a single write (ie only one matching document is updated), it&apos;s enough to only commit on the chosen write shard. Thus commit can become a single phase - committing on the write shard and in parallel committing (or aborting since it&apos;s cheaper) on the read shards (so they release their resources, their responses can be ignored).&lt;/p&gt;</description>
                <environment></environment>
        <key id="2376045">SERVER-78407</key>
            <summary>Skip read only shard commit phase for two phase writes</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="10018" iconUrl="https://jira.mongodb.org/images/icons/statuses/visible.png" description="">In Code Review</status>
                    <statusCategory id="4" key="indeterminate" colorName="inprogress"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="jack.mulrow@mongodb.com">Jack Mulrow</assignee>
                                    <reporter username="jack.mulrow@mongodb.com">Jack Mulrow</reporter>
                        <labels>
                    </labels>
                <created>Fri, 23 Jun 2023 18:26:17 +0000</created>
                <updated>Tue, 28 Nov 2023 18:12:13 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="5540758" author="jack.mulrow" created="Mon, 3 Jul 2023 15:20:46 +0000"  >&lt;p&gt;I agree, I don&apos;t think this is a valid general optimization. The scope of this ticket is just for the &quot;two phase write protocol&quot; for update/deleteOne and findAndModify from PM-1632 (excluding findAndModify with sort since that updates a document matching a collection global property, so we need to know all reads were valid).&lt;/p&gt;</comment>
                            <comment id="5537869" author="max.hirschhorn@10gen.com" created="Fri, 30 Jun 2023 20:07:19 +0000"  >&lt;blockquote&gt;
&lt;p&gt;The single write shard optimization has two phases: a round of commits on the read only shards, then if all read only commits were successful, sending commit to the one write shard. Two phase writes can be further optimized to skip the first commit phase because single writes don&apos;t care if read only shards not chosen to perform the write are able to commit. To satisfy the guarantees of a single write (ie only one matching document is updated), it&apos;s enough to only commit on the chosen write shard.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I&apos;m not sure this will be valid as a general optimization. It may be possible to do something more targeted for updateOne without shard key because the one update is done in its own batch. It is necessary to get an ok:1 response for read concern level &quot;majority&quot; transactions. This is because the speculative majority behavior means committing with w:majority is required to affirm the reads were actually of majority&amp;#45;committed data.&lt;/p&gt;

&lt;p&gt;Where I see the proposal leading to a consistency anomaly would be something like the following sequence:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Client starts a Transaction T1 with {readConcern: {level: &quot;majority&quot;}, writeConcern: {w: &quot;majority&quot;}}.&lt;/li&gt;
	&lt;li&gt;Client performs a read in Transaction T1. Router&amp;#95;1 forwards the read to Shard&amp;#95;1.&lt;/li&gt;
	&lt;li&gt;Client performs a write in Transaction T1. Router&amp;#95;1 forwards the write to Shard&amp;#95;2. Shard&amp;#95;2 as the first writer shard in the transaction is chosen as the recovery shard.&lt;/li&gt;
	&lt;li&gt;Client sends commitTransaction to Router&amp;#95;1.&lt;/li&gt;
	&lt;li&gt;(New proposal) Router&amp;#95;1 broadcasts commitTransaction to Shard&amp;#95;1 and Shard&amp;#95;2. Let&apos;s say Shard&amp;#95;2 commits successfully and Shard&amp;#95;1 fails with a write concern error.&lt;/li&gt;
	&lt;li&gt;Client gets disconnected from Router&amp;#95;1 due to an unexpected network error.&lt;/li&gt;
	&lt;li&gt;Client retries commitTransaction through Router&amp;#95;2, passing along that Shard&amp;#95;2 is the recovery shard.&lt;/li&gt;
	&lt;li&gt;Router&amp;#95;2 recovers the decision from Shard&amp;#95;2 and learns Shard&amp;#95;2 had committed the transaction.&lt;/li&gt;
	&lt;li&gt;Client incorrectly believes the entire transaction successfully committed when the transaction is not known to have committed on Shard&amp;#95;1.&lt;/li&gt;
&lt;/ol&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1357721">SERVER-48340</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2394759">SERVER-79056</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="458110" name="SERVER-78407-POC.diff" size="8915" author="jack.mulrow@mongodb.com" created="Fri, 23 Jun 2023 18:34:26 +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>11.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25134"><![CDATA[Sharding NYC]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 30 Jun 2023 20:07:19 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        31 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_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>lamont.nelson@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            31 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>jack.mulrow@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|i2f7kf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr1pj8:aji005xx</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="7364">Sharding NYC 2023-07-10</customfieldvalue>
    <customfieldvalue id="7365">Sharding NYC 2023-07-24</customfieldvalue>
    <customfieldvalue id="7542">Sharding NYC 2023-08-07</customfieldvalue>
    <customfieldvalue id="7543">Sharding NYC 2023-08-21</customfieldvalue>
    <customfieldvalue id="7544">Sharding NYC 2023-09-04</customfieldvalue>
    <customfieldvalue id="7765">Sharding NYC 2023-09-18</customfieldvalue>
    <customfieldvalue id="7766">Sharding NYC 2023-10-02</customfieldvalue>
    <customfieldvalue id="7767">Sharding NYC 2023-10-16</customfieldvalue>
    <customfieldvalue id="7768">Sharding NYC 2023-10-30</customfieldvalue>
    <customfieldvalue id="7769">Cluster Scalability 2023-11-13</customfieldvalue>
    <customfieldvalue id="7770">Cluster Scalability 2023-11-27</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|i2etpr:</customfieldvalue>

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