This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit e8a8325b0fd1afaa60394a91b55a31fa63a25516 Author: Alexey Serbin <[email protected]> AuthorDate: Fri Mar 21 17:01:25 2025 -0700 KUDU-3481 more diagnostics on non-monotonic event IDs This is to help understand where the issue reported by KUDU-3481 originates from: whether it's due to non-monotonic or duplicate event IDs in the response received from HMS, or that's something else. Change-Id: Idac2f8969e10f066442aad0570c41767b98a0b75 Reviewed-on: http://gerrit.cloudera.org:8080/22657 Tested-by: Alexey Serbin <[email protected]> Reviewed-by: Yifan Zhang <[email protected]> --- src/kudu/master/hms_notification_log_listener.cc | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/kudu/master/hms_notification_log_listener.cc b/src/kudu/master/hms_notification_log_listener.cc index 67e369478..2e6ba2cce 100644 --- a/src/kudu/master/hms_notification_log_listener.cc +++ b/src/kudu/master/hms_notification_log_listener.cc @@ -17,8 +17,10 @@ #include "kudu/master/hms_notification_log_listener.h" +#include <cstddef> #include <cstdint> #include <functional> +#include <limits> #include <map> #include <optional> #include <ostream> @@ -76,6 +78,7 @@ TAG_FLAG(hive_metastore_notification_log_listener_catch_up_deadline_ms, runtime) using rapidjson::Document; using rapidjson::Value; using std::optional; +using std::ostringstream; using std::string; using std::vector; using strings::Substitute; @@ -259,6 +262,33 @@ Status HmsNotificationLogListenerTask::Poll() { } } +#if DCHECK_IS_ON() + { + int64_t last_seen_event_id = std::numeric_limits<int64_t>::min(); + for (size_t idx = 0; idx < events.size(); ++idx) { + const auto event_id = events[idx].eventId; + DCHECK_GT(event_id, std::numeric_limits<int64_t>::min()); + if (event_id > last_seen_event_id) { + last_seen_event_id = event_id; + continue; + } + // Print out diagnostic information into the logs. + DCHECK_GT(idx, 0); + string msg = Substitute( + "non-monotonous event IDs from HMS: current $0, previous $1; " + "dumping first $2 out of $3 received events:", + event_id, events[idx - 1].eventId, idx + 1, events.size()); + ostringstream events_str; + for (size_t j = 0; j <= idx; ++j) { + events_str << " "; + events[j].printTo(events_str); + events_str << ";"; + } + LOG(DFATAL) << msg << events_str.str(); + } + } +#endif // #if DCHECK_IS_ON() ... + for (const auto& event : events) { VLOG(1) << "Processing notification log event: " << EventDebugString(event);
