<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:14:15 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-27127] drop() regression heisenbug</title>
                <link>https://jira.mongodb.org/browse/SERVER-27127</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In developing mongocxx, I stumbled across a bug where a collection drop followed immediately by a count on the collection with an empty document filter doesn&apos;t always return a count of zero.  This occurs in fixture code, so the collection is being repeatedly filled and dropped for different tests.&lt;/p&gt;

&lt;p&gt;The problem was seen on some (but only some) test runs on 3.4-rc1, 3.4-rc3 and 3.4-rc4.  (3.4-rc2 was not tested).  The problem did not occur on 3.2.9 or 3.2.11.&lt;/p&gt;

&lt;p&gt;Replacing the drop with multi-document delete does not exhibit the problem on any of the 3.4 rc&apos;s.&lt;/p&gt;

&lt;p&gt;I don&apos;t have time to do a more complete investigation, but I wanted to file a ticket so that it wasn&apos;t lost and others could explore it.&lt;/p&gt;

&lt;p&gt;The failing test code can be seen here: &lt;a href=&quot;https://github.com/xdg/mongo-cxx-driver/blob/CXX-894-server-bug-demo/src/mongocxx/test/collection.cpp#L98-L103&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/xdg/mongo-cxx-driver/blob/CXX-894-server-bug-demo/src/mongocxx/test/collection.cpp#L98-L103&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tests were run on my macbook.&lt;/p&gt;</description>
                <environment></environment>
        <key id="333049">SERVER-27127</key>
            <summary>drop() regression heisenbug</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="9">Done</resolution>
                                        <assignee username="milkie@mongodb.com">Eric Milkie</assignee>
                                    <reporter username="david.golden@mongodb.com">David Golden</reporter>
                        <labels>
                    </labels>
                <created>Sat, 19 Nov 2016 02:50:38 +0000</created>
                <updated>Tue, 22 Nov 2016 13:53:20 +0000</updated>
                            <resolved>Mon, 21 Nov 2016 21:25:55 +0000</resolved>
                                    <version>3.4.0-rc1</version>
                    <version>3.4.0-rc3</version>
                    <version>3.4.0-rc4</version>
                                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1440013" author="milkie" created="Tue, 22 Nov 2016 13:53:20 +0000"  >&lt;p&gt;I think the crux of the problem is defining &quot;writes arriving prior to time X&quot;, since &quot;unacknowledged write concern&quot; is not something one can use with strict ordering guarantees.  When you do define a write as having arrived?&lt;br/&gt;
If you use &quot;acknowledged write concern&quot;, I don&apos;t believe there is any issue between writes and drops.&lt;/p&gt;</comment>
                            <comment id="1439472" author="david.golden" created="Mon, 21 Nov 2016 21:34:37 +0000"  >&lt;p&gt;FWIW, I agree the 3.4 behavior is technically &quot;correct&quot; (sequential consistency) but may be surprising to customers who still tend to think transactionally.&lt;/p&gt;

&lt;p&gt;Given historical scrutiny of our consistency guarantees, the bigger question is what model we want to provide for collection drops?  Do we think customers want a linearizable drop?  I.e. &quot;At time X, I dropped the collection, so I know that no writes arriving prior to time X are in the collection.&quot;&lt;/p&gt;

&lt;p&gt;Under the current 3.4 behavior, how could someone achieve an equivalent?  Spin on drop until count with linearized read concern is zero?  Should we document that in the release notes?&lt;/p&gt;

&lt;p&gt;I&apos;m happy either way we choose, but I&apos;d like to make sure we&apos;re changing vs expectations intentionally, not coincidentally.&lt;/p&gt;</comment>
                            <comment id="1439452" author="milkie" created="Mon, 21 Nov 2016 21:25:55 +0000"  >&lt;p&gt;I believe the 3.4 behavior is still okay.  Thanks for looking into the code, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rassi&quot; class=&quot;user-hover&quot; rel=&quot;rassi&quot;&gt;rassi&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1439363" author="rassi@10gen.com" created="Mon, 21 Nov 2016 19:39:23 +0000"  >&lt;p&gt;In the C++ reproduction case, the unacknowledged inserts on line 50 (performed by server thread N) are racing with the collection drop on line 27 (performed by server thread N+1).  When the drop wins the race, the &quot;Count after drop was 2&quot; message is printed.  If the inserts win the race, the &quot;Count after drop was 0&quot; message is printed.&lt;/p&gt;

&lt;p&gt;Though the reproduction case contains a client-side race, I can confirm that the server version does reliably affect which thread wins this race.  I&apos;ve diagnosed the difference in 3.2 versus 3.4 server behavior to the following:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;In 3.2, when an insert to a non-existent collection is attempted, the inserting thread both creates the collection and performs the insert under a single database X lock.&lt;/li&gt;
	&lt;li&gt;In 3.4, when an insert to a non-existent collection is attempted, the inserting thread creates the collection under a database X lock, and then drops the lock and performs the insert under a database IX lock (if the collection no longer exists when the IX lock is acquired, the process is repeated).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The server changes were made under &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-23128&quot; title=&quot;Refactor write cmd path&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-23128&quot;&gt;&lt;del&gt;SERVER-23128&lt;/del&gt;&lt;/a&gt;, and I can confirm that the repro fails on &lt;a href=&quot;https://github.com/mongodb/mongo/commit/d819ac65d1a0f941bd3e201f343ac04e252c4442&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;d819ac6&lt;/a&gt;, and passes on that commit&apos;s parent.&lt;/p&gt;

