<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:01:47 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-2998] mongos does not guarantee ordering between getmores and unchecked write operations run on the same connection</title>
                <link>https://jira.mongodb.org/browse/SERVER-2998</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;c = t.find( {$or:[&lt;/p&gt;
{a:2}
&lt;p&gt;,&lt;/p&gt;
{b:3}
&lt;p&gt;,&lt;/p&gt;
{c:4}
&lt;p&gt;]} ).batchSize( 2 );&lt;br/&gt;
c.next();&lt;br/&gt;
t.remove( &lt;/p&gt;
{b:3}
&lt;p&gt; );&lt;br/&gt;
assert.eq.automsg( &quot;3&quot;, c.itcount() );&lt;/p&gt;

&lt;p&gt;The first getmore, caused by itcount(), may happen either before or after the remove if mediated by mongos.  The following workaround is currently needed:&lt;/p&gt;

&lt;p&gt;c = t.find( {$or:[&lt;/p&gt;
{a:2}
&lt;p&gt;,&lt;/p&gt;
{b:3}
&lt;p&gt;,&lt;/p&gt;
{c:4}
&lt;p&gt;]} ).batchSize( 2 );&lt;br/&gt;
c.next();&lt;br/&gt;
t.remove( &lt;/p&gt;
{b:3}
&lt;p&gt; );&lt;br/&gt;
db.getLastError();&lt;br/&gt;
assert.eq.automsg( &quot;3&quot;, c.itcount() );&lt;/p&gt;

&lt;p&gt;Here is an example logging expected behavior from the above script:&lt;/p&gt;

&lt;p&gt;m30001| Mon Apr 25 23:31:42 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn4&amp;#93;&lt;/span&gt; query test.jstests_or5 ntoreturn:2 reslen:102 nreturned:2 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:31:42 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn4&amp;#93;&lt;/span&gt; remove test.jstests_or5  query: &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt; 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:31:42 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8&amp;#93;&lt;/span&gt; getmore test.jstests_or5 cid:4546250274389464629 ntoreturn:2 getMore: { $or: [ &lt;/p&gt;
{ a: 2.0 }
&lt;p&gt;, &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt;, &lt;/p&gt;
{ c: 4.0 }
&lt;p&gt; ] }  bytes:86 nreturned:2 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:31:42 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8&amp;#93;&lt;/span&gt; getmore test.jstests_or5 cid:4546250274389464629 ntoreturn:2 getMore: { $or: [ &lt;/p&gt;
{ a: 2.0 }
&lt;p&gt;, &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt;, &lt;/p&gt;
{ c: 4.0 }
&lt;p&gt; ] }  bytes:20 nreturned:0 0ms&lt;/p&gt;

&lt;p&gt;Here is an example of unexpected behavior that sometimes occurs:&lt;/p&gt;

&lt;p&gt;m30001| Mon Apr 25 23:11:51 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn4&amp;#93;&lt;/span&gt; query test.jstests_or5 ntoreturn:2 reslen:102 nreturned:2 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:11:51 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8&amp;#93;&lt;/span&gt; getmore test.jstests_or5 cid:5426795093500586304 ntoreturn:2 getMore: { $or: [ &lt;/p&gt;
{ a: 2.0 }
&lt;p&gt;, &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt;, &lt;/p&gt;
{ c: 4.0 }
&lt;p&gt; ] }  bytes:86 nreturned:2 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:11:51 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8&amp;#93;&lt;/span&gt; getmore test.jstests_or5 cid:5426795093500586304 ntoreturn:2 getMore: { $or: [ &lt;/p&gt;
{ a: 2.0 }
&lt;p&gt;, &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt;, &lt;/p&gt;
{ c: 4.0 }
&lt;p&gt; ] }  bytes:86 nreturned:2 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:11:51 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8&amp;#93;&lt;/span&gt; getmore test.jstests_or5 cid:5426795093500586304 ntoreturn:2 getMore: { $or: [ &lt;/p&gt;
{ a: 2.0 }
&lt;p&gt;, &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt;, &lt;/p&gt;
{ c: 4.0 }
&lt;p&gt; ] }  bytes:20 nreturned:0 0ms&lt;br/&gt;
m30001| Mon Apr 25 23:11:51 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn4&amp;#93;&lt;/span&gt; remove test.jstests_or5  query: &lt;/p&gt;
{ b: 3.0 }
&lt;p&gt; 0ms&lt;/p&gt;


