diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index ddef3e27b405..0dc5b61cba8c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -2728,16 +2728,20 @@ protected void run() throws IOException { MasterQuotaManager quotaManager = getMasterQuotaManager(); if (quotaManager != null) { if (quotaManager.isQuotaInitialized()) { - SpaceQuotaSnapshot currSnapshotOfTable = - QuotaTableUtil.getCurrentSnapshotFromQuotaTable(getConnection(), tableName); - if (currSnapshotOfTable != null) { - SpaceQuotaStatus quotaStatus = currSnapshotOfTable.getQuotaStatus(); - if ( - quotaStatus.isInViolation() - && SpaceViolationPolicy.DISABLE == quotaStatus.getPolicy().orElse(null) - ) { - throw new AccessDeniedException("Enabling the table '" + tableName - + "' is disallowed due to a violated space quota."); + // skip checking quotas for system tables, see: + // https://issues.apache.org/jira/browse/HBASE-28183 + if (!tableName.isSystemTable()) { + SpaceQuotaSnapshot currSnapshotOfTable = + QuotaTableUtil.getCurrentSnapshotFromQuotaTable(getConnection(), tableName); + if (currSnapshotOfTable != null) { + SpaceQuotaStatus quotaStatus = currSnapshotOfTable.getQuotaStatus(); + if ( + quotaStatus.isInViolation() + && SpaceViolationPolicy.DISABLE == quotaStatus.getPolicy().orElse(null) + ) { + throw new AccessDeniedException("Enabling the table '" + tableName + + "' is disallowed due to a violated space quota."); + } } } } else if (LOG.isTraceEnabled()) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java index c577e9aceace..817f135f0c95 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java @@ -994,4 +994,15 @@ public int getQuotaSettingCount(Admin admin) throws IOException { } return quotaSettingCount; } + + @Test + public void testQuotaTableDisableAndEnable() throws Exception { + final Admin admin = TEST_UTIL.getAdmin(); + admin.disableTable(QuotaUtil.QUOTA_TABLE_NAME); + try { + admin.enableTable(QuotaUtil.QUOTA_TABLE_NAME); + } catch (Exception ex) { + fail("Got an exception while enabling table: " + QuotaUtil.QUOTA_TABLE_NAME); + } + } }