hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [5/7] hbase git commit: HBASE-18330 NPE in ReplicationZKLockCleanerChore
Date Wed, 19 Jul 2017 23:21:26 GMT
HBASE-18330 NPE in ReplicationZKLockCleanerChore


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ffb702cd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ffb702cd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ffb702cd

Branch: refs/heads/branch-1.4
Commit: ffb702cd4a6a9c311bbb4942fd404ea8358c72b1
Parents: 68e9f21
Author: Andrew Purtell <apurtell@apache.org>
Authored: Wed Jul 19 15:46:45 2017 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Jul 19 15:48:18 2017 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java  | 3 +++
 .../hbase/master/cleaner/ReplicationZKLockCleanerChore.java      | 4 +++-
 .../hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java    | 3 +++
 .../hadoop/hbase/replication/master/ReplicationLogCleaner.java   | 2 +-
 .../hbase/replication/regionserver/DumpReplicationQueues.java    | 3 +++
 .../hbase/replication/regionserver/ReplicationSourceManager.java | 2 +-
 6 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java
index b242ca7..c2999ec 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeersZKImpl.java
@@ -528,6 +528,9 @@ public class ReplicationPeersZKImpl extends ReplicationStateZKBase implements
Re
     if (queuesClient == null) return;
     try {
       List<String> replicators = queuesClient.getListOfReplicators();
+      if (replicators == null || replicators.isEmpty()) {
+        return;
+      }
       for (String replicator : replicators) {
         List<String> queueIds = queuesClient.getAllQueues(replicator);
         for (String queueId : queueIds) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKLockCleanerChore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKLockCleanerChore.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKLockCleanerChore.java
index dc5338e..3fa30bf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKLockCleanerChore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKLockCleanerChore.java
@@ -76,7 +76,9 @@ public class ReplicationZKLockCleanerChore extends ScheduledChore {
       }
       Set<String> rsSet = new HashSet<String>(regionServers);
       List<String> replicators = queues.getListOfReplicators();
-
+      if (replicators == null || replicators.isEmpty()) {
+        return;
+      }
       for (String replicator: replicators) {
         try {
           String lockNode = queues.getLockZNode(replicator);

http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java
index 8311b8d..f559510 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/ReplicationZKNodeCleaner.java
@@ -80,6 +80,9 @@ public class ReplicationZKNodeCleaner {
     Set<String> peerIds = new HashSet<>(this.replicationPeers.getAllPeerIds());
     try {
       List<String> replicators = this.queuesClient.getListOfReplicators();
+      if (replicators == null || replicators.isEmpty()) {
+        return undeletedQueues;
+      }
       for (String replicator : replicators) {
         List<String> queueIds = this.queuesClient.getAllQueues(replicator);
         for (String queueId : queueIds) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
index 9ecba11..7731240 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
@@ -98,7 +98,7 @@ public class ReplicationLogCleaner extends BaseLogCleanerDelegate {
     for (int retry = 0; ; retry++) {
       int v0 = replicationQueues.getQueuesZNodeCversion();
       List<String> rss = replicationQueues.getListOfReplicators();
-      if (rss == null) {
+      if (rss == null || rss.isEmpty()) {
         LOG.debug("Didn't find any region server that replicates, won't prevent any deletions.");
         return ImmutableSet.of();
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/DumpReplicationQueues.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/DumpReplicationQueues.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/DumpReplicationQueues.java
index 0772f89..ee90904 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/DumpReplicationQueues.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/DumpReplicationQueues.java
@@ -307,6 +307,9 @@ public class DumpReplicationQueues extends Configured implements Tool
{
     // Loops each peer on each RS and dumps the queues
     try {
       List<String> regionservers = queuesClient.getListOfReplicators();
+      if (regionservers == null || regionservers.isEmpty()) {
+        return sb.toString();
+      }
       for (String regionserver : regionservers) {
         List<String> queueIds = queuesClient.getAllQueues(regionserver);
         replicationQueues.init(regionserver);

http://git-wip-us.apache.org/repos/asf/hbase/blob/ffb702cd/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
index ed2aa1d..b50e840 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
@@ -254,7 +254,7 @@ public class ReplicationSourceManager implements ReplicationListener {
       }
     }
     List<String> currentReplicators = this.replicationQueues.getListOfReplicators();
-    if (currentReplicators == null || currentReplicators.size() == 0) {
+    if (currentReplicators == null || currentReplicators.isEmpty()) {
       return;
     }
     List<String> otherRegionServers = replicationTracker.getListOfRegionServers();


Mime
View raw message