<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:48:33 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-38297] Killing session on a secondary currently applying prepare oplog entry can fassert</title>
                <link>https://jira.mongodb.org/browse/SERVER-38297</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When secondaries apply the oplog entry that prepares a transaction, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e6bb7daa4995bf6c19ff975c5e5425ba5a1920f/src/mongo/db/repl/apply_ops.cpp#L316&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;they check out the corresponding MongoD session&lt;/a&gt;. If the session is killed while the the entry is being applied, the operation context applying may be interrupted, leading to an fassert &lt;a href=&quot;https://github.com/mongodb/mongo/blob/8e6bb7daa4995bf6c19ff975c5e5425ba5a1920f/src/mongo/db/repl/sync_tail.cpp#L877-L878&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here in SyncTail&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Example failure:&#160;&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.379-0500 D TXN      [repl writer worker 11] New transaction started with txnNumber: 165 on session with lsid 0bcc3f79-2f23-40e5-933f-9832f261d827&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.386-0500 I COMMAND  [thread23] killing op: 2587 as part of killing session: { id: UUID(&quot;0bcc3f79-2f23-40e5-933f-9832f261d827&quot;), uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855) }&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.387-0500 F REPL     [repl writer worker 11] writer worker caught exception: Interrupted: operation was interrupted on: { lsid: { id: UUID(&quot;0bcc3f79-2f23-40e5-933f-9832f261d827&quot;), uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855) }, txnNumber: 165, op: &quot;c&quot;, ns: &quot;admin.$cmd&quot;, o: { applyOps: [ { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.34: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.34: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 5.0 } }, { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.46: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.46: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 1.0 } } ], prepare: true }, ts: Timestamp(1543429938, 13), t: 1, h: 5752351775086301644, v: 2, wall: new Date(1543429938357), stmtId: 0, prevOpTime: { ts: Timestamp(0, 0), t: -1 }, prepare: true }&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.387-0500 F REPL     [rsSync-0] Failed to apply batch of operations. Number of operations in batch: 1. First operation: { lsid: { id: UUID(&quot;0bcc3f79-2f23-40e5-933f-9832f261d827&quot;), uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855) }, txnNumber: 165, op: &quot;c&quot;, ns: &quot;admin.$cmd&quot;, o: { applyOps: [ { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.34: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.34: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 5.0 } }, { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.46: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.46: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 1.0 } } ], prepare: true }, ts: Timestamp(1543429938, 13), t: 1, h: 5752351775086301644, v: 2, wall: new Date(1543429938357), stmtId: 0, prevOpTime: { ts: Timestamp(0, 0), t: -1 }, prepare: true }. Last operation: { lsid: { id: UUID(&quot;0bcc3f79-2f23-40e5-933f-9832f261d827&quot;), uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855) }, txnNumber: 165, op: &quot;c&quot;, ns: &quot;admin.$cmd&quot;, o: { applyOps: [ { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.34: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.34: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 5.0 } }, { op: &quot;u&quot;, ns: &quot;test0_fsmdb0.fsmcoll0&quot;, ui: UUID(&quot;94404109-1c63-4cb8-85b0-bcf3dc1757ef&quot;), o: { $v: 1, $set: { metadata.46: { dbName: &quot;test0_fsmdb0&quot;, collName: &quot;fsmcoll0&quot;, txnNum: 165.0 }, order.46: { tid: 6.0, iteration: 16.0, numUpdated: 3.0 } } }, o2: { _id: 1.0 } } ], prepare: true }, ts: Timestamp(1543429938, 13), t: 1, h: 5752351775086301644, v: 2, wall: new Date(1543429938357), stmtId: 0, prevOpTime: { ts: Timestamp(0, 0), t: -1 }, prepare: true }. Oplog application failed in writer thread 9: Interrupted: operation was interrupted&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.387-0500 F -        [rsSync-0] Fatal assertion 34437 Interrupted: operation was interrupted at src/mongo/db/repl/sync_tail.cpp 878&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;[ShardedClusterFixture:job0:shard1:secondary1] 2018-11-28T13:32:18.387-0500 F -        [rsSync-0]&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;[ShardedClusterFixture:job0:shard1:secondary1] &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;[ShardedClusterFixture:job0:shard1:secondary1] ***aborting after fassert() failure&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;[ShardedClusterFixture:job0:shard1:secondary1]&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment></environment>
        <key id="639674">SERVER-38297</key>
            <summary>Killing session on a secondary currently applying prepare oplog entry can fassert</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="jack.mulrow@mongodb.com">Jack Mulrow</reporter>
                        <labels>
                            <label>open_todo_in_code</label>
                            <label>prepare_errors</label>
                            <label>todo_in_code</label>
                    </labels>
                <created>Wed, 28 Nov 2018 19:11:44 +0000</created>
                <updated>Sun, 29 Oct 2023 22:26:18 +0000</updated>
                            <resolved>Thu, 14 Mar 2019 11:53:19 +0000</resolved>
                                                    <fixVersion>4.1.9</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="2234127" author="kaloian.manassiev" created="Fri, 3 May 2019 19:05:30 +0000"  >&lt;p&gt;Yes, not sure how I managed to tag it as 4.0.7, but it was a mistake. Thanks for pointing it out!&lt;/p&gt;</comment>
                            <comment id="2234036" author="maria.vankeulen" created="Fri, 3 May 2019 18:09: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; I see the fix version for this ticket is 4.0.7 but the commits were tagged as r4.1.9. Should this fixVersion be changed to 4.1.9?&lt;/p&gt;</comment>
                            <comment id="2180645" author="kaloian.manassiev" created="Thu, 14 Mar 2019 11:53:19 +0000"  >&lt;p&gt;The only test, which remains disabled now is `multi_statement_transaction_kill_sessions_atomicity_isolation.js`, which is failing for unrelated reasons and I am going to track it under &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40186&quot; title=&quot;The logic in `auto_retry_transaction.js:withTxnAndAutoRetry` does not retry failed commits&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40186&quot;&gt;&lt;del&gt;SERVER-40186&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2179727" author="xgen-internal-githook" created="Wed, 13 Mar 2019 16:18:53 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kaloian Manassiev&apos;, &apos;username&apos;: &apos;kaloianm&apos;, &apos;email&apos;: &apos;kaloian.manassiev@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38297&quot; title=&quot;Killing session on a secondary currently applying prepare oplog entry can fassert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38297&quot;&gt;&lt;del&gt;SERVER-38297&lt;/del&gt;&lt;/a&gt; Reenable FSM transactions tests with killOp&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ac2e9336b62fc726b29aa624b8ac05bc045523e5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ac2e9336b62fc726b29aa624b8ac05bc045523e5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2179332" author="xgen-internal-githook" created="Wed, 13 Mar 2019 12:28:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kaloian Manassiev&apos;, &apos;username&apos;: &apos;kaloianm&apos;, &apos;email&apos;: &apos;kaloian.manassiev@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38297&quot; title=&quot;Killing session on a secondary currently applying prepare oplog entry can fassert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38297&quot;&gt;&lt;del&gt;SERVER-38297&lt;/del&gt;&lt;/a&gt; Cleanup SyncTail and OplogApplierImpl&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1e619f3eaf5615d582f6fd88c254e9fcb9c73b2d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1e619f3eaf5615d582f6fd88c254e9fcb9c73b2d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2175217" author="kaloian.manassiev" created="Thu, 7 Mar 2019 22:33:07 +0000"  >&lt;p&gt;Actually, Judah already pointed me to the change done under &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37348&quot; title=&quot;TransactionReaper and periodic transaction abort thread shouldn&amp;#39;t abort transactions on secondaries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37348&quot;&gt;&lt;del&gt;SERVER-37348&lt;/del&gt;&lt;/a&gt;, which already did this, but at a higher level, so I think there might actually not be anything to do for this ticket other than re-enable the tests.&lt;/p&gt;

