mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 14:33:08 +00:00
check_and_repair_cdc_streams, in case it decides to create a new CDC generation, updates the STATUS application state so that other nodes gossiped with pick up the generation change. The node which runs check_and_repair_cdc_streams also learns about a generation change: the STATUS update causes a notification change. This happens during add_local_application_state call which caused the STATUS update; it would lead to calling handle_cdc_generation, which detects a generation change and calls add_local_application_state with the new generation's timestamp. Thus, we get a recursive add_local_application_state call. Unforunately, the function takes a lock before doing on_change notifications, so we get a deadlock. This commit prevents the deadlock. We update the local variable which stores the generation timestamp before updating STATUS, so handle_cdc_generation won't consider the observed generation to be new, hence it won't perform the recursive add_local_application_state call.