mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
A writer is destroyed just before consume_in_thread returns, since the adapter takes ownership of it. The problem is that a monitor can keep a reference to the a writer_offset_tracker that is owned by that writer. The monitor is accessed periodically via backlog_controller::_update_timer. This means we have to deregister from the list of ongoing writes before the writer is destroyed. If the write fails, the deregistration happens in write_failed, but it is currently called after the writer is destroyed. This patch moves the call to write_failed to the writer destructor as I could not find a convenient location to put it. Since the writer is destroyed in consume_in_thread, we could call it there, but then we also have to update consume. The is a similar problem with the case where the sstable is written correctly. That will be fixed in the next patch. Fixes #6221. Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>