From cb0cd448910b0205aae92c143e35f3feb3a551a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20M=C4=99drek?= Date: Wed, 16 Jul 2025 16:40:52 +0200 Subject: [PATCH 1/2] db/hints: Increase log level in critical functions We increase the log level in more important functions to capture more information about the behavior of hints. All of the promoted logs are printed rarely, so they should not clog the log files, but at the same time they provide more insight into what has already happened and what has not. --- db/hints/internal/hint_sender.cc | 4 ++-- db/hints/manager.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/hints/internal/hint_sender.cc b/db/hints/internal/hint_sender.cc index ed8dbb901e..7157679e51 100644 --- a/db/hints/internal/hint_sender.cc +++ b/db/hints/internal/hint_sender.cc @@ -175,14 +175,14 @@ future<> hint_sender::stop(drain should_drain) noexcept { // // The next call for send_hints_maybe() will send the last hints to the current end point and when it is // done there is going to be no more pending hints and the corresponding hints directory may be removed. - manager_logger.trace("Draining for {}: start", end_point_key()); + manager_logger.info("Draining for {}: start", end_point_key()); set_draining(); send_hints_maybe(); _ep_manager.flush_current_hints().handle_exception([] (auto e) { manager_logger.error("Failed to flush pending hints: {}. Ignoring...", e); }).get(); send_hints_maybe(); - manager_logger.trace("Draining for {}: end", end_point_key()); + manager_logger.info("Draining for {}: end", end_point_key()); } // TODO: Change this log to match the class name, but first make sure no test // relies on the old one. diff --git a/db/hints/manager.cc b/db/hints/manager.cc index 637944a95d..4dbdd27467 100644 --- a/db/hints/manager.cc +++ b/db/hints/manager.cc @@ -539,7 +539,7 @@ future<> manager::change_host_filter(host_filter filter) { "change_host_filter: cannot change the configuration because hints all hints were drained"}); } - manager_logger.debug("change_host_filter: changing from {} to {}", _host_filter, filter); + manager_logger.info("change_host_filter: changing from {} to {}", _host_filter, filter); // Change the host_filter now and save the old one so that we can // roll back in case of failure @@ -635,7 +635,7 @@ future<> manager::drain_for(endpoint_id host_id, gms::inet_address ip) noexcept co_return; } - manager_logger.trace("Draining starts for {}", host_id); + manager_logger.info("Draining starts for {}", host_id); const auto holder = seastar::gate::holder{_draining_eps_gate}; // As long as we hold on to this lock, no migration of hinted handoff to host IDs @@ -661,7 +661,7 @@ future<> manager::drain_for(endpoint_id host_id, gms::inet_address ip) noexcept return ep_man.with_file_update_mutex([&ep_man] -> future<> { return remove_file(ep_man.hints_dir().native()).then([&ep_man] { - manager_logger.debug("Removed hint directory for {}", ep_man.end_point_key()); + manager_logger.info("Removed hint directory for {}", ep_man.end_point_key()); }); }); }); @@ -722,7 +722,7 @@ future<> manager::drain_for(endpoint_id host_id, gms::inet_address ip) noexcept manager_logger.error("Exception when draining {}: {}", host_id, eptr); } - manager_logger.trace("drain_for: finished draining {}", host_id); + manager_logger.info("drain_for: finished draining {}", host_id); } void manager::update_backlog(size_t backlog, size_t max_backlog) { From b559c1f0b643056a4761a814ca7e3aa9e0858659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20M=C4=99drek?= Date: Wed, 16 Jul 2025 16:44:04 +0200 Subject: [PATCH 2/2] db/hints/manager.cc: Add logs for changing host filter We add new logs when the host filter is undergoing a change. It should not happen very often and so it shouldn't clog the log files. At the same time, it provides us with useful information when debugging. --- db/hints/manager.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/hints/manager.cc b/db/hints/manager.cc index 4dbdd27467..185a8e76c5 100644 --- a/db/hints/manager.cc +++ b/db/hints/manager.cc @@ -611,11 +611,19 @@ future<> manager::change_host_filter(host_filter filter) { }); }); } catch (...) { + const sstring exception_message = eptr + ? seastar::format("{} + {}", eptr, std::current_exception()) + : seastar::format("{}", std::current_exception()); + + manager_logger.warn("Changing the host filter has failed: {}", exception_message); + if (eptr) { std::throw_with_nested(eptr); } throw; } + + manager_logger.info("The host filter has been changed successfully"); } bool manager::check_dc_for(endpoint_id ep) const noexcept {