<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:31:58 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-32997] Mobile SE: Design and implement multi-reader or single-writer concurrency</title>
                <link>https://jira.mongodb.org/browse/SERVER-32997</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32675&quot; title=&quot;Investigate database locked concurrency bug in mobile SE&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32675&quot;&gt;&lt;del&gt;SERVER-32675&lt;/del&gt;&lt;/a&gt; resolved Mobile SE&apos;s some of the major issues with concurrency. I still see a few tests hitting either write conflicts or DB locked. These tests need to be investigated and a fix made accordingly. This ticket will track that effort.&lt;/p&gt;</description>
                <environment></environment>
        <key id="489376">SERVER-32997</key>
            <summary>Mobile SE: Design and implement multi-reader or single-writer concurrency</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="13201">Fixed</resolution>
                                        <assignee username="sulabh.mahajan@mongodb.com">Sulabh Mahajan</assignee>
                                    <reporter username="sulabh.mahajan@mongodb.com">Sulabh Mahajan</reporter>
                        <labels>
                            <label>SERG</label>
                            <label>nonnyc</label>
                            <label>storage-engines</label>
                    </labels>
                <created>Tue, 30 Jan 2018 06:27:53 +0000</created>
                <updated>Sun, 29 Oct 2023 22:35:20 +0000</updated>
                            <resolved>Mon, 18 Jun 2018 10:30:28 +0000</resolved>
                                                    <fixVersion>4.0.1</fixVersion>
                    <fixVersion>4.1.1</fixVersion>
                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1939048" author="xgen-internal-githook" created="Thu, 5 Jul 2018 06:38:12 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;sulabhM&apos;, &apos;name&apos;: &apos;Sulabh Mahajan&apos;, &apos;email&apos;: &apos;sulabh.mahajan@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32997&quot; title=&quot;Mobile SE: Design and implement multi-reader or single-writer concurrency&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32997&quot;&gt;&lt;del&gt;SERVER-32997&lt;/del&gt;&lt;/a&gt; Implement instance level locking for mobile SE&lt;/p&gt;

&lt;p&gt;(cherry picked from commit cc8aab5249ccdec471e33bda087faecb53a6d9bf)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/bbe1eaa3b463b2f95ff5c8198f55da79991112ef&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/bbe1eaa3b463b2f95ff5c8198f55da79991112ef&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1923132" author="xgen-internal-githook" created="Mon, 18 Jun 2018 10:29:10 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;sulabhM&apos;, &apos;name&apos;: &apos;Sulabh Mahajan&apos;, &apos;email&apos;: &apos;sulabh.mahajan@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32997&quot; title=&quot;Mobile SE: Design and implement multi-reader or single-writer concurrency&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32997&quot;&gt;&lt;del&gt;SERVER-32997&lt;/del&gt;&lt;/a&gt; Implement instance level locking for mobile SE&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/cc8aab5249ccdec471e33bda087faecb53a6d9bf&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/cc8aab5249ccdec471e33bda087faecb53a6d9bf&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1897829" author="sulabh.mahajan" created="Tue, 22 May 2018 00:55:29 +0000"  >&lt;p&gt;I had a discussion with &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; regarding the above approaches and we concluded that it is the best to modify lock manager to support instance level locking for mobile SE. There are places where proper locks are not held when doing reads or writes, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34790&quot; title=&quot;Ensure proper locks are held when doing reads or writes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34790&quot;&gt;&lt;del&gt;SERVER-34790&lt;/del&gt;&lt;/a&gt; is open to address that issue. Global instance lock is likely to face some of these issues.&lt;/p&gt;

&lt;p&gt;The plan proposed for now is to put debug code in the mobile SE to identify places where proper locks from instance manager are not taken. I ran a few tests and I think a few of these issues are in the code related to capped collections, rename collection and validate collections. I am still debugging to get more details.&lt;/p&gt;</comment>
                            <comment id="1892642" author="milkie" created="Wed, 16 May 2018 12:43:52 +0000"  >&lt;p&gt;How is approach 2 different from using instance-level-locking?  Presumably, all the places where we have a WriteUnitOfWork, we have already acquired a Global IX lock, which for instance-level-locking can be a Global X lock instead.  Then you would achieve the same effect as doing internal exclusive locking for WUOW&apos;s.&lt;/p&gt;</comment>
                            <comment id="1892632" author="sulabh.mahajan" created="Wed, 16 May 2018 12:40:40 +0000"  >&lt;p&gt;The patch making fixes for the mobile SE didn&apos;t prove to be useful. The test run showed additional crashes other than the existing locked/busy issues.&lt;/p&gt;

