You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/09/30 17:01:23 UTC

[GitHub] [hbase] sanjeetnishad95 commented on a change in pull request #2163: HBASE-24789 When table level quota is set and violated, pre existing …

sanjeetnishad95 commented on a change in pull request #2163:
URL: https://github.com/apache/hbase/pull/2163#discussion_r497664990



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotaBasicFunctioning.java
##########
@@ -257,4 +258,35 @@ public boolean evaluate() throws Exception {
         .filter(k -> k.getTable().equals(tableName)).count();
     Assert.assertTrue(regionSizes > 0);
   }
+
+  @Test
+  public void testNSAndTableQuotaRemoveTableQuotaTableInViolation() throws Exception {
+    final String ns = testName.getMethodName();
+    NamespaceDescriptor nd = NamespaceDescriptor.create(ns).build();
+    TEST_UTIL.getAdmin().createNamespace(nd);
+    TableName table1 = helper.createTableInNamespace(nd);
+    TableName table2 = helper.createTableInNamespace(nd);
+    TableName table3 = helper.createTableInNamespace(nd);
+    Put put = new Put(Bytes.toBytes(("to_reject")));
+    put.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"),
+      Bytes.toBytes("reject"));
+    helper.setQuotaLimit(nd.getName(), SpaceViolationPolicy.NO_WRITES_COMPACTIONS, 4L);
+    helper.setQuotaLimit(table2, SpaceViolationPolicy.NO_WRITES, 2L);
+    helper.writeData(table2, 2L * SpaceQuotaHelperForTests.ONE_MEGABYTE);
+    helper.verifyViolation(SpaceViolationPolicy.NO_WRITES, table2, put);
+    helper.removeQuotaFromtable(table2);
+    helper.writeData(table1, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE);
+    helper.writeData(table3, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE);
+    Put put1 = new Put(Bytes.toBytes(("to_reject1")));
+    put1.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"),
+      Bytes.toBytes("reject"));
+    helper.verifyViolation(SpaceViolationPolicy.NO_WRITES_COMPACTIONS, table2, put1);
+    try {
+      TEST_UTIL.getAdmin().majorCompact(table2);
+      fail("Expected that invoking the compaction should throw an Exception");
+    } catch (DoNotRetryIOException e) {

Review comment:
       Couldn't unwrap as we are throwing DNRIOE directly :
   `throw new DoNotRetryIOException(
               "Compactions on this region are " + "disabled due to a space quota violation.");`
   But I'll update the assertion based on the message `"disabled due to a space quota violation.".`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org