mirror of
https://github.com/apache/impala.git
synced 2025-12-30 03:01:44 -05:00
IMPALA-11490 adds a catalog metric for the latest event id in HMS. The fetched events could be empty if there are no more events in the past 24 hours, since the retention duration for notification events in HMS is 24 hours by default. This case is not handled so the thread for updating the latestEventId metric will keep throwing a NoSuchElementException until there are new events generated. This patch handles the case to avoid exceptions, also sets the initial value of latestEventId to 0 which is the returned value of getCurrentNotificationEventId() when there are no events in HMS. Tests - Clean up the notification events in HMS by truncating the NOTIFICATION_SEQUENCE and NOTIFICATION_LOG tables in the underlying PostgreSQL. Then launch HMS and Impala. Verified the exception disappears. - Add a breakpoint in updateLatestEventId() to stop before fetching the events and after getting the current event id. Clean up the notification events in HMS. Then resume catalogd. Verified no exceptions are thrown. Change-Id: I0f207fff1ff59376e30afdc3cd074c950a1c3ddb Reviewed-on: http://gerrit.cloudera.org:8080/19112 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>