&lt;p&gt;We tried couple of other approaches:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Throw write conflict exception each time a write operation gets a locked/busy state. The idea is that this exception will be caught and the whole operation retried. If tried enough times this operation should go through as it finds itself not conflicting with a parallel operation. We faced couple of issues with this approach:&lt;br/&gt;
   a. There might be places the exception is not caught and retried, or the operation is left in a non idempotent state and a retry messes the system up. When I ran the test over this change, I saw several such issues, crashes and invariant failures.&lt;br/&gt;
   b. This approach isn&apos;t very deterministic and doesn&apos;t build a confidence in how we are handling concurrency &lt;/li&gt;
	&lt;li&gt;Take a transaction when a write unit of work (wuow) goes active. This transaction will be in exclusive mode and will stop all other readers and writers from accessing the database. A commit or rollback of wuow will release the lock, letting other readers proceed, or another single wuow to go active again.&lt;br/&gt;
   a. The assumption with this approach is that no write is done outside the wuow being active. An invariant would help catch cases where this assumption doesnt hold good.&lt;br/&gt;
   b. There will be some work needed in putting the wuow active portions under a reader/writer lock&lt;br/&gt;
   c. Initial tests on a proof of concept change look promising.   &lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="1887692" author="sulabh.mahajan" created="Wed, 9 May 2018 23:58:32 +0000"  >&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; suggested to try the attached patch which implements &lt;tt&gt;supportsDBLocking&lt;/tt&gt; for the mobile SE.&lt;/p&gt;

&lt;p&gt;This is along the lines of the 1st approach as suggested above. This fixes/enhances the lock manager to provide the total instance locking by converting Global IX and IS locking into X and S locks, respectively.&lt;br/&gt;
Benefits of this approach:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Rather than building a new locking inside the SE, it can stay at a single place in the lock manager.&lt;/li&gt;
	&lt;li&gt;By not building locking inside SE, we continue to utilise all the diagnostic and introspection statistics that we currently have for the mongodb lock manager.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We have a meeting setup to continue discussing the solution for this issue. I will put an update as we make progress.&lt;/p&gt;</comment>
                            <comment id="1882573" author="sulabh.mahajan" created="Fri, 4 May 2018 02:18:55 +0000"  >&lt;p&gt;Root Cause:&lt;/p&gt;

&lt;p&gt;This is caused by a mismatch in how concurrency is handled in MongoDB vs SQLite:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;MongoDB has capability to handle concurrency outside the storage engine at either database level or at document level. It expects the storage engines to be one of those two kinds and register those capabilities when initialised.&lt;/li&gt;
	&lt;li&gt;MongoDB&apos;s multiple databases map to a single database/file in SQLite and SQLite offers concurrency at that level.&lt;/li&gt;
	&lt;li&gt;Moreover, the fix for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32675&quot; title=&quot;Investigate database locked concurrency bug in mobile SE&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32675&quot;&gt;&lt;del&gt;SERVER-32675&lt;/del&gt;&lt;/a&gt; to take an immediate lock in a transaction instead of delaying it, resolved some of the write concurrency issues but is causing certain read operations to take an exclusive lock.&lt;/li&gt;
	&lt;li&gt;To conclude, SQLite concurrency doesn&apos;t directly align with what MongoDB expects from its storage engines.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Possible Solutions:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Modify MongoDB outside storage engine to work with instance wide (all databases together) concurrency.&lt;/li&gt;
	&lt;li&gt;Modify SQLite storage engine to handle concurrency within itself, while advertising itself as supporting document level concurrency.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;After a discussion within the team we have decided to explore the 2nd approach above. This will localise the concurrency control inside the SQLite SE alone, making it a simpler (to implement and debug) approach than the other. Also there is a desire to get away from having to support storage engines that advertise themselves being database wide concurrent. &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="482977">SERVER-32697</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="482977">SERVER-32697</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="542607">SERVER-34953</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="186464" name="0001-Finish-the-supportsDBLocking-implementation.patch" size="1354" author="sulabh.mahajan@mongodb.com" created="Wed, 9 May 2018 23:40:10 +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>4.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="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 11 Apr 2018 22:50:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 31 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-821</customfieldvalue>
                        </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, 31 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>26.0</customfieldvalue>

                        </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>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>sulabh.mahajan@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htp35r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr9d0v:</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="2250">Storage Non-NYC 2018-05-07</customfieldvalue>
    <customfieldvalue id="2305">Storage Non-NYC 2018-05-21</customfieldvalue>
    <customfieldvalue id="2349">Storage Non-NYC 2018-06-04</customfieldvalue>
    <customfieldvalue id="2350">Storage Non-NYC 2018-06-18</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10555" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Story Points</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13.0</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|htopaf:</customfieldvalue>

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