HBASE-18111 Replication stuck when cluster connection is closed

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Guanghao Zhang 2017-05-25 09:51:40 +08:00 committed by Andrew Purtell
parent 46ee6e0fcc
commit b66a478e73
1 changed files with 15 additions and 0 deletions

View File

@ -225,6 +225,18 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
return entryLists;
}
private void reconnectToPeerCluster() {
HConnection connection = null;
try {
connection = HConnectionManager.createConnection(this.conf);
} catch (IOException ioe) {
LOG.warn("Failed to create connection for peer cluster", ioe);
}
if (connection != null) {
this.conn = connection;
}
}
/**
* Do the shipping logic
*/
@ -256,6 +268,9 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
}
continue;
}
if (this.conn == null || this.conn.isClosed()) {
reconnectToPeerCluster();
}
try {
int futures = 0;
for (int i=0; i<batches.size(); i++) {