From aa375cd33dff3ff55b2eee233e023dbdca7cb709 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 17 Nov 2016 12:32:48 -0500 Subject: [PATCH] commitlog: use commitlog priority for replay Right now replay is being issued with the standard seastar priority. The rationale for that at the time is that it is an early event that doesn't really share the disk with anybody. That is largely untrue now that we start compactions on boot. Compactions may fight for bandwidth with the commitlog, and with such low priority the commitlog is guaranteed to lose. Fixes #1856 Signed-off-by: Glauber Costa --- db/commitlog/commitlog.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 5191d63bde..6e14a0b0a4 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -1538,6 +1538,15 @@ db::commitlog::read_log_file(const sstring& filename, commit_load_reader_func ne subscription, db::replay_position> db::commitlog::read_log_file(file f, commit_load_reader_func next, position_type off) { struct work { + private: + file_input_stream_options make_file_input_stream_options() { + file_input_stream_options fo; + fo.buffer_size = db::commitlog::segment::default_size; + fo.read_ahead = 0; + fo.io_priority_class = service::get_local_commitlog_priority(); + return fo; + } + public: file f; stream, replay_position> s; input_stream fin; @@ -1554,7 +1563,7 @@ db::commitlog::read_log_file(file f, commit_load_reader_func next, position_type bool failed = false; work(file f, position_type o = 0) - : f(f), fin(make_file_input_stream(f)), start_off(o) { + : f(f), fin(make_file_input_stream(f, o, make_file_input_stream_options())), start_off(o) { } work(work&&) = default;