[SERVER-50381] 3 way deadlock between applyOps cmd, prepared transaction and secondary oplog fetcher initiated find command Created: 19/Aug/20  Updated: 27/Oct/23  Resolved: 11/Nov/22

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Suganthi Mani Assignee: Backlog - Replication Team
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-33182 Remove atomic applyOps Closed
Related
is related to SERVER-33326 Remove use of applyOps/doTxn from sha... Closed
is related to SERVER-36263 Bypassing operation validation in app... Closed
Assigned Teams:
Replication
Operating System: ALL
Participants:
Linked BF Score: 65

 Description   

3 way deadlock involving applyOps cmd, prepared transaction and oplog find command  can occur on a primary.
1) applyOps cmd enqueues global lock in X mode and stuck behind prepared transaction due to global lock conflict.
2) Prepared transaction holding global lock in IX mode, waits for the prepareTransaction oplog entry to be majority replicated. But stuck behind the Secondaries oplog replication.
3) Secondary oplog fetcher initiated find cmd on oplog collection is waiting for global lock to acquire in IS mode but stuck behind the applyOps cmd due to enqueued global lock .

To be noted, 'applyOps' cmd by default runs in atomic mode. Atomic mode apply ops consisting of CRUD ops always take global lock in X mode.



 Comments   
Comment by Judah Schvimer [ 11/Nov/22 ]

SERVER-33182 made this issue go away.

Comment by Judah Schvimer [ 01/Apr/21 ]

This is lower priority now that applyOps is behind a special privilege (SERVER-36263).

Comment by Kaloian Manassiev [ 26/Aug/20 ]

Callers in Sharding still use applyOps, yes - specifically move/split and merge. These operations definitely don't need the global X-lock, though if you want to relax that. They don't need strong locking at all.

Comment by Suganthi Mani [ 19/Aug/20 ]

Tagging max.hirschhorn kaloian.manassiev to throw more lights from shading perspective.

Comment by Andy Schwerin [ 19/Aug/20 ]

Does applyOps still require the global X lock? Do its callers in sharding depend on it?

Generated at Thu Feb 08 05:22:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.