You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/12/05 22:23:48 UTC

[hbase] branch branch-2.4 updated: HBASE-25353 [Flakey Tests] branch-2 TestShutdownBackupMaster

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new bac9764  HBASE-25353 [Flakey Tests] branch-2 TestShutdownBackupMaster
bac9764 is described below

commit bac9764f26ab2c1b739b5bea6c3beea6346c1e0e
Author: stack <st...@apache.org>
AuthorDate: Sat Dec 5 14:21:52 2020 -0800

    HBASE-25353 [Flakey Tests] branch-2 TestShutdownBackupMaster
---
 .../hbase/client/ConnectionImplementation.java       | 20 ++++++++++++++++++--
 .../hbase/exceptions/ConnectionClosedException.java  |  1 +
 hbase-server/pom.xml                                 |  4 ++--
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index e9039c2..990a249 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -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) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ConnectionClosedException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ConnectionClosedException.java
index b479f14..54ad092 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ConnectionClosedException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ConnectionClosedException.java
@@ -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;
 
diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml
index c711c10..bd60e78 100644
--- a/hbase-server/pom.xml
+++ b/hbase-server/pom.xml
@@ -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