From cf1cb4d1451ab892ee29f9b21056e1d4d40ee463 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 26 Aug 2020 15:23:19 +0300 Subject: [PATCH] view_builder: Add comment about builder instances life-times The barrier passing is tricky and deserves a description about objects' life-times. Signed-off-by: Pavel Emelyanov --- db/view/view.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/view/view.cc b/db/view/view.cc index 6e3a790416..3077fdc14e 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -1266,6 +1266,10 @@ future<> view_builder::start(service::migration_manager& mm) { } return container().invoke_on(0, [eptr = std::move(eptr)] (view_builder& builder) { + // The &builder is alive, because it can only be destroyed in + // sharded::stop(), which, in turn, waits for all + // view_builder::stop()-s to finish, and each stop() waits for + // the shard's current future (called _started) to resolve. if (!eptr) { if (++builder._shards_finished_read == smp::count) { builder._shards_finished_read_promise.set_value();