saintstack commented on a change in pull request #667: HBASE-23055 Alter hbase:meta URL: https://github.com/apache/hbase/pull/667#discussion_r330134366
########## File path: hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java ########## @@ -666,42 +669,25 @@ public void run(PRESP resp) { @Override public CompletableFuture<Boolean> isTableEnabled(TableName tableName) { - if (TableName.isMetaTableName(tableName)) { - return CompletableFuture.completedFuture(true); - } - CompletableFuture<Boolean> future = new CompletableFuture<>(); - addListener(AsyncMetaTableAccessor.getTableState(metaTable, tableName), (state, error) -> { - if (error != null) { - future.completeExceptionally(error); - return; - } - if (state.isPresent()) { - future.complete(state.get().inStates(TableState.State.ENABLED)); - } else { - future.completeExceptionally(new TableNotFoundException(tableName)); - } - }); - return future; + return isTableState(tableName, TableState.State.ENABLED); } @Override public CompletableFuture<Boolean> isTableDisabled(TableName tableName) { - if (TableName.isMetaTableName(tableName)) { - return CompletableFuture.completedFuture(false); - } - CompletableFuture<Boolean> future = new CompletableFuture<>(); - addListener(AsyncMetaTableAccessor.getTableState(metaTable, tableName), (state, error) -> { - if (error != null) { - future.completeExceptionally(error); - return; - } - if (state.isPresent()) { - future.complete(state.get().inStates(TableState.State.DISABLED)); - } else { - future.completeExceptionally(new TableNotFoundException(tableName)); - } - }); - return future; + return isTableState(tableName, TableState.State.DISABLED); + } + + /** + * @return Future that calls Master getTableState and compares to <code>state</code> + */ + private CompletableFuture<Boolean> isTableState(TableName tableName, TableState.State state) { + return this.<Boolean> newMasterCaller(). Review comment: Let me file subtask to look at the incidence of state lookups. I was thinking admin enable/disable are infrequent and ok if they fail because master is offline. Let me look at how often inline read/write does table state. Thanks. ---------------------------------------------------------------- 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 With regards, Apache Git Services