HBASE-27105 HBaseInterClusterReplicationEndpoint should honor replication adaptive timeout (#4515)

Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
This commit is contained in:
Pankaj 2022-06-23 12:51:48 +05:30 committed by GitHub
parent 9bae50f83c
commit 342183e596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -42,11 +42,13 @@ import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.AsyncRegionServerAdmin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.ipc.CallTimeoutException;
import org.apache.hadoop.hbase.ipc.RpcServer;
import org.apache.hadoop.hbase.protobuf.ReplicationProtobufUtil;
import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
import org.apache.hadoop.hbase.regionserver.wal.WALUtil;
import org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint;
import org.apache.hadoop.hbase.replication.ReplicationUtils;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@ -425,6 +427,7 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
@Override
public boolean replicate(ReplicateContext replicateContext) {
int sleepMultiplier = 1;
int initialTimeout = replicateContext.getTimeout();
if (!peersSelected && this.isRunning()) {
connectToPeers();
@ -492,6 +495,9 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi
} else if (ioe instanceof ConnectException || ioe instanceof UnknownHostException) {
LOG.warn("{} Peer is unavailable, rechecking all sinks: ", logPeerId(), ioe);
chooseSinks();
} else if (ioe instanceof CallTimeoutException) {
replicateContext
.setTimeout(ReplicationUtils.getAdaptiveTimeout(initialTimeout, sleepMultiplier));
} else {
LOG.warn("{} Can't replicate because of a local or network error: ", logPeerId(), ioe);
}