<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:24:49 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>[DRIVERS-2141] Prohibit retryable writes for write commands targeting unreplicated local collection</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-2141</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;p&gt;Attempting to write to the &lt;tt&gt;local&lt;/tt&gt; database results in the following server error from &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.2.0-rc3/src/mongo/db/repl/oplog.cpp#L508&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;db/repl/oplog.cpp&lt;/a&gt;:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;retryable writes is not supported for unreplicated ns: %s&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I expect this error relates to this &lt;a href=&quot;https://docs.mongodb.com/manual/reference/local-database/#restrictions&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;notable restriction&lt;/a&gt; in the MongoDB manual. While the restriction refers to multi-document transactions, I assume it overlaps with the common tooling used for retryable writes (e.g. &lt;tt&gt;txnNumber&lt;/tt&gt;).&lt;/p&gt;

&lt;p&gt;I caught this error when upgrading PHPC to a version of libmongoc that had enabled retryable writes by default. The particular test was &lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/blob/master/tests/replicaset/manager-selectserver-001.phpt&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;replicaset/manager-selectserver-001.phpt&lt;/a&gt;, which attempts to insert some documents into a &lt;tt&gt;local.example&lt;/tt&gt; collection. I don&apos;t recall any particular reason it uses the the &lt;tt&gt;local&lt;/tt&gt; database, and this could easily be changed to use a replicated database, but it did highlight a potential conflict I think may have been overlooked.&lt;/p&gt;

&lt;p&gt;It&apos;s possible this conflict could introduce unexpected errors in applications that write to collections in the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/local-database/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;local&lt;/tt&gt; database&lt;/a&gt;. This is certainly an edge case, but the same could be said for MMAPv1 users in SPEC-1345.&lt;/p&gt;

&lt;p&gt;I can think of two approaches off the top of my head:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Document this conflict in drivers. We can also suggest that the DOCS team update their &lt;a href=&quot;https://docs.mongodb.com/manual/reference/local-database/#restrictions&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;notable restriction&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;Amend the spec to prohibit retryable writes for write commands targeting the &lt;tt&gt;local&lt;/tt&gt; database. This should be possible without inspecting the command document, since we could inspect the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/message/OP_MSG.rst#global-command-arguments&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;global $db argument&lt;/a&gt; (for OP_MSG). This would require code changes in drivers.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note: I&apos;m only referring to &quot;local&quot; in this ticket as it&apos;s the only unreplicated collection that I&apos;m aware of. If others are possible, that may complicate the suggestion to implement checks.&lt;/p&gt;</description>
                <environment></environment>
        <key id="869027">DRIVERS-2141</key>
            <summary>Prohibit retryable writes for write commands targeting unreplicated local collection</summary>
                <type id="14901" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14700&amp;avatarType=issuetype">Spec Change</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="-1">Unassigned</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Fri, 19 Jul 2019 21:52:31 +0000</created>
                <updated>Thu, 31 Mar 2022 14:03:49 +0000</updated>
                                                                <component>Retryability</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2408798" author="jmikola@gmail.com" created="Thu, 5 Sep 2019 13:56:15 +0000"  >&lt;p&gt;Thanks &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;, that clears out any outstanding questions about server behavior. I&apos;m moving this back to Open to shuffle it back to the drivers backlog.&lt;/p&gt;</comment>
                            <comment id="2374682" author="kaloian.manassiev" created="Fri, 16 Aug 2019 10:41:53 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jmikola&quot; class=&quot;user-hover&quot; rel=&quot;jmikola&quot;&gt;jmikola&lt;/a&gt;, apologies for the delayed reply here, somehow it slipped out of my attention.&lt;/p&gt;

&lt;p&gt;First, your observation is correct that &lt;b&gt;both&lt;/b&gt; transactions and retryable writes to non-replicated collections are prohibited and the check that you linked uses the presence of &lt;tt&gt;txnNumber&lt;/tt&gt; to cover both. The reason to block retryable writes to non-replicated collections is because we use the oplog in order to provide retryability.&lt;/p&gt;

&lt;p&gt;In addition to &lt;tt&gt;local&lt;/tt&gt;, there is another unreplicated collection (config.transactions), but that one is not supposed to be written by customers anyways, so I don&apos;t think it is worth mentioning in the documents.&lt;/p&gt;

