You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/12/31 12:45:53 UTC
[17/47] hbase git commit: HBASE-21592 quota.addGetResult(r) throw NPE
HBASE-21592 quota.addGetResult(r) throw NPE
Signed-off-by: huzheng <op...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f7828468
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f7828468
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f7828468
Branch: refs/heads/HBASE-21512
Commit: f78284685fc533230a0395d297ebacff32632396
Parents: 1971d02
Author: xuqinya <xu...@163.com>
Authored: Tue Dec 18 08:19:47 2018 +0800
Committer: huzheng <op...@gmail.com>
Committed: Tue Dec 18 16:15:51 2018 +0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/RSRpcServices.java | 3 ++-
.../hadoop/hbase/quotas/TestQuotaThrottle.java | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/f7828468/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 31df37a..f788a86 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -2571,7 +2571,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
}
builder.setResult(pbr);
}
- if (r != null) {
+ //r.cells is null when an table.exists(get) call
+ if (r != null && r.rawCells() != null) {
quota.addGetResult(r);
}
return builder.build();
http://git-wip-us.apache.org/repos/asf/hbase/blob/f7828468/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java
index e506a08..c069403 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java
@@ -553,6 +553,23 @@ public class TestQuotaThrottle {
triggerTableCacheRefresh(true, TABLE_NAMES[0]);
}
+ @Test
+ public void testTableExistsGetThrottle() throws Exception {
+ final Admin admin = TEST_UTIL.getAdmin();
+
+ // Add throttle quota
+ admin.setQuota(QuotaSettingsFactory.throttleTable(TABLE_NAMES[0],
+ ThrottleType.REQUEST_NUMBER, 100, TimeUnit.MINUTES));
+ triggerTableCacheRefresh(false, TABLE_NAMES[0]);
+
+ Table table = TEST_UTIL.getConnection().getTable(TABLE_NAMES[0]);
+ // An exists call when having throttle quota
+ table.exists(new Get(Bytes.toBytes("abc")));
+
+ admin.setQuota(QuotaSettingsFactory.unthrottleTable(TABLE_NAMES[0]));
+ triggerTableCacheRefresh(true, TABLE_NAMES[0]);
+ }
+
private int doPuts(int maxOps, final Table... tables) throws Exception {
return doPuts(maxOps, -1, tables);
}