&lt;p&gt;To your question about why allowing &lt;tt&gt;killSession&lt;/tt&gt; on secondaries - why would that be disallowed? There could be secondary reads under a session and these need to be killed somehow. In terms of who should own a session, the answer is that there should always be a single owner of a session at a time on a replica set. The model where secondary application checks-out the session doesn&apos;t exactly jive with that model, but since we don&apos;t allow transactions on secondaries, this probably doesn&apos;t matter right now.&lt;/p&gt;</comment>
                            <comment id="2175211" author="siyuan.zhou@10gen.com" created="Thu, 7 Mar 2019 22:28:34 +0000"  >&lt;p&gt;The plan makes sense to me. Shutdown came to my mind initially, but I don&apos;t think we use InterruptedDueToStepDown to shutdown secondary application. We share the opCtx for all operations on the same writer in a batch. Currently, any command that checks out a session runs in its own batch, so this isn&apos;t a problem. But that makes feel we need to disable interruptions for all secondary application.&lt;/p&gt;

&lt;p&gt;A behavioral question: why do we allow killSession on secondaries? I remember mongos will send killSession to all nodes in a replset, but it&apos;s always unclear to me who should &lt;b&gt;own&lt;/b&gt; a session. Session is used by transaction and a transaction&apos;s life cycle is owned by primary, so it sounds like session should be owned by primary too. Session is also used by secondary read &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/help_16.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; for some reason I don&apos;t know so it sounds a local state of a secondary on the other hand.&lt;/p&gt;</comment>
                            <comment id="2175174" author="kaloian.manassiev" created="Thu, 7 Mar 2019 22:01:50 +0000"  >&lt;p&gt;From looking at the chain of calls that leads to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5a7ccd5f073341f5f98e0ced39a80416869c181b/src/mongo/db/repl/apply_ops.cpp#L283&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;_applyPrepareTransaction&lt;/tt&gt;&lt;/a&gt;, I see that as implemented currently, the applier (SyncTail) never &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5a7ccd5f073341f5f98e0ced39a80416869c181b/src/mongo/db/repl/sync_tail.cpp#L1176&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;expects&lt;/a&gt; to be interrupted (or for any exception to escape while applying oplog).&lt;/p&gt;

