You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/11/21 18:01:21 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #2688: HBASE-25311 UI throws NPE

virajjasani commented on a change in pull request #2688:
URL: https://github.com/apache/hbase/pull/2688#discussion_r528223952



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -3621,8 +3621,15 @@ public ReplicationPeerManager getReplicationPeerManager() {
       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 =

Review comment:
       nit: if debug log is not that imp, this could be replaced with few lines of code using for-each and lambda:
   ```
         replicationLoadSources.forEach(replicationLoadSource -> Optional
           .ofNullable(replicationLoadSourceMap.get(replicationLoadSource.getPeerID()))
           .ifPresent(pairs -> pairs.add(new Pair<>(serverName, replicationLoadSource))));
   ```
   However, if debug log is imp, feel free to ignore this nit.

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -3621,8 +3621,15 @@ public ReplicationPeerManager getReplicationPeerManager() {
       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(replicationLoadSource.getPeerID() + " 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");

Review comment:
       Please use placeholder in log with argument: `LOG.debug("{} does not exist,.....", replicationLoadSource.getPeerID());`




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org