You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
146270: kvserver: remove UnregisterFromReplica callback r=tbg a=stevendanna
The UnregisterFromReplica callback required obtaining the rangefeedMu mutex from inside the rangefeed scheduler worker. This is a problem because the current holder of the rangefeedMu (specifically (*ScheduledProcessor).Register) may require a response from the very same scheduler worker to make progress and release rangefeedMu.
Here, we solve that by removing this UnregisterFromReplica callback completely. This callback was responsible for removing the processor from the replica when the processor had been shut down.
But, nearly every code path that calls Stop() already removes the processor from the replica itself. The only case where this wasn't true is when the processor stops itself because it has no more active registrations.
Not removing the processor from the replica in that case has two consequences:
1. We may hold onto memory related to the ScheduledProcessor struct,
2. The replica does extra work because of the rangefeed processor is set.
Here, we choose to ignore (1) as a minor problem since a most ranges that have a rangefeed started once will have one started again in the future.
We solve (2) by making the `stopped` state variable accessible from outside the processor and consulting it before using the rangefeed processor on the replica. The assumption here is that the atomic load is cheap in comparison to the work we need to do when the processor is present.
Fixes#144828
Epic: none
Release note (bug fix): Fix a bug that could lead to a node stall.
Co-authored-by: Steven Danna <[email protected]>
0 commit comments