<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:41:13 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-35849] Remove dependency of the write commands on `sharding_runtime_d`</title>
                <link>https://jira.mongodb.org/browse/SERVER-35849</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The write commands execution logic handles StaleConfig exceptions differently from regular commands because of the need to contain the exception as part of the array of write results and not as part of the command result itself. Specifically, it does not let the exception bubble-up to the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/60559a00b81293184922b3418a8e56610edf8dd9/src/mongo/db/service_entry_point_common.cpp#L904&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;endpoint code&lt;/a&gt; and instead &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1be62ec4da5968f243e949dfb3cab68157f6ef1c/src/mongo/db/ops/write_ops_exec.cpp#L239&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;invokes&lt;/a&gt; onShardVersionMismatch or onCannotImplicitlyCreateCollection directly. &lt;/p&gt;

&lt;p&gt;This causes a linking dependency of the write commands library on sharding_runtime_d, but also introduces more places where onShardVersionMismatch could be called, which could be a source of bugs.&lt;/p&gt;

&lt;p&gt;This ticket is to figure out an implementation, which consolidates the onShardVersionMismatch actions in one place (preferably the entry point) and to remove the link dependency on sharding_runtime_d.&lt;/p&gt;</description>
                <environment></environment>
        <key id="564879">SERVER-35849</key>
            <summary>Remove dependency of the write commands on `sharding_runtime_d`</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="cheahuychou.mao@mongodb.com">Cheahuychou Mao</assignee>
                                    <reporter username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 Jun 2018 19:59:07 +0000</created>
                <updated>Mon, 8 Jan 2024 15:23:18 +0000</updated>
                            <resolved>Thu, 19 Jul 2018 17:21:00 +0000</resolved>
                                                    <fixVersion>4.0.2</fixVersion>
                    <fixVersion>4.1.1</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1971423" author="acm" created="Thu, 9 Aug 2018 14:32:42 +0000"  >&lt;p&gt;No, apparently I just can&apos;t read. I saw the declines but not the completed.&lt;/p&gt;</comment>
                            <comment id="1969768" author="xgen-internal-githook" created="Tue, 7 Aug 2018 22:04:52 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;cheahuychou&apos;, &apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;cheahuychou.mao@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35849&quot; title=&quot;Remove dependency of the write commands on `sharding_runtime_d`&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35849&quot;&gt;&lt;del&gt;SERVER-35849&lt;/del&gt;&lt;/a&gt; Remove dependency of the write commands on sharding_runtime_d&lt;/p&gt;

&lt;p&gt;(cherry picked from commit a8e4cedfc7d7f48ac59fc4860ca6d8519421fdf5)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8531b53c6a61bbaecb0ec1440a4103a020e645d8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8531b53c6a61bbaecb0ec1440a4103a020e645d8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1951460" author="xgen-internal-githook" created="Thu, 19 Jul 2018 17:20:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;cheahuychou.mao@mongodb.com&apos;, &apos;username&apos;: &apos;cheahuychou&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-35849&quot; title=&quot;Remove dependency of the write commands on `sharding_runtime_d`&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-35849&quot;&gt;&lt;del&gt;SERVER-35849&lt;/del&gt;&lt;/a&gt; Remove dependency of the write commands on sharding_runtime_d&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a8e4cedfc7d7f48ac59fc4860ca6d8519421fdf5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a8e4cedfc7d7f48ac59fc4860ca6d8519421fdf5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1935299" author="schwerin" created="Fri, 29 Jun 2018 19:49:37 +0000"  >&lt;p&gt;OK. Please CC me on the code review.&lt;/p&gt;</comment>
                            <comment id="1933790" author="kaloian.manassiev" created="Thu, 28 Jun 2018 14:53:05 +0000"  >&lt;p&gt;It will break it because write commands will no longer be calling into &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1be62ec4da5968f243e949dfb3cab68157f6ef1c/src/mongo/db/ops/write_ops_exec.cpp#L239&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;onShardVersionMismatch&lt;/a&gt; directly. That way we can throw out the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1be62ec4da5968f243e949dfb3cab68157f6ef1c/src/mongo/db/ops/SConscript#L18&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;dependency&lt;/a&gt; on sharding_runtime_d.&lt;/p&gt;</comment>
                            <comment id="1933781" author="renctan" created="Thu, 28 Jun 2018 14:49:24 +0000"  >&lt;p&gt;Sounds good to me, but how would this break the dependency?&lt;/p&gt;</comment>
                            <comment id="1933620" author="kaloian.manassiev" created="Thu, 28 Jun 2018 13:56:07 +0000"  >&lt;p&gt;The refresh from the config server itself is happening on a separate thread. The work which will be done in the destructor is no different than what is happening today in the exception handler - 1) wait for the critical section to complete and 2) when the CS completes, wait for the refresh thread to complete and install the refreshed metadata on the CSS (under collection X lock).&lt;/p&gt;

