<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:46:43 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-37689] Make recovery from query yield interruptible</title>
                <link>https://jira.mongodb.org/browse/SERVER-37689</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;b&gt;PROBLEM&lt;/b&gt;&lt;br/&gt;
The server query &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9f363b489585124afa1e26412e19f6728763e1ad/src/mongo/db/query/query_yield.cpp#L90&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;yielding&lt;/a&gt; mechanism uses the &lt;tt&gt;saveLockStateAndUnlock&lt;/tt&gt;/&lt;tt&gt;restoreLockState&lt;/tt&gt; combination of calls in order to get the lock state free all its acquired locks and then re-acquire them.&lt;/p&gt;

&lt;p&gt;The re-acquisition of the locks currently must run with &lt;tt&gt;UninterruptibleLockGuard&lt;/tt&gt; because otherwise the interruption exception will unwind to the lock manager&apos;s RAII classes &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9f363b489585124afa1e26412e19f6728763e1ad/src/mongo/db/concurrency/d_concurrency.cpp#L246&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;destructors&lt;/a&gt; and they will try to unlock an already unlocked resource id.&lt;/p&gt;

&lt;p&gt;Not being able to interrupt the &lt;tt&gt;restoreLockState&lt;/tt&gt; call though is problematic because it can lead to deadlocks, which would otherwise get resolved automatically.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PROPOSED SOLUTION&lt;/b&gt;&lt;br/&gt;
I propose making &lt;tt&gt;restoreLockState&lt;/tt&gt; interruptible by introducing an internal variable on the Locker, called &lt;tt&gt;boost::optional&amp;lt;LockSnapshot&amp;gt; _yieldedLocks&lt;/tt&gt; and making &lt;tt&gt;saveLockStateAndUnlock&lt;/tt&gt; place the locks it yielded inside this variable instead of returning them as an output parameter.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;restoreLockState&lt;/tt&gt; will use the values in &lt;tt&gt;_yieldedLocks&lt;/tt&gt; to reacquire the locks back and if it gets interrupted, the &lt;tt&gt;Locker::unlock&lt;/tt&gt; calls can check if a lock was yielded inside the &lt;tt&gt;_yieldedLocks&lt;/tt&gt; list.&lt;/p&gt;</description>
                <environment></environment>
        <key id="621951">SERVER-37689</key>
            <summary>Make recovery from query yield interruptible</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</assignee>
                                    <reporter username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</reporter>
                        <labels>
                    </labels>
                <created>Sat, 20 Oct 2018 08:03:36 +0000</created>
                <updated>Tue, 23 Oct 2018 10:29:07 +0000</updated>
                            <resolved>Tue, 23 Oct 2018 10:23:21 +0000</resolved>
                                                                    <component>Internal Code</component>
                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="2038800" author="kaloian.manassiev" created="Tue, 23 Oct 2018 10:23:06 +0000"  >&lt;p&gt;Based on in-person discussion, it was decided that the replication team will make the replication state transitions use mechanism other than the Global X lock in order for them to not require all sessions to be checked-in before the transition can proceed. As a result of this, uninterruptible recovery from yield will no longer be a problem.&lt;/p&gt;

&lt;p&gt;I am closing this ticket as Won&apos;t Fix in lieu of reverting the following commits, which introduced the &lt;tt&gt;PreventCheckingOutSessionsBlock&lt;/tt&gt; functionality:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e65ff57e108ed69c46cc0b0ccbdd675663de2469&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e65ff57e108ed69c46cc0b0ccbdd675663de2469&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/commit/cd533253819148e71a5e7c772ea484aafcbbf2e2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/cd533253819148e71a5e7c772ea484aafcbbf2e2&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9406af079a894bae80fbbec4703b04974bf84476&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9406af079a894bae80fbbec4703b04974bf84476&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/commit/f96903979ac329a760e7b6f1bb5d8695d3daf2a7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/f96903979ac329a760e7b6f1bb5d8695d3daf2a7&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="2037496" author="schwerin" created="Mon, 22 Oct 2018 15:36:19 +0000"  >&lt;p&gt;Yeah, the callers may depend on the locks still being held. Session yielding might work.&lt;/p&gt;</comment>
                            <comment id="2037326" author="kaloian.manassiev" created="Mon, 22 Oct 2018 13:59:47 +0000"  >&lt;p&gt;No, in the case where the operation context is interrupted while waiting for lock re-acquisition, the call stack will unwind with the locks not held.&lt;/p&gt;

&lt;p&gt;Are you saying it is a requirement because something up the call stack might currently depend on the locks being held?&lt;/p&gt;

&lt;p&gt;An alternative option then is that the yielding should yield the session as well.&lt;/p&gt;</comment>
                            <comment id="2037319" author="schwerin" created="Mon, 22 Oct 2018 13:54:16 +0000"  >&lt;p&gt;&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;, I don&apos;t understand this proposal. It is a requirement, no matter how unfortunate, that a caller recover all held locks at the end of yield(). Would your proposal preserve this?&lt;/p&gt;</comment>
                            <comment id="2036696" author="kaloian.manassiev" created="Sat, 20 Oct 2018 08:08:39 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=geert.bosch&quot; class=&quot;user-hover&quot; rel=&quot;geert.bosch&quot;&gt;geert.bosch&lt;/a&gt; - can you take a look at this and also at &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37682?focusedCommentId=2036695&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2036695&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt;, and let me know which one we should do?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="607944">SERVER-37244</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="621902">SERVER-37682</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="622838">SERVER-37711</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 22 Oct 2018 13:54:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 16 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1032</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>kaloian.manassiev@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 16 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|huaux3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu15fz:</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_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|huah6f:</customfieldvalue>

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