<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:35:54 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-34211] A failed restartCatalog command can clear the cached repl oplog pointer without reestablishing it</title>
                <link>https://jira.mongodb.org/browse/SERVER-34211</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Imagine this sequence of events:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;I run a background index build (or any background job, really) on the namespace &quot;test.coll&quot;.&lt;/li&gt;
	&lt;li&gt;Someone issues a &lt;tt&gt;restartCatalog&lt;/tt&gt; command.&lt;/li&gt;
	&lt;li&gt;We close all of the open databases via &lt;tt&gt;DBHolder::closeAll()&lt;/tt&gt;. This simply &lt;a href=&quot;https://github.com/mongodb/mongo/blob/028d3ff3e5fed549c42761f4595a73ed40d34e9f/src/mongo/db/catalog/database_holder_impl.cpp#L238-L242&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;loops through each database and attempts to close it&lt;/a&gt;. Suppose the order of databases is &quot;local&quot;, then &quot;test&quot;.
	&lt;ol&gt;
		&lt;li&gt;Database &quot;local&quot; is closed. The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/028d3ff3e5fed549c42761f4595a73ed40d34e9f/src/mongo/db/catalog/database_holder_impl.cpp#L250&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cached oplog collection pointer is cleared&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;We attempt to close database &quot;test&quot; but then &lt;a href=&quot;https://github.com/mongodb/mongo/blob/028d3ff3e5fed549c42761f4595a73ed40d34e9f/src/mongo/db/catalog/database_holder_impl.cpp#L247&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;throw because a background operation is in progress&lt;/a&gt;.&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;A later operation causes us to write to the oplog, and we dereference our bad oplog pointer because &lt;tt&gt;logOp()&lt;/tt&gt; does not call &lt;tt&gt;acquireOplogCollectionForLogging()&lt;/tt&gt;.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;One solution would be to add a ScopeGuard to &lt;tt&gt;restartCatalog&lt;/tt&gt; that calls &lt;tt&gt;repl::acquireOplogCollectionForLogging()&lt;/tt&gt; if the call to &lt;tt&gt;catalog::closeCatalog()&lt;/tt&gt; fails for any reason.&lt;/p&gt;</description>
                <environment></environment>
        <key id="519309">SERVER-34211</key>
            <summary>A failed restartCatalog command can clear the cached repl oplog pointer without reestablishing it</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="kyle.suarez@mongodb.com">Kyle Suarez</assignee>
                                    <reporter username="kyle.suarez@mongodb.com">Kyle Suarez</reporter>
                        <labels>
                    </labels>
                <created>Fri, 30 Mar 2018 15:20:47 +0000</created>
                <updated>Sun, 29 Oct 2023 22:33:12 +0000</updated>
                            <resolved>Thu, 3 May 2018 22:27:25 +0000</resolved>
                                                    <fixVersion>4.0.0-rc0</fixVersion>
                                    <component>Replication</component>
                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="1882423" author="xgen-internal-githook" created="Thu, 3 May 2018 22:11:20 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;kyle.suarez@mongodb.com&apos;, &apos;name&apos;: &apos;Kyle Suarez&apos;, &apos;username&apos;: &apos;ksuarz&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34211&quot; title=&quot;A failed restartCatalog command can clear the cached repl oplog pointer without reestablishing it&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34211&quot;&gt;&lt;del&gt;SERVER-34211&lt;/del&gt;&lt;/a&gt; restore cached oplog pointer if restartCatalog exits early&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/50bb9fd6ff7e87b39a6317c7bf3b783e0dbf836d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/50bb9fd6ff7e87b39a6317c7bf3b783e0dbf836d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1852137" author="kyle.suarez" created="Mon, 2 Apr 2018 14:38:38 +0000"  >&lt;p&gt;Thanks Andy, that sounds like a solid approach.&lt;/p&gt;</comment>
                            <comment id="1852088" author="schwerin" created="Mon, 2 Apr 2018 14:32:09 +0000"  >&lt;p&gt;I think you should suppress lock acquisition interruption using the recently introduced guard type. As for deadlock, it may not be an issue if you hold the global lock in MODE_X. Just keep an eye on it.&lt;/p&gt;</comment>
                            <comment id="1851645" author="kyle.suarez" created="Mon, 2 Apr 2018 13:38:50 +0000"  >&lt;p&gt;While the command is executing, the global lock is held in exclusive mode. Does that still leave open the possibility for lock acquisition to throw?&lt;/p&gt;

&lt;p&gt;To prevent deadlock, we could do the locking ourselves (rather than calling {{repl::acquireOplogCollectionForLogging(), which uses one of the AutoGet* helpers) given that we know we&apos;re exclusively locked.&lt;/p&gt;</comment>
                            <comment id="1851216" author="schwerin" created="Sun, 1 Apr 2018 22:18:08 +0000"  >&lt;p&gt;The risk with the proposed solution is that acquiring locks can throw or deadlock.&lt;/p&gt;</comment>
                            <comment id="1850153" author="kyle.suarez" created="Fri, 30 Mar 2018 15:26:34 +0000"  >&lt;p&gt;Note that a successful &lt;tt&gt;restartCatalog&lt;/tt&gt; command will &lt;a href=&quot;https://github.com/mongodb/mongo/blob/028d3ff3e5fed549c42761f4595a73ed40d34e9f/src/mongo/db/catalog/catalog_control.cpp#L161-L166&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;re-establish the cached oplog collection pointer in &lt;tt&gt;catalog::openCatalog()&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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_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>Sun, 1 Apr 2018 22:18:08 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 40 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_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, 40 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>0.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>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htu0lr:</customfieldvalue>

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

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