From 3c70bc1f312bd2a833d408c3af82731e5fee66ea Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Thu, 22 Jul 2021 10:16:03 +0200 Subject: [PATCH] HBASE-26107 MOB compaction with missing files catches incorrect exception (#3511) Signed-off-by: Duo Zhang Signed-off-by: Pankaj Kumar --- .../hadoop/hbase/mob/DefaultMobStoreCompactor.java | 8 +++++--- .../hadoop/hbase/mob/FaultyMobStoreCompactor.java | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java index 0531b138d74..c45fdff7ca1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java @@ -35,6 +35,7 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.TableName; @@ -371,12 +372,13 @@ public class DefaultMobStoreCompactor extends DefaultCompactor { // Added to support migration try { mobCell = mobStore.resolve(c, true, false).getCell(); - } catch (FileNotFoundException fnfe) { - if (discardMobMiss) { + } catch (DoNotRetryIOException e) { + if (discardMobMiss && e.getCause() != null + && e.getCause() instanceof FileNotFoundException) { LOG.error("Missing MOB cell: file={} not found cell={}", fName, c); continue; } else { - throw fnfe; + throw e; } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java index a5f806952d7..50530dad69e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java @@ -32,6 +32,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.TableName; @@ -192,12 +193,13 @@ public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor { // Added to support migration try { mobCell = mobStore.resolve(c, true, false).getCell(); - } catch (FileNotFoundException fnfe) { - if (discardMobMiss) { - LOG.error("Missing MOB cell: file={} not found", fName); + } catch (DoNotRetryIOException e) { + if (discardMobMiss && e.getCause() != null + && e.getCause() instanceof FileNotFoundException) { + LOG.error("Missing MOB cell: file={} not found cell={}", fName, c); continue; } else { - throw fnfe; + throw e; } }