&lt;p&gt;Your proposal to update the drivers spec to indicate that retryable writes must not be perform against &lt;tt&gt;local&lt;/tt&gt; seems the most prudent thing to do (and I can&apos;t think of anything else we can do anyways).&lt;/p&gt;

&lt;p&gt;Is there anything else here that you needed from the server team?&lt;/p&gt;</comment>
                            <comment id="2337129" author="jmikola@gmail.com" created="Mon, 22 Jul 2019 18:04:28 +0000"  >&lt;blockquote&gt;&lt;p&gt;Jeremy, I have created &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-42317&quot; title=&quot;Investigate - Prohibit retryable writes for write commands targeting unreplicated local collection (SPEC-1377)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-42317&quot;&gt;&lt;del&gt;SERVER-42317&lt;/del&gt;&lt;/a&gt; to triage the request in the Sharding board&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Thanks, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ratika.gandhi&quot; class=&quot;user-hover&quot; rel=&quot;ratika.gandhi&quot;&gt;ratika.gandhi&lt;/a&gt;. Seems like a better option to track both tasks independently, as the drivers team will still need to triage this SPEC ticket.&lt;/p&gt;</comment>
                            <comment id="2337097" author="ratika.gandhi" created="Mon, 22 Jul 2019 17:55:31 +0000"  >&lt;p&gt;Jeremy, I have created&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-42317&quot; title=&quot;Investigate - Prohibit retryable writes for write commands targeting unreplicated local collection (SPEC-1377)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-42317&quot;&gt;&lt;del&gt;SERVER-42317&lt;/del&gt;&lt;/a&gt; to triage the request in the Sharding board. Hope this is okay.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2337054" author="esha.maharishi@10gen.com" created="Mon, 22 Jul 2019 17:46:38 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jmikola&quot; class=&quot;user-hover&quot; rel=&quot;jmikola&quot;&gt;jmikola&lt;/a&gt;, if you don&apos;t mind, I&apos;m assigning this to the sharding backlog so that it shows up at our triage meeting.&lt;/p&gt;</comment>
                            <comment id="2337012" author="esha.maharishi@10gen.com" created="Mon, 22 Jul 2019 17:28:04 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jmikola&quot; class=&quot;user-hover&quot; rel=&quot;jmikola&quot;&gt;jmikola&lt;/a&gt;, there are other internal collections that are not replicated in the normal way, like config.transactions.&lt;/p&gt;</comment>
                            <comment id="2336994" author="jmikola@gmail.com" created="Mon, 22 Jul 2019 17:22:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt;: While you&apos;re asking, perhaps you can clarify the following outstanding question:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I&apos;m only referring to &quot;local&quot; in this ticket as it&apos;s the only unreplicated collection that I&apos;m aware of. If others are possible, that may complicate the suggestion to implement checks.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;If &quot;local&quot; really is the only always-unreplicated database to worry about, I think blacklisting it may be viable; however, I wouldn&apos;t want to consider that if it&apos;s possible for other databases to be unreplicated. AFAIK, users can&apos;t configure a database to be unreplicated, so I may just need to confirm that &quot;local&quot; is the only one used by the server internally.&lt;/p&gt;</comment>
                            <comment id="2336963" author="esha.maharishi@10gen.com" created="Mon, 22 Jul 2019 17:12:44 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jmikola&quot; class=&quot;user-hover&quot; rel=&quot;jmikola&quot;&gt;jmikola&lt;/a&gt;, sharding is the right team, but I&apos;m not sure what we specifically want to do - both of the options you suggested seem plausible to me. I will bring it up to the sharding team in #server-sharding.&lt;/p&gt;</comment>
                            <comment id="2335092" author="jmikola@gmail.com" created="Fri, 19 Jul 2019 23:02:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt;: I asked in &lt;tt&gt;#server&lt;/tt&gt; and was told that the sharding team is responsible for the &lt;tt&gt;mongo&lt;/tt&gt; client&apos;s driver-like behavior. In this case, determining if a &lt;tt&gt;txnNumber&lt;/tt&gt; should be added to an outgoing write command. Is this something you can chime in on?&lt;/p&gt;</comment>
                            <comment id="2335072" author="david.golden" created="Fri, 19 Jul 2019 22:27:34 +0000"  >&lt;p&gt;I think we need to skip retrying writes to &quot;local&quot;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="870204">SERVER-42317</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="869037">PHPC-1412</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                            <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10951" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Driver Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10748"><![CDATA[Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6nfr:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>