mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 09:30:45 +00:00
view_building_worker: execute drain() once
Future changes will require that the view building worker is drained only once per its lifetime.
This commit is contained in:
@@ -143,6 +143,14 @@ dht::token_range view_building_worker::get_tablet_token_range(table_id table_id,
|
||||
}
|
||||
|
||||
future<> view_building_worker::drain() {
|
||||
auto drain_started = std::exchange(_drain_started, started_drain::yes);
|
||||
if (drain_started == started_drain::no) {
|
||||
_drain_finished = shared_future(do_drain());
|
||||
}
|
||||
return _drain_finished.get_future();
|
||||
}
|
||||
|
||||
future<> view_building_worker::do_drain() {
|
||||
if (!_as.abort_requested()) {
|
||||
_as.request_abort();
|
||||
}
|
||||
|
||||
@@ -177,6 +177,11 @@ private:
|
||||
void init_messaging_service();
|
||||
future<> uninit_messaging_service();
|
||||
future<std::vector<utils::UUID>> work_on_tasks(raft::term_t term, std::vector<utils::UUID> ids);
|
||||
|
||||
using started_drain = bool_class<struct started_drain_tag>;
|
||||
started_drain _drain_started = started_drain::no;
|
||||
shared_future<> _drain_finished;
|
||||
future<> do_drain();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user