<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:00:00 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-42255] Replica set initialization writes first oplog entry with no term</title>
                <link>https://jira.mongodb.org/browse/SERVER-42255</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When a replica set is first initialized using &lt;tt&gt;rs.initiate()&lt;/tt&gt;, it writes a note to that effect into the oplog as its first entry. However, this is written while the term is &lt;tt&gt;OpTime::kUninitializedTerm&lt;/tt&gt;, and the entry therefore has no term field &lt;tt&gt;t&lt;/tt&gt;:&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;   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;{ &quot;op&quot; : &quot;n&quot;, &quot;ns&quot; : &quot;&quot;, &quot;o&quot; : { &quot;msg&quot; : &quot;initiating set&quot; }, &quot;ts&quot; : Timestamp(1563285225, 1), &quot;v&quot; : NumberLong(2), &quot;wall&quot; : ISODate(&quot;2019-07-16T13:53:45.914Z&quot;) }&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;This has been the case since 3.6 and remains so on current master.&lt;/p&gt;</description>
                <environment></environment>
        <key id="859764">SERVER-42255</key>
            <summary>Replica set initialization writes first oplog entry with no term</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="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="bernard.gorman@mongodb.com">Bernard Gorman</reporter>
                        <labels>
                    </labels>
                <created>Wed, 17 Jul 2019 12:24:11 +0000</created>
                <updated>Tue, 6 Dec 2022 02:53:52 +0000</updated>
                                                                            <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="2337279" author="lingzhi.deng" created="Mon, 22 Jul 2019 19:14:28 +0000"  >&lt;p&gt;The cause is that we write the first oplog entry in &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/replication_coordinator_impl.cpp#L2771&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;initializeReplSetStorage&lt;/tt&gt;&lt;/a&gt; which eventually calls &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/oplog.cpp#L407&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;getNextOpTimes&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/local_oplog_info.cpp#L109&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;replCoord-&amp;gt;getTerm()&lt;/tt&gt;&lt;/a&gt; to determine the term. The problem is that &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/replication_coordinator_impl.cpp#L2771&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;initializeReplSetStorage&lt;/tt&gt;&lt;/a&gt; is called before &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/replication_coordinator_impl.cpp#L2791&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;_finishReplSetInitiate&lt;/tt&gt;&lt;/a&gt; which calls &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/topology_coordinator.cpp#L1888-L1892&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;TopologyCoordinator::updateConfig()&lt;/tt&gt; to reset &lt;tt&gt;term&lt;/tt&gt; from &lt;tt&gt;OpTime::kUninitializedTerm&lt;/tt&gt; (-1) to &lt;tt&gt;OpTime::kInitialTerm&lt;/tt&gt; (0)&lt;/a&gt;. &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92e0fd23cdedbfac369172b931f67964cea531fa/src/mongo/db/repl/oplog_entry.cpp#L207-L209&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;We don&apos;t write down the &lt;tt&gt;t&lt;/tt&gt; field if the term is &lt;tt&gt;OpTime::kUninitializedTerm&lt;/tt&gt;&lt;/a&gt; and therefore the &lt;tt&gt;t&lt;/tt&gt; field is missing from the &quot;initiating set&quot; entry. If we somehow initialize the &lt;tt&gt;TopologyCoordinator&lt;/tt&gt;&apos;s term earlier to &lt;tt&gt;OpTime::kInitialTerm&lt;/tt&gt; (0) before &lt;tt&gt;initializeReplSetStorage&lt;/tt&gt; is called, maybe we can then log {&lt;tt&gt;t: 0&lt;/tt&gt;} for it. The first election will always be started as term 1.&lt;/p&gt;</comment>
                            <comment id="2337023" author="william.schultz" created="Mon, 22 Jul 2019 17:34:37 +0000"  >&lt;p&gt;Another question that came up in discussion: is it possible to run concurrent replSetInitiate commands against separate replica set nodes? In that case, would both nodes write divergent &quot;initiation&quot; entries and would this cause any problems?&lt;/p&gt;</comment>
                            <comment id="2337021" author="ratika.gandhi" created="Mon, 22 Jul 2019 17:33:50 +0000"  >&lt;p&gt;We want to understand why this has no term and what happens when the oplog entry gets rolled back.&#160;&lt;/p&gt;</comment>
                            <comment id="2330375" author="judah.schvimer" created="Wed, 17 Jul 2019 14:31:53 +0000"  >&lt;p&gt;This has no term because it is written before any node is elected primary. We&apos;ll need to write it in a real term for it to be safe. &lt;/p&gt;

&lt;p&gt;We may also want to make sure this oplog entry cannot be rolled back, which would be valuable for change streams.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="859850">SERVER-42258</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.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>Wed, 17 Jul 2019 14:31:53 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 29 weeks, 2 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/PM-1209'>PM-1209</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>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, 29 weeks, 2 days ago
                        </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>backlog-server-repl</customfieldvalue>
            <customfieldvalue>bernard.gorman@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
            <customfieldvalue>ratika.gandhi@mongodb.com</customfieldvalue>
            <customfieldvalue>william.schultz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hvesvj:</customfieldvalue>

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

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