From 1a657e9c5ff23749c9077f9ff142233f61563d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Mon, 4 Mar 2019 10:35:28 +0000 Subject: [PATCH 1/3] commitlog: remove unnecessary comment --- 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 659b906b2d..90fbf418b7 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -720,7 +720,7 @@ public: // The write will be allowed to start now, but flush (below) must wait for not only this, // but all previous write/flush pairs. - return _pending_ops.run_with_ordered_post_op(rp, [this, size, off, buf = std::move(buf)]() mutable { /////////////////////////////////////////////////// + return _pending_ops.run_with_ordered_post_op(rp, [this, size, off, buf = std::move(buf)]() mutable { auto view = fragmented_temporary_buffer::view(buf); return do_with(off, view, [&] (uint64_t& off, fragmented_temporary_buffer::view& view) { if (view.empty()) { From 813b00a1a643bb6592b8c1873da3fe01815675a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Mon, 4 Mar 2019 10:03:00 +0000 Subject: [PATCH 2/3] commitlog: provide more information in logs This commits adds some more information to the logs. Motivated, by experiences with investigating #4231. * size of each write * position of each write * log message for final write --- db/commitlog/commitlog.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 90fbf418b7..13fc4c6534 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -736,6 +736,7 @@ public: _segment_manager->totals.total_size_on_disk += bytes; ++_segment_manager->totals.cycle_count; if (bytes == view.size_bytes()) { + clogger.debug("Final write of {} to {}: {}/{} bytes at {}", bytes, *this, size, size, off); return make_ready_future(stop_iteration::yes); } // gah, partial write. should always get here with dma chunk sized @@ -743,7 +744,7 @@ public: bytes = align_down(bytes, alignment); off += bytes; view.remove_prefix(bytes); - clogger.debug("Partial write {}: {}/{} bytes", *this, size - view.size_bytes(), size); + clogger.debug("Partial write of {} to {}: {}/{} bytes at at {}", bytes, *this, size - view.size_bytes(), size, off - bytes); return make_ready_future(stop_iteration::no); // TODO: retry/ignore/fail/stop - optional behaviour in origin. // we fast-fail the whole commit. From 00b33de25c42bdb3d850a115653270059cb7ea7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Mon, 4 Mar 2019 10:48:27 +0000 Subject: [PATCH 3/3] commitlog: use consistent chunk offsets in logs Logs in commitlog writer use offset in the file of the chunk header to identify chunks. However, the replayer is using offset after the header for the same purpose. This causes unnecessary confusion suggesting that the replayer is reading at the wrong position. This patch changes the replayer so that it reports chunk header offsets. --- 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 13fc4c6534..1d9419889f 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -1891,7 +1891,7 @@ db::commitlog::read_log_file(const sstring& filename, const sstring& pfx, seasta if (cs != checksum) { // if a chunk header checksum is broken, we shall just assume that all // remaining is as well. We cannot trust the "next" pointer, so... - clogger.debug("Checksum error in segment chunk at {}.", pos); + clogger.debug("Checksum error in segment chunk at {}.", start); corrupt_size += (file_size - pos); return stop(); }