Skip to content

Commit

Permalink
HBASE-28105 NPE in QuotaCache if Table is dropped from cluster (apach…
Browse files Browse the repository at this point in the history
…e#5426)

Signed-off-by: Bryan Beaudreault <[email protected]>
  • Loading branch information
hanke580 authored Sep 25, 2023
1 parent 4b76a95 commit 79fbbc3
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,24 @@ private void updateQuotaFactors() {

// 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);
}
}
}
Expand Down

0 comments on commit 79fbbc3

Please sign in to comment.