Repository: kudu Updated Branches: refs/heads/master 80ebaeda8 -> 42dd8f842
[hms] relax the notification format restriction 'messageFormat' is an optional field in NotificationEvent thrift object introduced in HIVE-10562. In order to be compatible with Hive distributions that do not include HIVE-10652, this commit relaxes the restriction of HMS notification message format, so that the notification log listener can process the message even when the format type is not provided. Removing this restriction should not cause any regressions as long as the required fields are present in the messages. Change-Id: I09d0e36cebe2074d975504d6bbc5677107e33fe3 Reviewed-on: http://gerrit.cloudera.org:8080/11460 Reviewed-by: Adar Dembo <[email protected]> Tested-by: Kudu Jenkins Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/42dd8f84 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/42dd8f84 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/42dd8f84 Branch: refs/heads/master Commit: 42dd8f842bc242a19bfe569baa97112daf180e55 Parents: 80ebaed Author: Hao Hao <[email protected]> Authored: Mon Sep 17 18:07:04 2018 -0700 Committer: Hao Hao <[email protected]> Committed: Wed Sep 19 01:38:39 2018 +0000 ---------------------------------------------------------------------- src/kudu/master/hms_notification_log_listener.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/42dd8f84/src/kudu/master/hms_notification_log_listener.cc ---------------------------------------------------------------------- diff --git a/src/kudu/master/hms_notification_log_listener.cc b/src/kudu/master/hms_notification_log_listener.cc index 14e99b4..0c751a6 100644 --- a/src/kudu/master/hms_notification_log_listener.cc +++ b/src/kudu/master/hms_notification_log_listener.cc @@ -180,8 +180,12 @@ string EventDebugString(const hive::NotificationEvent& event) { // MessageFactory, this method is specialized to return the Document type. If // another MessageFactory instance becomes used in the future this method should // be updated to handle it accordingly. +// Also because 'messageFormat' is an optional field introduced in HIVE-10562. +// We consider message without this field valid, to be compatible with HIVE +// distributions that do not include HIVE-10562 but still have the proper +// JSONMessageFactory. Status ParseMessage(const hive::NotificationEvent& event, Document* message) { - if (event.messageFormat != "json-0.2") { + if (!event.messageFormat.empty() && event.messageFormat != "json-0.2") { return Status::NotSupported("unknown message format", event.messageFormat); } if (message->Parse<0>(event.message.c_str()).HasParseError()) {
