HBASE-18053 AsyncTableResultScanner will hang when scan wrong column family

This commit is contained in:
Guanghao Zhang 2017-05-16 11:46:37 +08:00
parent c1b45a2c45
commit 62d7323023
2 changed files with 12 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class AsyncTableResultScanner implements ResultScanner, RawScanResultConsumer {
@Override
public synchronized void onError(Throwable error) {
this.error = error;
notifyAll();
}
@Override

View File

@ -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 =