Skip to content

Commit

Permalink
HIVE-14267: HS2 open_operations metrics not decremented when an opera…
Browse files Browse the repository at this point in the history
…tion gets timed out (Naveen Gangam, reviewed by Chaoyu Tang, Aihua Xu)
  • Loading branch information
ctang committed Jul 22, 2016
1 parent 64a053b commit 589ced8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ private Operation removeOperation(OperationHandle opHandle) {
private Operation removeTimedOutOperation(OperationHandle operationHandle) {
Operation operation = handleToOperation.get(operationHandle);
if (operation != null && operation.isTimedOut(System.currentTimeMillis())) {
LOG.info("Operation is timed out,operation=" + operation.getHandle() + ",state=" + operation.getState().toString());
Metrics metrics = MetricsFactory.getInstance();
if (metrics != null) {
try {
metrics.decrementCounter(MetricsConstant.OPEN_OPERATIONS);
} catch (Exception e) {
LOG.warn("Error decrementing open_operations metric, reported values may be incorrect", e);
}
}

handleToOperation.remove(operationHandle, operation);
if (operation instanceof SQLOperation) {
removeSaveSqlOperationDisplay(operationHandle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ private void closeTimedOutOperations(List<Operation> operations) {
try {
operation.close();
} catch (Exception e) {
LOG.warn("Exception is thrown closing timed-out operation " + operation.getHandle(), e);
LOG.warn("Exception is thrown closing timed-out operation, reported open_operations metrics may be incorrect " + operation.getHandle(), e);
}
}
} finally {
Expand Down

0 comments on commit 589ced8

Please sign in to comment.