<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:02:19 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-43117] Create oplog entry applier registry</title>
                <link>https://jira.mongodb.org/browse/SERVER-43117</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This idea is originally from &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt;&#160;as part of the Address tech debt in oplog application code path project.&lt;/p&gt;

&lt;p&gt;The logic to apply command oplog entries is all in oplog.cpp. The command-appliers are implemented as lambdas, which are defined inline in a single 400-line statement that initializes a map called kOpsMap. The logic that applies insert, update, and delete oplog entries is implemented separately in a single 400-line function.&lt;/p&gt;

&lt;p&gt;Having all the applier logic in oplog.cpp couples this file with many other subsystems, such as DDL and transactions. Thus the file must include headers from all over the codebase, and the file must be linked with 18 library dependencies.&lt;/p&gt;

&lt;p&gt;Solution: Make an OpApplier interface. Each subsystem implements OpApplier subclasses for the commands it can apply. Create an OpApplierRegistry (similar to CommandRegistry) where subsystems can register command appliers during startup. This will minimize oplog.cpp&apos;s includes and link dependencies. Remove unnecessary headers by guesswork and trial and error. If the &lt;a href=&quot;https://jira.mongodb.org/browse/PM-1112&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Libdeps Linter project&lt;/a&gt; is ready, use it to remove link dependencies, otherwise we must remove link dependencies by guesswork too.&lt;/p&gt;

&lt;p&gt;Consider implementing insert, update, and delete ops with the same OpApplier interface as commands. Note that, for performance reasons, there is special logic for &quot;grouped inserts&quot; (in InsertGroup), which should remain special.&lt;/p&gt;

&lt;p&gt;Note from Andrew Morrow: &quot;Avoid doing implicit self-registration of types by creating static instances of the class, like the Command registry does. Doing so creates libraries that don&apos;t satisfy symbol references, but silently break things if they drop out of the graph. It makes it much harder to manipulate the library dependency graph.&quot;&lt;/p&gt;

&lt;p&gt;In other words, let&apos;s not continue to use the sort of pattern we see in replication_info.cpp, for example:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;class CmdIsMaster : public CommandBase {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; ...&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; } cmdIsMaster;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;That source file isn&apos;t required to satisfy any symbol references: If you forget to link to that file, you won&apos;t get a linker error about an undefined symbol. However, mongod won&apos;t work, because the singleton instance &quot;cmdIsMaster&quot; must be constructed in order to add itself to the command registry.&lt;/p&gt;</description>
                <environment></environment>
        <key id="914438">SERVER-43117</key>
            <summary>Create oplog entry applier registry</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-server-repl">Backlog - Replication Team</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                    </labels>
                <created>Sat, 31 Aug 2019 14:32:19 +0000</created>
                <updated>Tue, 6 Dec 2022 02:49:10 +0000</updated>
                                                                            <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2413177" author="ratika.gandhi" created="Mon, 9 Sep 2019 17:29:04 +0000"  >&lt;p&gt;This will require a Design document. It is more than a quick win so will likely need its open epic. Will revisit during quarterly planning.&lt;/p&gt;</comment>
                            <comment id="2402784" author="jesse" created="Sat, 31 Aug 2019 14:34:31 +0000"  >&lt;p&gt;Andy Schwerin&apos;s advice about the registry:&lt;/p&gt;

&lt;p&gt;You want to use ServiceContext::ConstructorActionRegisterer (&lt;a href=&quot;https://www.google.com/url?q=https://github.com/mongodb/mongo/blob/master/src/mongo/db/service_context.h%23L250&amp;amp;sa=D&amp;amp;ust=1567264903276000&amp;amp;usg=AFQjCNEYYAN2SqCAX4ly1fbYfBeLiueKRw&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/master/src/mongo/db/service_context.h#L250&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Used here with &quot;prerequisites&quot;, which is helpful when you need to control order of initialization:&#160;&lt;a href=&quot;https://www.google.com/url?q=https://github.com/mongodb/mongo/blob/master/src/mongo/db/auth/sasl_mechanism_registry.cpp%23L148-L152&amp;amp;sa=D&amp;amp;ust=1567264903276000&amp;amp;usg=AFQjCNHGdK7eLLnZr3lXnGqckmhVC2QiNA&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/master/src/mongo/db/auth/sasl_mechanism_registry.cpp#L148-L152&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In general, you want to attach state to ServiceContext rather than make it global, and if you attach it to ServiceContext, you want to initialize it with ConstructorActions. It&apos;s still grosser than I want, but has some useful properties compared to MONGO_INITIALIZERS.&lt;/p&gt;

&lt;p&gt;(1) They run when you construct and destroy the ServiceContext, and have access to the ServiceContext.&lt;/p&gt;

&lt;p&gt;(2) You&apos;re allowed to start and stop threads in them, because they run after the MONGO_INITIALIZERS have finished.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25128"><![CDATA[Replication]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 9 Sep 2019 17:29:04 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 22 weeks, 2 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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 22 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>jesse@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-repl</customfieldvalue>
            <customfieldvalue>ratika.gandhi@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hvo4dj:</customfieldvalue>

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

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