<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:25:29 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-51440] Cleanup refcounting and lifetime of ReplicaSetMonitor</title>
                <link>https://jira.mongodb.org/browse/SERVER-51440</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This is an umbrella task to keep track of all smaller tasks to accomplish the refactoring.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;UPDATE&lt;/b&gt;: hopefully we don&apos;t need TTL. I will rename or delete this ticket when it&apos;s more clear. For now it holds the list of other tickets needed for refactoring, below.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The problem: the lifetime if the&#160;ReplicaSetMonitor is managed by the shared_ptr. The ownership graph has circular dependencies (like&#160;_eventsPublisher and&#160;TopologyListenerPtr) that prevent the instance to be deleted. At the same time, breaking those circular dependencies by replacing a listener with weak_ptr is making the RSM to be deleted too fast.&lt;/p&gt;

&lt;p&gt;The solution: convert the&#160;ReplicaSetMonitor factory and&#160;ReplicaSetMonitorManager to cache with TTL:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Do not have a strict refcounting delete policy, have a lazy delete with TTL (about 1 hour or so)&lt;/li&gt;
	&lt;li&gt;Make the callers to not keep the reference for a while, even use a weak pointer when possible. TTL will prevent the immediate deletion&lt;/li&gt;
	&lt;li&gt;Remove the get() method, so an entry in the cache is always recreated. With 1 hour TTL it is guaranteed that each record is recreated not more often than once per hour, so the cost is very low&lt;/li&gt;
	&lt;li&gt;Thus we still have the remove() method that clears the entry from cache immediately, and the dangling references will delete the instance soon, however we cannot force it to terminate immediately. I think the remove() should set a flag in the instance that it should terminate asap&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;In the tests, set TTL to be short, like 10 seconds.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1507395">SERVER-51440</key>
            <summary>Cleanup refcounting and lifetime of ReplicaSetMonitor</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="andrew.shuvalov@mongodb.com">Andrew Shuvalov</assignee>
                                    <reporter username="andrew.shuvalov@mongodb.com">Andrew Shuvalov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 8 Oct 2020 15:47:52 +0000</created>
                <updated>Thu, 22 Oct 2020 14:07:57 +0000</updated>
                            <resolved>Thu, 22 Oct 2020 14:07:57 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3459098" author="JIRAUSER1256988" created="Thu, 22 Oct 2020 14:07:57 +0000"  >&lt;p&gt;I&apos;m moving list of tickets to&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50189&quot; title=&quot;Replace ReplicaSetMonitorManager::removeMonitor with a custom deleter for shared_ptr&amp;lt;ReplicaSetMonitor&amp;gt;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50189&quot;&gt;SERVER-50189&lt;/a&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="1435687">SERVER-50189</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1449283">SERVER-50467</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1505836">SERVER-51413</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1507404">SERVER-51441</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1507413">SERVER-51442</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1507416">SERVER-51443</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1509372">SERVER-51480</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1416291">SERVER-49789</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1435687">SERVER-50189</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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 15 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-50467'>SERVER-50467</a></s>, <a href='https://jira.mongodb.org/browse/SERVER-50189'>SERVER-50189</a>, <s><a href='https://jira.mongodb.org/browse/SERVER-51441'>SERVER-51441</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-51442'>SERVER-51442</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-51443'>SERVER-51443</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-51413'>SERVER-51413</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-51480'>SERVER-51480</a></s>]]></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>andrew.shuvalov@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 15 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.shuvalov@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hybhmf:</customfieldvalue>

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

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