This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-3 in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 4076e81ddacf9d48d48946e2dd72f3aeee3c5421 Author: Duo Zhang <[email protected]> AuthorDate: Thu Mar 20 15:07:59 2025 +0800 HBASE-29188 Region replica replication can not handle table drop correctly (#6800) Signed-off-by: Nick Dimiduk <[email protected]> (cherry picked from commit 3823d6ef09c615fdb92d2dce4929293ad70e1ee8) --- .../handler/RegionReplicaFlushHandler.java | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java index 5b3f053d847..e16be79f2ae 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java @@ -91,6 +91,27 @@ public class RegionReplicaFlushHandler extends EventHandler { return numRetries; } + private boolean isTableDisabledOrDropped(IOException error, HRegion region) { + if (error instanceof TableNotFoundException) { + return true; + } + try { + if ( + FutureUtils.get(connection.getAdmin().isTableDisabled(region.getRegionInfo().getTable())) + ) { + return true; + } + } catch (IOException e) { + if (error instanceof TableNotFoundException) { + return true; + } else { + LOG.warn("failed tp check whether table {} is disabled", region.getRegionInfo().getTable(), + e); + } + } + return false; + } + void triggerFlushInPrimaryRegion(final HRegion region) throws IOException { long pause = connection.getConfiguration().getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_HBASE_CLIENT_PAUSE); @@ -114,10 +135,7 @@ public class RegionReplicaFlushHandler extends EventHandler { response = FutureUtils.get(connection.flush(ServerRegionReplicaUtil .getRegionInfoForDefaultReplica(region.getRegionInfo()).getRegionName(), true)); } catch (IOException e) { - if ( - e instanceof TableNotFoundException || FutureUtils - .get(connection.getAdmin().isTableDisabled(region.getRegionInfo().getTable())) - ) { + if (isTableDisabledOrDropped(e, region)) { return; } if (!counter.shouldRetry()) {
