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.
This commit is contained in:
Calle Wilund
2015-08-17 12:38:39 +02:00
parent fabda26871
commit 3f1a91b89c

View File

@@ -566,14 +566,12 @@ future<> db::commitlog::segment_manager::init() {
// keep sub alive...
auto h = make_lw_shared<helper>(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();
}
});
});
}