HBASE-18330 NPE in ReplicationZKLockCleanerChore

This commit is contained in:
Andrew Purtell 2017-07-19 15:46:08 -07:00
parent 51067caef9
commit cbf390422b
4 changed files with 10 additions and 1 deletions

View File

@ -520,6 +520,9 @@ public class ReplicationPeersZKImpl extends ReplicationStateZKBase implements Re
if (queuesClient == null) return; if (queuesClient == null) return;
try { try {
List<String> replicators = queuesClient.getListOfReplicators(); List<String> replicators = queuesClient.getListOfReplicators();
if (replicators == null || replicators.isEmpty()) {
return;
}
for (String replicator : replicators) { for (String replicator : replicators) {
List<String> queueIds = queuesClient.getAllQueues(replicator); List<String> queueIds = queuesClient.getAllQueues(replicator);
for (String queueId : queueIds) { for (String queueId : queueIds) {

View File

@ -98,7 +98,7 @@ public class ReplicationQueuesClientZKImpl extends ReplicationStateZKBase implem
for (int retry = 0; ; retry++) { for (int retry = 0; ; retry++) {
int v0 = getQueuesZNodeCversion(); int v0 = getQueuesZNodeCversion();
List<String> rss = getListOfReplicators(); List<String> rss = getListOfReplicators();
if (rss == null) { if (rss == null || rss.isEmpty()) {
LOG.debug("Didn't find any region server that replicates, won't prevent any deletions."); LOG.debug("Didn't find any region server that replicates, won't prevent any deletions.");
return ImmutableSet.of(); return ImmutableSet.of();
} }

View File

@ -77,6 +77,9 @@ public class ReplicationZKNodeCleaner {
Set<String> peerIds = new HashSet<>(this.replicationPeers.getAllPeerIds()); Set<String> peerIds = new HashSet<>(this.replicationPeers.getAllPeerIds());
try { try {
List<String> replicators = this.queuesClient.getListOfReplicators(); List<String> replicators = this.queuesClient.getListOfReplicators();
if (replicators == null || replicators.isEmpty()) {
return undeletedQueues;
}
for (String replicator : replicators) { for (String replicator : replicators) {
List<String> queueIds = this.queuesClient.getAllQueues(replicator); List<String> queueIds = this.queuesClient.getAllQueues(replicator);
for (String queueId : queueIds) { for (String queueId : queueIds) {

View File

@ -323,6 +323,9 @@ public class DumpReplicationQueues extends Configured implements Tool {
// Loops each peer on each RS and dumps the queues // Loops each peer on each RS and dumps the queues
try { try {
List<String> regionservers = queuesClient.getListOfReplicators(); List<String> regionservers = queuesClient.getListOfReplicators();
if (regionservers == null || regionservers.isEmpty()) {
return sb.toString();
}
for (String regionserver : regionservers) { for (String regionserver : regionservers) {
List<String> queueIds = queuesClient.getAllQueues(regionserver); List<String> queueIds = queuesClient.getAllQueues(regionserver);
replicationQueues.init(regionserver); replicationQueues.init(regionserver);