HBASE-25353 [Flakey Tests] branch-2 TestShutdownBackupMaster

This commit is contained in:
stack 2020-12-05 14:21:52 -08:00
parent b1a5567740
commit bac9764f26
3 changed files with 21 additions and 4 deletions

View File

@ -68,6 +68,7 @@ import org.apache.hadoop.hbase.client.Scan.ReadType;
import org.apache.hadoop.hbase.client.backoff.ClientBackoffPolicy;
import org.apache.hadoop.hbase.client.backoff.ClientBackoffPolicyFactory;
import org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil;
import org.apache.hadoop.hbase.exceptions.ConnectionClosedException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
import org.apache.hadoop.hbase.ipc.RpcClient;
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
@ -625,9 +626,20 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
return this.conf;
}
private void checkClosed() throws DoNotRetryIOException {
private void checkClosed() throws LocalConnectionClosedException {
if (this.closed) {
throw new DoNotRetryIOException(toString() + " closed");
throw new LocalConnectionClosedException(toString() + " closed");
}
}
/**
* Like {@link ConnectionClosedException} but thrown from the checkClosed call which looks
* at the local this.closed flag. We use this rather than {@link ConnectionClosedException}
* because the latter does not inherit from DoNotRetryIOE (it should. TODO).
*/
private static class LocalConnectionClosedException extends DoNotRetryIOException {
LocalConnectionClosedException(String message) {
super(message);
}
}
@ -996,6 +1008,10 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
// exist. rethrow the error immediately. this should always be coming
// from the HTable constructor.
throw e;
} catch (LocalConnectionClosedException cce) {
// LocalConnectionClosedException is specialized instance of DoNotRetryIOE.
// Thrown when we check if this connection is closed. If it is, don't retry.
throw cce;
} catch (IOException e) {
ExceptionUtil.rethrowIfInterrupt(e);
if (e instanceof RemoteException) {

View File

@ -26,6 +26,7 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Public
public class ConnectionClosedException extends HBaseIOException {
// TODO: Deprecate? Should inherit from DoNotRetryIOE but it does not.
private static final long serialVersionUID = -8938225073412971497L;

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--
/**
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information