HBASE-18330 NPE in ReplicationZKLockCleanerChore

This commit is contained in:
Andrew Purtell 2017-07-19 15:46:45 -07:00
parent 2da5b432a1
commit cfd5b6b59f
6 changed files with 14 additions and 3 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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();
}

View File

@ -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);

View File

@ -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();