use of org.apache.hadoop.hive.metastore.api.WriteNotificationLogBatchRequest in project hive by apache.
the class Hive method addWriteNotificationLogInBatch.
private boolean addWriteNotificationLogInBatch(Table tbl, List<WriteNotificationLogRequest> requestList) throws HiveException, MetaException, TException {
long start = System.currentTimeMillis();
boolean supported = true;
WriteNotificationLogBatchRequest rqst = new WriteNotificationLogBatchRequest(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), requestList);
try {
get(conf).getSynchronizedMSC().addWriteNotificationLogInBatch(rqst);
} catch (TApplicationException e) {
int type = e.getType();
if (type == TApplicationException.UNKNOWN_METHOD || type == TApplicationException.WRONG_METHOD_NAME) {
// For older HMS, if the batch API is not supported, fall back to older API.
LOG.info("addWriteNotificationLogInBatch failed with ", e);
for (WriteNotificationLogRequest request : requestList) {
get(conf).getSynchronizedMSC().addWriteNotificationLog(request);
}
supported = false;
}
}
long end = System.currentTimeMillis();
LOG.info("Time taken to add " + requestList.size() + " write notifications: " + ((end - start) / 1000F) + " seconds");
return supported;
}
Aggregations