mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 02:50:33 +00:00
This patch fixes a race between two methods in hints manager: drain_for and store_hint. The first method is called when a node leaves the cluster, and it 'drains' end point hints manager for that node (sends out all hints for that node). If this method is called when the local node is being decomissioned or removed, it instead drains hints managers for all endpoints. In the case of decomission/remove, drain_for first calls parallel_for_each on all current ep managers and tells them to drain their hints. Then, after all of them complete, _ep_managers.clear() is called. End point hints managers are created lazily and inserted into _ep_managers map the first time a hint is stored for that node. If this happens between parallel_for_each and _ep_managers.clear() described above, the clear operation will destroy the new ep manager without draining it first. This is a bug and will trigger an assert in ep manager's destructor. To solve this, a new flag for the hints manager is added which is set when it drains all ep managers on removenode/decommission, and prevents further hints from being written. Fixes #7257 Closes #7278