From 62d73230234a524d437b84f3446944fd183cc2cb Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Tue, 16 May 2017 11:46:37 +0800 Subject: [PATCH] HBASE-18053 AsyncTableResultScanner will hang when scan wrong column family --- .../hadoop/hbase/client/AsyncTableResultScanner.java | 1 + .../hbase/client/AbstractTestAsyncTableScan.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableResultScanner.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableResultScanner.java index b6823f90b7e..2f8a9390f66 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableResultScanner.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableResultScanner.java @@ -104,6 +104,7 @@ class AsyncTableResultScanner implements ResultScanner, RawScanResultConsumer { @Override public synchronized void onError(Throwable error) { this.error = error; + notifyAll(); } @Override diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java index d4409caafb1..13e0e7c390a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java @@ -30,6 +30,7 @@ import java.util.stream.IntStream; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; import org.junit.AfterClass; @@ -163,6 +164,16 @@ public abstract class AbstractTestAsyncTableScan { IntStream.range(0, start + 1).forEach(i -> assertResultEquals(results.get(i), start - i)); } + @Test + public void testScanWrongColumnFamily() throws Exception { + try { + doScan(createScan().addFamily(Bytes.toBytes("WrongColumnFamily"))); + } catch (Exception e) { + assertTrue(e instanceof NoSuchColumnFamilyException + || e.getCause() instanceof NoSuchColumnFamilyException); + } + } + private void testScan(int start, boolean startInclusive, int stop, boolean stopInclusive, int limit) throws Exception { Scan scan =