From b0f20399e7c2aab624e6e3eda6b1838b40c41faf Mon Sep 17 00:00:00 2001 From: Bo Cui Date: Mon, 23 Nov 2020 12:07:42 +0800 Subject: [PATCH] HBASE-25311 UI throws NPE (#2688) Signed-off-by: Guanghao Zhang Signed-off-by: Wellington Chevreuil Signed-off-by: Viraj Jasani --- .../java/org/apache/hadoop/hbase/master/HMaster.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index bbd8c0e4fbb..7adbeb0ce87 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -3621,8 +3621,15 @@ public class HMaster extends HRegionServer implements MasterServices { List replicationLoadSources = getServerManager().getLoad(serverName).getReplicationLoadSourceList(); for (ReplicationLoadSource replicationLoadSource : replicationLoadSources) { - replicationLoadSourceMap.get(replicationLoadSource.getPeerID()) - .add(new Pair<>(serverName, replicationLoadSource)); + List> replicationLoadSourceList = + replicationLoadSourceMap.get(replicationLoadSource.getPeerID()); + if (replicationLoadSourceList == null) { + LOG.debug("{} does not exist, but it exists " + + "in znode(/hbase/replication/rs). when the rs restarts, peerId is deleted, so " + + "we just need to ignore it", replicationLoadSource.getPeerID()); + continue; + } + replicationLoadSourceList.add(new Pair<>(serverName, replicationLoadSource)); } } for (List> loads : replicationLoadSourceMap.values()) {