You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2019/01/22 02:00:37 UTC

[hbase] 02/02: HBASE-21749 RS UI may throw NPE and make rs-status page inaccessible with multiwal and replication

This is an automated email from the ASF dual-hosted git repository.

apurtell pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit aa1b7508996335fb93fcd25db862d9de81711e31
Author: Nihal Jain <ni...@gmail.com>
AuthorDate: Mon Jan 21 12:50:50 2019 +0530

    HBASE-21749 RS UI may throw NPE and make rs-status page inaccessible with multiwal and replication
    
    Signed-off-by: Andrew Purtell <ap...@apache.org>
    
    Conflicts:
    	hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
    
    Amending-Author: Andrew Purtell <ap...@apache.org>
---
 .../hbase/replication/regionserver/ReplicationSource.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
index cae7c21..ad941e0 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
@@ -514,10 +514,17 @@ public class ReplicationSource extends Thread implements ReplicationSourceInterf
       replicationDelay =
           ReplicationLoad.calculateReplicationDelay(ageOfLastShippedOp, lastTimeStamp, queueSize);
       Path currentPath = worker.getCurrentPath();
-      try {
-        fileSize = fs.getContentSummary(currentPath).getLength();
-      } catch (IOException e) {
-        fileSize = -1;
+      fileSize = -1;
+      if (currentPath != null) {
+        try {
+          fileSize = fs.getContentSummary(currentPath).getLength();
+        } catch (IOException e) {
+          // Ignore, only affects the UI, which will show a size of -1 as expected
+          // when there is a problem getting the file size
+        }
+      } else {
+        currentPath = new Path("NO_LOGS_IN_QUEUE");
+        LOG.warn("No replication ongoing, waiting for new log");
       }
       ReplicationStatus.ReplicationStatusBuilder statusBuilder = ReplicationStatus.newBuilder();
       statusBuilder.withPeerId(this.getPeerClusterId())