<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:44:50 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-37051] ShardServerCatalogCacheLoader does not check the internal term after reading from the task queue</title>
                <link>https://jira.mongodb.org/browse/SERVER-37051</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There is a race condition in ShardServerCatalogCacheLoader, where if a shard node is running as a primary and a step-down happens, it may read in-memory task queue and persisted cache state, which is not consistent.&lt;/p&gt;

&lt;p&gt;Specifically, consider a node which is a primary and found some data reading from the config server &lt;a href=&quot;https://github.com/mongodb/mongo/blob/60897d8e3b1bd24504993899d82e9785ca5107ff/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L507&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. It will then schedule this data to be persisted to the cache collections and then will proceed to do a merge of the task queue + what&apos;s already persisted in order to produce a list of the changed chunks.&lt;/p&gt;

&lt;p&gt;In a stepdown-free case, this would work fine. However, if by the time it got to read what it persisted and what is on the queue, the node stepped down, neither the write to the cache collections could have happened, nor anything remained on the task queue because of the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/60897d8e3b1bd24504993899d82e9785ca5107ff/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L630&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;change in term&lt;/a&gt;. That way it could come back with incomplete data (which would be a data loss) or it could come back with an empty list, which will invariant.&lt;/p&gt;

&lt;p&gt;In order to fix it, after reading from the task queue + persisted cache, we should check if the term has changed &lt;a href=&quot;https://github.com/mongodb/mongo/blob/60897d8e3b1bd24504993899d82e9785ca5107ff/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L529&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; and throw ConflictingOperationInProgress error so the load can be retried as secondary.&lt;/p&gt;</description>
                <environment></environment>
        <key id="601299">SERVER-37051</key>
            <summary>ShardServerCatalogCacheLoader does not check the internal term after reading from the task queue</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="kaloian.manassiev@mongodb.com">Kaloian Manassiev</assignee>
                                    <reporter username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</reporter>
                        <labels>
                            <label>sharding-wfbf-day</label>
                    </labels>
                <created>Fri, 7 Sep 2018 17:46:07 +0000</created>
                <updated>Sun, 29 Oct 2023 22:28:21 +0000</updated>
                            <resolved>Tue, 11 Sep 2018 08:23:42 +0000</resolved>
                                    <version>3.6.7</version>
                    <version>4.0.2</version>
                                    <fixVersion>3.6.10</fixVersion>
                    <fixVersion>4.0.5</fixVersion>
                    <fixVersion>4.1.3</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2068823" author="xgen-internal-githook" created="Wed, 21 Nov 2018 10:33:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kaloian Manassiev&apos;, &apos;email&apos;: &apos;kaloian.manassiev@mongodb.com&apos;, &apos;username&apos;: &apos;kaloianm&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37051&quot; title=&quot;ShardServerCatalogCacheLoader does not check the internal term after reading from the task queue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37051&quot;&gt;&lt;del&gt;SERVER-37051&lt;/del&gt;&lt;/a&gt; Check for term change after fetching the queued metadata in ShardServerCatalogCacheLoader&lt;/p&gt;

&lt;p&gt;(cherry picked from commit fe8f517a59d694b7577da564d19e4415e13831e8)&lt;br/&gt;
(cherry picked from commit 2745f873818a6a1689d8538f2a29f12e221c7af5)&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ed7228be701f5435553ae128718e6b7490376b84&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ed7228be701f5435553ae128718e6b7490376b84&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2064410" author="xgen-internal-githook" created="Fri, 16 Nov 2018 14:24:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kaloian Manassiev&apos;, &apos;email&apos;: &apos;kaloian.manassiev@mongodb.com&apos;, &apos;username&apos;: &apos;kaloianm&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37051&quot; title=&quot;ShardServerCatalogCacheLoader does not check the internal term after reading from the task queue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37051&quot;&gt;&lt;del&gt;SERVER-37051&lt;/del&gt;&lt;/a&gt; Check for term change after fetching the queued metadata in ShardServerCatalogCacheLoader&lt;/p&gt;

&lt;p&gt;(cherry picked from commit fe8f517a59d694b7577da564d19e4415e13831e8)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2745f873818a6a1689d8538f2a29f12e221c7af5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2745f873818a6a1689d8538f2a29f12e221c7af5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1999064" author="xgen-internal-githook" created="Tue, 11 Sep 2018 08:18:44 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kaloian Manassiev&apos;, &apos;email&apos;: &apos;kaloian.manassiev@mongodb.com&apos;, &apos;username&apos;: &apos;kaloianm&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37051&quot; title=&quot;ShardServerCatalogCacheLoader does not check the internal term after reading from the task queue&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37051&quot;&gt;&lt;del&gt;SERVER-37051&lt;/del&gt;&lt;/a&gt; Check for term change after fetching the queued metadata in ShardServerCatalogCacheLoader&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/fe8f517a59d694b7577da564d19e4415e13831e8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/fe8f517a59d694b7577da564d19e4415e13831e8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1996985" author="kaloian.manassiev" created="Fri, 7 Sep 2018 22:10:04 +0000"  >&lt;p&gt;Yes - my mistake, forgot to add it.&lt;/p&gt;</comment>
                            <comment id="1996857" author="greg.mckeon" created="Fri, 7 Sep 2018 20:43:59 +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; is this 4.1 required as well?&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">
                                                        </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_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.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>
    <customfieldvalue key="15141"><![CDATA[v3.6]]></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>Fri, 7 Sep 2018 20:43:59 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 12 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>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, 12 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>57.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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg.mckeon@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|hu7fvz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htv9fr:</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="2482">Sharding 2018-09-24</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_11861" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>User Summary</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11856"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu725b:</customfieldvalue>

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