From 3f1a91b89ca03f2c5c8bf55b21b22bbddcf126ca Mon Sep 17 00:00:00 2001 From: Calle Wilund Date: Mon, 17 Aug 2015 12:38:39 +0200 Subject: [PATCH] Commitlog: do not eagerly create first segment on init Deferring makes it easier to separate old segments from new, which in turn helps replay logic. --- db/commitlog/commitlog.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 256dc12c1d..b5451a4a99 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -566,14 +566,12 @@ future<> db::commitlog::segment_manager::init() { // keep sub alive... auto h = make_lw_shared(this, std::move(dir)); return h->done().then([this, h]() { - return this->active_segment().then([this, h](auto) { - // nothing really. just keeping sub alive - if (cfg.mode != sync_mode::BATCH) { - _timer.set_callback(std::bind(&segment_manager::sync, this)); - this->arm(); - } - }); - }); + // nothing really. just keeping sub alive + if (cfg.mode != sync_mode::BATCH) { + _timer.set_callback(std::bind(&segment_manager::sync, this)); + this->arm(); + } + }); }); }