&lt;p&gt;If timeout or interruption occurs during either 1 or 2 today, the thread just ignores it and returns back to mongos, which will retry. In other words, exceptions will never propagate out of the destructor, just like they &lt;a href=&quot;https://github.com/mongodb/mongo/blob/edff161ae08327f17f284bac638bdebc72404421/src/mongo/db/s/shard_filtering_metadata_refresh.cpp#L53&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;never propagate&lt;/a&gt; out of the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/edff161ae08327f17f284bac638bdebc72404421/src/mongo/db/service_entry_point_common.cpp#L904&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;exception handler&lt;/a&gt; today.&lt;/p&gt;</comment>
                            <comment id="1933200" author="schwerin" created="Thu, 28 Jun 2018 00:10:25 +0000"  >&lt;p&gt;I&apos;m nervous about the refresh in the destructor. Why can&apos;t it timeout or get interrupted?&lt;/p&gt;</comment>
                            <comment id="1933068" author="kaloian.manassiev" created="Wed, 27 Jun 2018 20:09:53 +0000"  >&lt;p&gt;Since all StaleConfig exceptions originate in either CollectionShardingState&apos;s or DatabaseShardingState&apos;s version checking logic, I propose that we use the OperationShardingState as a way to convey that a certain operation needs to perform shard version refresh and blockage on completion.&lt;/p&gt;

&lt;p&gt;The OperationShardingState will contain a &lt;tt&gt;boost::optional&amp;lt;Status&amp;gt; _shardingOperationFailedStatus&lt;/tt&gt;, which will be set to one of the exceptions which require post-command execution actions (for now these are StaleConfig, StaleDbVersion, CannotImplicitlyCreateCollection).&lt;/p&gt;

&lt;p&gt;There will be a RAII class ScopedOperationCompletionShardingActions, which in its destructor will inspect the exception (if any) stored in the OperationShardingState and will perform the necessary refresh. These operations currently never need to throw, so this destructor will also never throw.&lt;/p&gt;

&lt;p&gt;The ScopedOperationCompletionShardingActions will be instantiated in the beginning of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/60559a00b81293184922b3418a8e56610edf8dd9/src/mongo/db/service_entry_point_common.cpp#L1270&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;ServiceEntryPointCommon::handleRequest&lt;/tt&gt;&lt;/a&gt; in order to ensure that it covers all requests.&lt;/p&gt;

&lt;p&gt;The destructor of ~ScopedOperationCompletionShardingActions will serve as the only place where &quot;sharding refresh&quot; actions will be executed.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=schwerin&quot; class=&quot;user-hover&quot; rel=&quot;schwerin&quot;&gt;schwerin&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mira.carey%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;mira.carey@mongodb.com&quot;&gt;mira.carey@mongodb.com&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; - how does this sound?&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">
                                        <issuelink>
            <issuekey id="399018">SERVER-29908</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="346480">SERVER-27725</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="15640"><![CDATA[v4.0]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 28 Jun 2018 00:10:25 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 26 weeks, 6 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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 26 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>cheahuychou.mao@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
            <customfieldvalue>randolph@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu1jqv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htsbtb:</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="2386">Sharding 2018-07-16</customfieldvalue>
    <customfieldvalue id="2387">Sharding 2018-07-30</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|hu1607:</customfieldvalue>

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