This is an automated email from the ASF dual-hosted git repository. kalyan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sentry.git
commit 75392e87a9f2e91410702475a0153b1795ecab2f Author: Kalyan Kumar Kalvagadda <[email protected]> AuthorDate: Thu Dec 12 17:41:46 2019 +0000 SENTRY-2538: consecutiveUpdateFailuresCount is not reset (Laszlo Denes Terjeki rviewed by Kalyan Kumar Kalvagadda) Change-Id: I5406678f309d92366105c83d2a962e9a941f2372 --- .../java/org/apache/sentry/provider/db/generic/UpdatableCache.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java index a57e2ee..c9a78ce 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/UpdatableCache.java @@ -165,6 +165,7 @@ public final class UpdatableCache implements TableCache, AutoCloseable { try { LOGGER.debug("Loading all data."); reloadData(); + consecutiveUpdateFailuresCount = 0; } catch (Exception e) { LOGGER.warn("Exception while updating data from DB", e); revokeAllPrivilegesIfRequired(); @@ -178,12 +179,12 @@ public final class UpdatableCache implements TableCache, AutoCloseable { private void revokeAllPrivilegesIfRequired() { if (++consecutiveUpdateFailuresCount > allowedUpdateFailuresCount) { + LOGGER.error("Failed to update roles and privileges cache for " + consecutiveUpdateFailuresCount + " times." + + " Revoking all privileges from cache, which will cause all authorization requests to fail."); consecutiveUpdateFailuresCount = 0; // Clear cache to revoke all privileges. // Update table cache to point to an empty table to avoid thread-unsafe characteristics of HashBasedTable. this.table = HashBasedTable.create(); - LOGGER.error("Failed to update roles and privileges cache for " + consecutiveUpdateFailuresCount + " times." + - " Revoking all privileges from cache, which will cause all authorization requests to fail."); } }
