-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 8.0.13, 7.0.48
-
Component/s: Replication
-
None
-
Replication - Oplog and Recovery
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Versions: 7.0, 8.0 (same code). Not 9.0 or master: a step-down only waits for Write intents, and dbHash registers a Read intent.
Problem
dbHash takes Lock::GlobalLock(MODE_IS), and so the RSTL in IX, for the whole command, plus AutoGetDb. Its plans use PlanYieldPolicy::INTERRUPT_ONLY, so it never releases its locks. The step-down kill pass does not interrupt it, because it holds the global lock only in IS. A step-down therefore waits for the whole dbHash, and on a large database it fasserts.
Evidence
On 7.0.48, a step-down fasserted (5675600) behind a dbHash that had been running for over 15 minutes. Its connection held the global lock in IS and does not appear in 8562701.
A second 7.0.48 occurrence is likely the same class: its dump shows two RSTL IX holders and no Global entry, while FTDC 15 s into that step-down shows empty ticket queues. So those holders were probably lock-based reads holding a global IS that the dump does not show: IS requests sit in partitioned lock heads and appear in the dump only once a conflicting request migrates them. dbHash is one candidate; other INTERRUPT_ONLY or NO_YIELD reads that take the global lock with the RSTL are another.
Proposed fix (options)
- Mark dbHash's operation with setAlwaysInterruptAtStepDownOrUp_UNSAFE. A hash taken across a state transition is not comparable with the other members' hashes anyway, so callers already need to retry.
- More generally, have the kill pass interrupt global-IS holders whose plan executor uses INTERRUPT_ONLY, which never releases locks. Candidates: dbHash, dbcheck, analyze_shard_key, and the pre-images remover.