Skip to content

Commit 3340d8d

Browse files
HBASE-28183 It's impossible to re-enable the quota table if it gets disabled (#5691)
Signed-off-by: Bryan Beaudreault <[email protected]> Signed-off-by: Pankaj Kumar <[email protected]>
1 parent eeebbdf commit 3340d8d

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,16 +2728,20 @@ protected void run() throws IOException {
27282728
MasterQuotaManager quotaManager = getMasterQuotaManager();
27292729
if (quotaManager != null) {
27302730
if (quotaManager.isQuotaInitialized()) {
2731-
SpaceQuotaSnapshot currSnapshotOfTable =
2732-
QuotaTableUtil.getCurrentSnapshotFromQuotaTable(getConnection(), tableName);
2733-
if (currSnapshotOfTable != null) {
2734-
SpaceQuotaStatus quotaStatus = currSnapshotOfTable.getQuotaStatus();
2735-
if (
2736-
quotaStatus.isInViolation()
2737-
&& SpaceViolationPolicy.DISABLE == quotaStatus.getPolicy().orElse(null)
2738-
) {
2739-
throw new AccessDeniedException("Enabling the table '" + tableName
2740-
+ "' is disallowed due to a violated space quota.");
2731+
// skip checking quotas for system tables, see:
2732+
// https://issues.apache.org/jira/browse/HBASE-28183
2733+
if (!tableName.isSystemTable()) {
2734+
SpaceQuotaSnapshot currSnapshotOfTable =
2735+
QuotaTableUtil.getCurrentSnapshotFromQuotaTable(getConnection(), tableName);
2736+
if (currSnapshotOfTable != null) {
2737+
SpaceQuotaStatus quotaStatus = currSnapshotOfTable.getQuotaStatus();
2738+
if (
2739+
quotaStatus.isInViolation()
2740+
&& SpaceViolationPolicy.DISABLE == quotaStatus.getPolicy().orElse(null)
2741+
) {
2742+
throw new AccessDeniedException("Enabling the table '" + tableName
2743+
+ "' is disallowed due to a violated space quota.");
2744+
}
27412745
}
27422746
}
27432747
} else if (LOG.isTraceEnabled()) {

hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,4 +994,15 @@ public int getQuotaSettingCount(Admin admin) throws IOException {
994994
}
995995
return quotaSettingCount;
996996
}
997+
998+
@Test
999+
public void testQuotaTableDisableAndEnable() throws Exception {
1000+
final Admin admin = TEST_UTIL.getAdmin();
1001+
admin.disableTable(QuotaUtil.QUOTA_TABLE_NAME);
1002+
try {
1003+
admin.enableTable(QuotaUtil.QUOTA_TABLE_NAME);
1004+
} catch (Exception ex) {
1005+
fail("Got an exception while enabling table: " + QuotaUtil.QUOTA_TABLE_NAME);
1006+
}
1007+
}
9971008
}

0 commit comments

Comments
 (0)