Apache9 commented on code in PR #5426:
URL: https://github.com/apache/hbase/pull/5426#discussion_r1334378481
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java:
##########
@@ -371,19 +371,21 @@ 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)) {
Review Comment:
Are we under a lock here? Otherwise it is still possible that when testing
containsKey, the map returns false but then the kv pair is removed from the map
and cause NPE below...
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]