From 76a08df93980614a2dddf3f5115e35b5acce7be4 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Thu, 20 Feb 2020 12:29:38 +0200 Subject: [PATCH] commitlog: fix size of a write used to zero a segment Due to a bug the entire segment is written in one huge write of 32Mb. The idea was to split it to writes of 128K, so fix it. Fixes #5857 Message-Id: <20200220102939.30769-1-gleb@scylladb.com> (cherry picked from commit df2f67626bce617b762c1dfe6f7441eceeb310d7) --- db/commitlog/commitlog.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index a209426ba2..2dd607f0b5 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -1323,7 +1323,7 @@ future db::commitlog::segment_manager: std::vector v; v.reserve(n); size_t m = 0; - while (m < rem && n < max_write) { + while (m < rem && n--) { auto s = std::min(rem - m, buf_size); v.emplace_back(iovec{ buf.get_write(), s}); m += s;