Apache9 commented on a change in pull request #667: HBASE-23055 Alter hbase:meta
URL: https://github.com/apache/hbase/pull/667#discussion_r330043419
##########
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:
Is this really a good degisn? In the normal read/write path, sometimes we
need to test whether a table is disabled. After this change, the normal
read/write path will also rely on master, while in the past we only need to
access meta table.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services