liuml07 commented on a change in pull request #2047: URL: https://github.com/apache/hbase/pull/2047#discussion_r456264746
########## File path: hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java ########## @@ -529,4 +529,28 @@ static void loadData(final TableName tableName, final byte[][] families, final i puts.clear(); } } + + @Test + public void testCompactionState() throws IOException, InterruptedException { + TableName tableName = TableName.valueOf("testCompactionState"); + byte[] family = Bytes.toBytes("CF"); + TableDescriptor td = TableDescriptorBuilder.newBuilder(tableName) + .setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).build(); + final Admin admin = TEST_UTIL.getAdmin(); + if (admin.tableExists(tableName)) { + admin.disableTable(tableName); + admin.deleteTable(tableName); + } + admin.createTable(td, new byte[][] { Bytes.toBytes(1) }); + TEST_UTIL.waitTableAvailable(tableName); + TEST_UTIL.waitUntilNoRegionsInTransition(10000); + byte[] regionName = admin.getRegions(tableName).get(0).getRegionName(); + admin.unassign(regionName, true); + TEST_UTIL.waitUntilNoRegionsInTransition(10000); + try { Review comment: ``` try { admin.getCompactionState(tableName); } catch (IOException e) { fail("Exception is not excepted."); } ``` is the same as ``` admin.getCompactionState(tableName); ``` Tests fails in case of exceptions. ########## File path: hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java ########## @@ -3000,7 +3001,12 @@ private void getProcedureResult(long procId, CompletableFuture<Void> future, int // If any region compaction state is MAJOR_AND_MINOR // the table compaction state is MAJOR_AND_MINOR, too. if (err2 != null) { - future.completeExceptionally(unwrapCompletionException(err2)); + // api can throw NSRE when the region is not online(split, splitting, merge, + // merging, etc). Those regions will not be filtered above so it's better to skip + // regions which throw NSRE. + if (!(err2.getCause() instanceof NotServingRegionException)) { Review comment: Not having all the context, but a quick question is: if the workaround is for the interpret in UI, we can parse exception in `table.jsp`? The `compact()` improvement can be separately tracked. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org