Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public class ReplicationSourceManager implements ReplicationListener {

private AtomicLong totalBufferUsed = new AtomicLong();

private int peerChangeMaxRetries;

/**
* Creates a replication manager and sets the watch on all the other registered region servers
* @param replicationQueues the interface for manipulating replication queues
Expand Down Expand Up @@ -172,6 +174,8 @@ public ReplicationSourceManager(ReplicationQueues replicationQueues,
this.latestPaths = new HashSet<Path>();
replicationForBulkLoadDataEnabled = conf.getBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY,
HConstants.REPLICATION_BULKLOAD_ENABLE_DEFAULT);
this.peerChangeMaxRetries =
conf.getInt("replication.peer.change.max.try", 3);
}

/**
Expand Down Expand Up @@ -623,7 +627,17 @@ public void peerListChanged(List<String> peerIds) {
try {
boolean added = this.replicationPeers.peerConnected(id);
if (added) {
addSource(id);
int num_retries = 0;
while (num_retries < peerChangeMaxRetries) {
try {
addSource(id);
break;
} catch (IOException e) {
if (++num_retries == peerChangeMaxRetries) {
throw e;
}
}
}
if (replicationForBulkLoadDataEnabled) {
this.replicationQueues.addPeerToHFileRefs(id);
}
Expand Down