HBASE-25311 UI throws NPE (#2688)
Signed-off-by: Guanghao Zhang <zghao@apache.org>
Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
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 bbd8c0e..7adbeb0 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 @@
List<ReplicationLoadSource> replicationLoadSources =
getServerManager().getLoad(serverName).getReplicationLoadSourceList();
for (ReplicationLoadSource replicationLoadSource : replicationLoadSources) {
- replicationLoadSourceMap.get(replicationLoadSource.getPeerID())
- .add(new Pair<>(serverName, replicationLoadSource));
+ List<Pair<ServerName, ReplicationLoadSource>> 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<Pair<ServerName, ReplicationLoadSource>> loads : replicationLoadSourceMap.values()) {