Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-7973 Hive Replication Support
  3. HIVE-9550

ObjectStore.getNextNotification() can return events inside NotificationEventResponse as null which conflicts with its thrift "required" tag

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Per hive_metastore.thrift, the "events" list inside NotificationEventResponse is a required field that cannot be null.

      struct NotificationEventResponse {
          1: required list<NotificationEvent> events,
      }
      

      However, per ObjectStore.java, this events field can be uninitialized if the events retrieved from the metastore is empty instead of null:

            NotificationEventResponse result = new NotificationEventResponse();
            int maxEvents = rqst.getMaxEvents() > 0 ? rqst.getMaxEvents() : Integer.MAX_VALUE;
            int numEvents = 0; 
            while (i.hasNext() && numEvents++ < maxEvents) {
              result.addToEvents(translateDbToThrift(i.next()));
            }    
            return result;
      

      The fix is simple enough - we need to call result.setEvents(new ArrayList<NotificationEvent>()) before we begin the iteration to do result.addToEvents(...).

        Attachments

        1. HIVE-9550.patch
          0.8 kB
          Sushanth Sowmyan

          Activity

            People

            • Assignee:
              sushanth Sushanth Sowmyan
              Reporter:
              sushanth Sushanth Sowmyan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: