You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bb...@apache.org on 2023/09/25 17:06:00 UTC
[hbase] branch master updated: HBASE-28105 NPE in QuotaCache if Table is dropped from cluster (#5426)
This is an automated email from the ASF dual-hosted git repository.
bbeaudreault pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new 79fbbc3ef44 HBASE-28105 NPE in QuotaCache if Table is dropped from cluster (#5426)
79fbbc3ef44 is described below
commit 79fbbc3ef44fc599eee61c6170342fc1b49bf39b
Author: Ke Han <38...@users.noreply.github.com>
AuthorDate: Mon Sep 25 13:05:54 2023 -0400
HBASE-28105 NPE in QuotaCache if Table is dropped from cluster (#5426)
Signed-off-by: Bryan Beaudreault <bb...@apache.org>
---
.../org/apache/hadoop/hbase/quotas/QuotaCache.java | 27 +++++++++++++---------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
index 56253f7fcbb..0f7b5e42e68 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
@@ -371,19 +371,24 @@ public class QuotaCache implements Stoppable {
// Update table machine quota factors
for (TableName tableName : tableQuotaCache.keySet()) {
- double factor = 1;
- try {
- long regionSize = tableRegionStatesCount.get(tableName).getOpenRegions();
- if (regionSize == 0) {
- factor = 0;
- } else {
- int localRegionSize = rsServices.getRegions(tableName).size();
- factor = 1.0 * localRegionSize / regionSize;
+ if (tableRegionStatesCount.containsKey(tableName)) {
+ double factor = 1;
+ try {
+ long regionSize = tableRegionStatesCount.get(tableName).getOpenRegions();
+ if (regionSize == 0) {
+ factor = 0;
+ } else {
+ int localRegionSize = rsServices.getRegions(tableName).size();
+ factor = 1.0 * localRegionSize / regionSize;
+ }
+ } catch (IOException e) {
+ LOG.warn("Get table regions failed: {}", tableName, e);
}
- } catch (IOException e) {
- LOG.warn("Get table regions failed: {}", tableName, e);
+ tableMachineQuotaFactors.put(tableName, factor);
+ } else {
+ // TableName might have already been dropped (outdated)
+ tableMachineQuotaFactors.remove(tableName);
}
- tableMachineQuotaFactors.put(tableName, factor);
}
}
}