use of org.apache.hadoop.hive.ql.lock.CompileLock in project hive by apache.
the class Driver method compileInternal.
private void compileInternal(String command, boolean deferClose) throws CommandProcessorException {
Metrics metrics = MetricsFactory.getInstance();
if (metrics != null) {
metrics.incrementCounter(MetricsConstant.WAITING_COMPILE_OPS, 1);
}
PerfLogger perfLogger = SessionState.getPerfLogger(true);
perfLogger.perfLogBegin(CLASS_NAME, PerfLogger.WAIT_COMPILE);
try (CompileLock compileLock = CompileLockFactory.newInstance(driverContext.getConf(), command)) {
boolean success = compileLock.tryAcquire();
perfLogger.perfLogEnd(CLASS_NAME, PerfLogger.WAIT_COMPILE);
if (metrics != null) {
metrics.decrementCounter(MetricsConstant.WAITING_COMPILE_OPS, 1);
}
if (!success) {
String errorMessage = ErrorMsg.COMPILE_LOCK_TIMED_OUT.getErrorCodedMsg();
throw DriverUtils.createProcessorException(driverContext, ErrorMsg.COMPILE_LOCK_TIMED_OUT.getErrorCode(), errorMessage, null, null);
}
try {
compile(command, true, deferClose);
} catch (CommandProcessorException cpe) {
try {
driverTxnHandler.endTransactionAndCleanup(false);
} catch (LockException e) {
LOG.warn("Exception in releasing locks", e);
}
throw cpe;
}
}
// Save compile-time PerfLogging for WebUI.
// Execution-time Perf logs are done by either another thread's PerfLogger or a reset PerfLogger.
driverContext.getQueryDisplay().setPerfLogStarts(QueryDisplay.Phase.COMPILATION, perfLogger.getStartTimes());
driverContext.getQueryDisplay().setPerfLogEnds(QueryDisplay.Phase.COMPILATION, perfLogger.getEndTimes());
}
Aggregations