&lt;p&gt;Since making it exception-safe is going to be a lot of work and given the fact that it can&apos;t be interrupted anyways, I propose that we fix this by making any sessions checked-out through &lt;tt&gt;MongoDOperationContextSessionWithoutRefresh&lt;/tt&gt; uninterruptible by making the entire &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5a7ccd5f073341f5f98e0ced39a80416869c181b/src/mongo/db/repl/oplog.cpp#L1837&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;applyCommand_inlock&lt;/tt&gt;&lt;/a&gt; call uninterruptible, if called with &lt;tt&gt;OplogApplication::Mode != kApplyOpsCmd&lt;/tt&gt;. Alternatively I could make only &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5a7ccd5f073341f5f98e0ced39a80416869c181b/src/mongo/db/repl/sync_tail.cpp#L369&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this&lt;/a&gt; invocation uninterruptible.&lt;/p&gt;

&lt;p&gt;This will take care of all code paths where&#160;&lt;tt&gt;MongoDOperationContextSessionWithoutRefresh&lt;/tt&gt; is used without impacting interruptability of the &lt;tt&gt;applyOps&lt;/tt&gt; command itself.&lt;/p&gt;

&lt;p&gt;&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;, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tess.avitabile&quot; class=&quot;user-hover&quot; rel=&quot;tess.avitabile&quot;&gt;tess.avitabile&lt;/a&gt;, what do you think?&lt;/p&gt;</comment>
                            <comment id="2172942" author="judah.schvimer" created="Wed, 6 Mar 2019 17:51:39 +0000"  >&lt;p&gt;As part of this ticket, please unblacklist tests marked with a TODO against this ticket.&lt;/p&gt;</comment>
                            <comment id="2079200" author="judah.schvimer" created="Mon, 3 Dec 2018 21:50:45 +0000"  >&lt;p&gt;Open question: what happens currently if you call &quot;killOp&quot; on a secondary oplog applier thread?&lt;/p&gt;</comment>
                            <comment id="2076587" author="kaloian.manassiev" created="Fri, 30 Nov 2018 11:22:25 +0000"  >&lt;p&gt;Is the problem here that killSession can come concurrently with a session which is currently being operated on by &lt;tt&gt;multiApply&lt;/tt&gt;?&lt;/p&gt;