&lt;p&gt;When I reproduce locally on a build not incorporating the fix for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-23128&quot; title=&quot;Refactor write cmd path&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-23128&quot;&gt;&lt;del&gt;SERVER-23128&lt;/del&gt;&lt;/a&gt; (3.3.4 and below), the inserts often win the race, and the events are sequenced as written in the test.&lt;/p&gt;

&lt;p&gt;When I reproduce locally on a build incorporating for fix for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-23128&quot; title=&quot;Refactor write cmd path&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-23128&quot;&gt;&lt;del&gt;SERVER-23128&lt;/del&gt;&lt;/a&gt; (3.3.5 and above), the drop is sequenced right after the insert drops its X lock for the collection creation.  The insert operation then creates the collection for the second time and then performs the insert, after the drop, which explains the difference in the collection count.  I&apos;ve uploaded a log level 1 server log file (server27127.log) demonstrating the latter behavior, which shows the first collection creation attempt at 14:21:40.827, and the second collection creation attempt (post-drop) at 14:21:40.854, both for the same unacknowledged insert operation.&lt;/p&gt;

&lt;p&gt;See also attached shell repro (server27127.js), which is similar (but not identical) to C++ driver repro.  The shell repro also exhibits different behavior on 3.3.4 and below versus 3.3.5 and above.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=milkie&quot; class=&quot;user-hover&quot; rel=&quot;milkie&quot;&gt;milkie&lt;/a&gt;/&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=redbeard0531&quot; class=&quot;user-hover&quot; rel=&quot;redbeard0531&quot;&gt;redbeard0531&lt;/a&gt;: could one of you take a look at David&apos;s C++ repro case and say whether we&apos;re okay with shipping the 3.4 behavior?  I personally don&apos;t see any correctness issue with dropping locks in an insert between implicit collection creation and the actual insert, but would like one of you to speak on behalf of the server team here.&lt;/p&gt;</comment>
                            <comment id="1438334" author="david.golden" created="Sat, 19 Nov 2016 19:14:59 +0000"  >&lt;p&gt;I have a repro I&apos;ll attach &amp;#8211; it occurs after unordered bulk insert with write concern set to unacknowledged.  The repro also demonstrates that deleting all documents can also occasionally fail &amp;#8211; though apparently less often.&lt;/p&gt;

&lt;p&gt;Also, note that the drop/count() occurs on a subsequent client connection from the bulk insert. I.e.:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;connection n: drop, count (correct), bulk insert&lt;/li&gt;
	&lt;li&gt;connection n+1: drop, count (wrong), ...&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1438327" author="david.golden" created="Sat, 19 Nov 2016 18:21:51 +0000"  >&lt;p&gt;Standalone, enterprise edition &#8211; just my normal &quot;keep mongod in background for development&quot; arrangement.&lt;/p&gt;

&lt;p&gt;Config file:&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;   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;dbpath = /Users/david/mongodb/var/db&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;logpath = /Users/david/mongodb/var/mongodb.log&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;pidfilepath = /Users/david/mongodb/localhost/mongodb.pid&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;logappend = false&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;port = 27017&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;ipv6=true&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;nohttpinterface = true&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;Startup options: &lt;tt&gt;--setParameter enableTestCommands=1 --enableMajorityReadConcern --fork&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;When confirming the bug, I started mongod with an empty data directory.&lt;/p&gt;</comment>
                            <comment id="1438310" author="schwerin" created="Sat, 19 Nov 2016 16:15:16 +0000"  >&lt;p&gt;Are these tests run against a standalone, a single-node replset, a multi-node replset, or a sharded configuration?&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="144544" name="server21727.js" size="245" author="rassi" created="Mon, 21 Nov 2016 19:29:38 +0000"/>
                            <attachment id="144500" name="server27127.cpp" size="1637" author="david.golden@mongodb.com" created="Sat, 19 Nov 2016 19:15:14 +0000"/>
                            <attachment id="144543" name="server27127.log" size="6285" author="rassi" created="Mon, 21 Nov 2016 19:29:39 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 19 Nov 2016 16:15:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        7 years, 12 weeks, 1 day 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>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>milkie@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 12 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>david.golden@mongodb.com</customfieldvalue>
            <customfieldvalue>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>rassi</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjqbj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hss1y7:</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="1395">Storage 2016-12-12</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Install libmongoc 1.5.0-rc6, checkout the branch from the github link above, build the mongocxx driver and run tests repeatedly.&lt;/p&gt;</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|hs4oxr:</customfieldvalue>

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