mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
Before this patch the iterations over migration_notifier::_listeners could race with listeners being added and removed. The addition side is not modified, since it is common to add a listener during construction and it would require a fairly big refactoring. Instead, the iteration is modified to use indexes instead of iterators so that it is still valid if another listener is added concurrently. For removal we use a rw lock, since removing an element invalidates indexes too. There are only a few places that needed refactoring to handle unregister_listener returning a future<>, so this is probably OK. Fixes #5541. Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com> Message-Id: <20200120192819.136305-1-espindola@scylladb.com>