&lt;p&gt;The sessions refactor work will not help with this. If the applier code cannot handle interruptions it should mark the the operation context uninterruptible.&lt;/p&gt;

&lt;p&gt;It is a separate problem if we want to avoid interrupting sessions with prepared transactions on them as described in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36485&quot; title=&quot;&#8216;killSessions&#8217; (for one session) and &amp;#39;endSessions&amp;#39; should return a &#8220;PreparedTransactionInProgress&#8221; error if it tries to kill a session that has a prepared transaction in it&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36485&quot;&gt;&lt;del&gt;SERVER-36485&lt;/del&gt;&lt;/a&gt; - in this case we will have to implement the &lt;tt&gt;markUnkillable&lt;/tt&gt; concept, which would make the session kill attempts throw a &quot;PreparedTransaction&quot; exception. Up till now I didn&apos;t think this was necessary, because the code which uses it could just make itself uninterruptible, but I agree that it is a better user experience if we return the proper error?&lt;/p&gt;

&lt;p&gt;Let&apos;s talk about this on Monday when I will be in the office.&lt;/p&gt;</comment>
                            <comment id="2075985" author="greg.mckeon" created="Thu, 29 Nov 2018 20:48:20 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=judah.schvimer&quot; class=&quot;user-hover&quot; rel=&quot;judah.schvimer&quot;&gt;judah.schvimer&lt;/a&gt;, I pinged &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; to talk to you tomorrow about his session refactor work and whether this will help wrap up these sorts of issues.&lt;/p&gt;</comment>
                            <comment id="2074509" author="judah.schvimer" created="Wed, 28 Nov 2018 20:22:42 +0000"  >&lt;p&gt;This may be solved by some combination of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36485&quot; title=&quot;&#8216;killSessions&#8217; (for one session) and &amp;#39;endSessions&amp;#39; should return a &#8220;PreparedTransactionInProgress&#8221; error if it tries to kill a session that has a prepared transaction in it&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36485&quot;&gt;&lt;del&gt;SERVER-36485&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36486&quot; title=&quot;Return &amp;quot;PreparedTransactionInProgress&amp;quot; when a &amp;quot;killAllSessions&amp;quot; command reaches a prepared transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36486&quot;&gt;&lt;del&gt;SERVER-36486&lt;/del&gt;&lt;/a&gt;, and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37348&quot; title=&quot;TransactionReaper and periodic transaction abort thread shouldn&amp;#39;t abort transactions on secondaries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37348&quot;&gt;&lt;del&gt;SERVER-37348&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="610864">SERVER-37348</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="718608">SERVER-40186</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="584977">SERVER-36485</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="584978">SERVER-36486</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="610864">SERVER-37348</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>13.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</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>Wed, 28 Nov 2018 20:22:42 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 40 weeks, 5 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-37348'>SERVER-37348</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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1032</customfieldvalue>
                        </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>
                            4 years, 40 weeks, 5 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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg.mckeon@mongodb.com</customfieldvalue>
            <customfieldvalue>jack.mulrow@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
            <customfieldvalue>maria.vankeulen@mongodb.com</customfieldvalue>
            <customfieldvalue>siyuan.zhou@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hudvhb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu3z7r:</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="2639">Sharding 2018-12-17</customfieldvalue>
    <customfieldvalue id="2726">Sharding 2019-01-28</customfieldvalue>
    <customfieldvalue id="2786">Sharding 2019-02-11</customfieldvalue>
    <customfieldvalue id="2787">Sharding 2019-02-25</customfieldvalue>
    <customfieldvalue id="2824">Sharding 2019-03-11</customfieldvalue>
    <customfieldvalue id="2825">Sharding 2019-03-25</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_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hudhqn:</customfieldvalue>

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