batchlog: Use in-config ring-delay
This kills the first (out of two) global reference on storage_service Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -78,7 +78,8 @@ const uint32_t db::batchlog_manager::page_size;
|
||||
db::batchlog_manager::batchlog_manager(cql3::query_processor& qp, batchlog_manager_config config)
|
||||
: _qp(qp)
|
||||
, _write_request_timeout(std::chrono::duration_cast<db_clock::duration>(config.write_request_timeout))
|
||||
, _replay_rate(config.replay_rate) {
|
||||
, _replay_rate(config.replay_rate)
|
||||
, _delay(config.delay) {
|
||||
namespace sm = seastar::metrics;
|
||||
|
||||
_metrics.add_group("batchlog_manager", {
|
||||
@@ -125,8 +126,8 @@ future<> db::batchlog_manager::start() {
|
||||
_timer.arm(lowres_clock::now() + std::chrono::milliseconds(replay_interval));
|
||||
});
|
||||
});
|
||||
auto ring_delay = service::get_local_storage_service().get_ring_delay();
|
||||
_timer.arm(lowres_clock::now() + ring_delay);
|
||||
|
||||
_timer.arm(lowres_clock::now() + _delay);
|
||||
}
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace db {
|
||||
struct batchlog_manager_config {
|
||||
std::chrono::duration<double> write_request_timeout;
|
||||
uint64_t replay_rate = std::numeric_limits<uint64_t>::max();
|
||||
std::chrono::milliseconds delay;
|
||||
};
|
||||
|
||||
class batchlog_manager {
|
||||
@@ -80,6 +81,7 @@ private:
|
||||
db_clock::duration _write_request_timeout;
|
||||
uint64_t _replay_rate;
|
||||
timer<clock_type> _timer;
|
||||
std::chrono::milliseconds _delay;
|
||||
semaphore _sem{1};
|
||||
seastar::gate _gate;
|
||||
unsigned _cpu = 0;
|
||||
|
||||
1
main.cc
1
main.cc
@@ -829,6 +829,7 @@ int main(int ac, char** av) {
|
||||
db::batchlog_manager_config bm_cfg;
|
||||
bm_cfg.write_request_timeout = cfg->write_request_timeout_in_ms() * 1ms;
|
||||
bm_cfg.replay_rate = cfg->batchlog_replay_throttle_in_kb() * 1000;
|
||||
bm_cfg.delay = std::chrono::milliseconds(cfg->ring_delay_ms());
|
||||
|
||||
db::get_batchlog_manager().start(std::ref(qp), bm_cfg).get();
|
||||
// #293 - do not stop anything
|
||||
|
||||
Reference in New Issue
Block a user