You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by el...@apache.org on 2018/02/22 14:53:03 UTC

[2/2] hbase git commit: HBASE-20035 Stabilize the flaky TestQuotaStatusRPCs

HBASE-20035 Stabilize the flaky TestQuotaStatusRPCs

The test will fail if the quota moves to violation before
the second half of the test.

Signed-off-by: Michael Stack <st...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4cf846d0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4cf846d0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4cf846d0

Branch: refs/heads/master
Commit: 4cf846d08570256115ac8c2787d0f7fbf162be23
Parents: 2440f80
Author: Josh Elser <el...@apache.org>
Authored: Wed Feb 21 17:17:57 2018 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Feb 22 09:40:20 2018 -0500

----------------------------------------------------------------------
 .../hadoop/hbase/quotas/TestQuotaStatusRPCs.java       | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4cf846d0/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java
index dffa637..3e14b8a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java
@@ -199,8 +199,11 @@ public class TestQuotaStatusRPCs {
 
   @Test
   public void testQuotaStatusFromMaster() throws Exception {
-    final long sizeLimit = 1024L * 10L; // 10KB
-    final long tableSize = 1024L * 5; // 5KB
+    final long sizeLimit = 1024L * 25L; // 25KB
+    // As of 2.0.0-beta-2, this 1KB of "Cells" actually results in about 15KB on disk (HFiles)
+    // This is skewed a bit since we're writing such little data, so the test needs to keep
+    // this in mind; else, the quota will be in violation before the test expects it to be.
+    final long tableSize = 1024L * 1; // 1KB
     final long nsLimit = Long.MAX_VALUE;
     final int numRegions = 10;
     final TableName tn = helper.createTableWithRegions(numRegions);
@@ -245,6 +248,12 @@ public class TestQuotaStatusRPCs {
       }
     });
 
+    // Sanity check: the below assertions will fail if we somehow write too much data
+    // and force the table to move into violation before we write the second bit of data.
+    SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn);
+    assertTrue("QuotaSnapshot for " + tn + " should be non-null and not in violation",
+        snapshot != null && !snapshot.getQuotaStatus().isInViolation());
+
     try {
       helper.writeData(tn, tableSize * 2L);
     } catch (RetriesExhaustedWithDetailsException | SpaceLimitingException e) {