&lt;p&gt;As far as I know there is a single connection from mongo to mongos in these examples, but there seem to be two connections from mongos to mongod and this causes the unexpected operation ordering.&lt;/p&gt;</description>
                <environment></environment>
        <key id="16338">SERVER-2998</key>
            <summary>mongos does not guarantee ordering between getmores and unchecked write operations run on the same connection</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="aaron">Aaron Staple</reporter>
                        <labels>
                            <label>RachitaD</label>
                    </labels>
                <created>Tue, 26 Apr 2011 07:03:00 +0000</created>
                <updated>Tue, 12 Dec 2023 15:53:09 +0000</updated>
                                                            <fixVersion>features we&amp;#39;re not sure of</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="29813" author="eliot" created="Wed, 27 Apr 2011 05:29:41 +0000"  >&lt;p&gt;@andrew, no, it doesn&apos;t violate read your own writes.  writes after an initial query before other getMore calls might not be seen, but you can&apos;t rely on that since you don&apos;t know the batch sizes, etc...&lt;br/&gt;
the actual query is guaranteed on the same connection&lt;/p&gt;</comment>
                            <comment id="29812" author="plasma" created="Wed, 27 Apr 2011 05:18:40 +0000"  >&lt;p&gt;I&apos;m not sure if this is entirely related to the problem, but I know from experience with MySQL in the past that without explicitly providing an &apos;order by&apos; clause, if you attempt to page this result set (such as LIMIT 0, 20..., LIMIT 20, 20, ....) you may re-read previous records because the underlying data has changed (or just happened to be fetched differently on your second query), so paging an unordered result set (like your above example) has undefined behavior I suppose.&lt;/p&gt;

&lt;p&gt;Our fix for that particular problem was to simply just order by an id field (something consistent that was indexed) which then did provide consistent behavior.&lt;/p&gt;

&lt;p&gt;PS: Isn&apos;t your example violating the &apos;read your own writes&apos; property that is currently expected?&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</comment>
                            <comment id="29774" author="aaron" created="Tue, 26 Apr 2011 22:07:29 +0000"  >&lt;p&gt;Just wanted to add a note that we&apos;ve seen similar behavior with ordering between an unchecked write and an admin command.  Apparently the admin commands use a separate connection from mongos to mongod.&lt;/p&gt;</comment>
                            <comment id="29648" author="eliot" created="Tue, 26 Apr 2011 15:33:46 +0000"  >&lt;p&gt;Ithink its as designed.&lt;br/&gt;
The only reason it came up is that there were tests that relied on ordering, and mongos doesn&apos;t guarantee.&lt;/p&gt;</comment>
                            <comment id="29647" author="dwight_10gen" created="Tue, 26 Apr 2011 15:30:45 +0000"  >&lt;p&gt;it&apos;s normal for getmores to be lazy, so i wonder, is this actually a problem or works as designed?&lt;/p&gt;</comment>
                            <comment id="29638" author="auto" created="Tue, 26 Apr 2011 07:15:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2998&quot; title=&quot;mongos does not guarantee ordering between getmores and unchecked write operations run on the same connection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2998&quot;&gt;SERVER-2998&lt;/a&gt; workarounds&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ef0cae716fe0a1433ec7531ffa1a4f746d8336c4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ef0cae716fe0a1433ec7531ffa1a4f746d8336c4&lt;/a&gt;&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>6.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, 26 Apr 2011 07:15:24 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 43 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_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 years, 43 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>plasma</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>backlog-server-cluster-scalability</customfieldvalue>
            <customfieldvalue>dwight@mongodb.com</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp0wf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrg0an:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6582</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|hszwyv:</customfieldvalue>

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