Skip to content

Commit

Permalink
fixes tablet update metrics incrementing
Browse files Browse the repository at this point in the history
Some tablet update metrics were incrmenting a counter by zero. Changed
the increment to one.  Noticed this while working on apache#4511.
  • Loading branch information
keith-turner committed Nov 1, 2024
1 parent d888cd8 commit 722f32e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@ private void setUpdateTablet(UpdateSession us, KeyExtent keyExtent) {
// not serving tablet, so report all mutations as
// failures
us.failures.put(keyExtent, 0L);
server.updateMetrics.addUnknownTabletErrors(0);
server.updateMetrics.addUnknownTabletErrors(1);
}
} else {
log.warn("Denying access to table {} for user {}", keyExtent.tableId(), us.getUser());
long t2 = System.currentTimeMillis();
us.authTimes.addStat(t2 - t1);
us.currentTablet = null;
us.authFailures.put(keyExtent, SecurityErrorCode.PERMISSION_DENIED);
server.updateMetrics.addPermissionErrors(0);
server.updateMetrics.addPermissionErrors(1);
}
} catch (TableNotFoundException tnfe) {
log.error("Table " + tableId + " not found ", tnfe);
long t2 = System.currentTimeMillis();
us.authTimes.addStat(t2 - t1);
us.currentTablet = null;
us.authFailures.put(keyExtent, SecurityErrorCode.TABLE_DOESNT_EXIST);
server.updateMetrics.addUnknownTabletErrors(0);
server.updateMetrics.addUnknownTabletErrors(1);
return;
} catch (ThriftSecurityException e) {
log.error("Denying permission to check user " + us.getUser() + " with user " + e.getUser(),
Expand All @@ -316,7 +316,7 @@ private void setUpdateTablet(UpdateSession us, KeyExtent keyExtent) {
us.authTimes.addStat(t2 - t1);
us.currentTablet = null;
us.authFailures.put(keyExtent, e.getCode());
server.updateMetrics.addPermissionErrors(0);
server.updateMetrics.addPermissionErrors(1);
return;
}
}
Expand Down Expand Up @@ -416,7 +416,7 @@ private void flush(UpdateSession us) {

if (!prepared.getViolations().isEmpty()) {
us.violations.add(prepared.getViolations());
server.updateMetrics.addConstraintViolations(0);
server.updateMetrics.addConstraintViolations(1);
}
// Use the size of the original mutation list, regardless of how many mutations
// did not violate constraints.
Expand Down

0 comments on commit 722f32e

Please sign in to comment.