Bryan Beaudreault created HBASE-27973:
-----------------------------------------
Summary: NPE in QuotaCache if Table is dropped from cluster
Key: HBASE-27973
URL: https://issues.apache.org/jira/browse/HBASE-27973
Project: HBase
Issue Type: Bug
Reporter: Bryan Beaudreault
{code:java}
java.lang.NullPointerException: Cannot invoke
"org.apache.hadoop.hbase.client.RegionStatesCount.getOpenRegions()" because the
return value of "java.util.Map.get(Object)" is null at
org.apache.hadoop.hbase.quotas.QuotaCache$QuotaRefresherChore.updateQuotaFactors(QuotaCache.java:378)
~[hbase.jar] at
org.apache.hadoop.hbase.quotas.QuotaCache$QuotaRefresherChore.chore(QuotaCache.java:224)
~[hbase.jar] at
org.apache.hadoop.hbase.ScheduledChore.run(ScheduledChore.java:161)
~[hbase.jar] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
~[?:?] at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
~[?:?] at
org.apache.hadoop.hbase.JitterScheduledThreadPoolExecutorImpl$JitteredRunnableScheduledFuture.run(JitterScheduledThreadPoolExecutorImpl.java:107)
~[hbase.jar] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
~[?:?] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] {code}
This is on 2.5.2, so the line numbers don't perfectly match with current
branch-2. But the problem is
[here|https://github.com/apache/hbase/blob/branch-2/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java#L376].
We may have cached a TableName in tableQuotaCache, and the table may have
since been dropped from the cluster. In which case, tableRegionStatesCount
which comes from ClusterMetrics, will not have that table.
We need to protect the lookup with a containsKey or null check, rather than
directly call getOpenRegions() on the result. It probably makes sense to remove
the tableName from the tableQuotaCache in this case.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)