protected HiveHookEvents.HiveHookEventProto getRelatedTezEvent(String dbTableName) throws Exception {
    int retryCount = 3;
    while (retryCount-- > 0) {
      List<ProtoMessageReader<HiveHookEvents.HiveHookEventProto>> readers = TestHiveProtoLoggingHook.getTestReader(conf, tmpFolder);
      for (ProtoMessageReader<HiveHookEvents.HiveHookEventProto> reader : readers) {
        do {
          HiveHookEvents.HiveHookEventProto event;
          try {
            if ((event = reader.readEvent()) == null) {
              break;
            }
          } catch (IOException e) {
            //IO error, or reached end of current event file. Advancing to next.
            break;
          }
          if (ExecutionMode.TEZ.equals(ExecutionMode.valueOf(event.getExecutionMode())) &&
              event.getTablesReadCount() > 0 &&
              dbTableName.equalsIgnoreCase(event.getTablesRead(0))) {
            return event;
          }
        } while (true);
      }
      //Since Event writing is async it may happen that the event we are looking for is not yet written out.
      //Let's retry it after waiting a bit
      Thread.sleep(3000);
    }
    return null;
  }
Verify that the expected number of compactions have run, and their state is "succeeded".

@param expectedSuccessfulCompactions number of compactions already run
@throws MetaException
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorOnTezTest.java