Skip to content

Commit

Permalink
[hbase10] Use Admin.tableExists instead of Table.getTableDescriptor t…
Browse files Browse the repository at this point in the history
…o test whether the table exists, as the latter has been removed on master branch (brianfrankcooper#1315)
  • Loading branch information
Apache9 authored and busbey committed Jun 14, 2019
1 parent bcf9ee3 commit 06e47bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hbase10/src/main/java/com/yahoo/ycsb/db/HBaseClient10.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.BufferedMutator;
import org.apache.hadoop.hbase.client.BufferedMutatorParams;
import org.apache.hadoop.hbase.client.Connection;
Expand Down Expand Up @@ -152,7 +153,11 @@ public void init() throws DBException {
// will not propagate this error upstream once the workload
// starts.
final TableName tName = TableName.valueOf(table);
connection.getTable(tName).getTableDescriptor();
try (Admin admin = connection.getAdmin()) {
if (!admin.tableExists(tName)) {
throw new DBException("Table " + tName + " does not exists");
}
}
}
}
} catch (java.io.IOException e) {
Expand Down

0 comments on commit 06e47bf

Please sign in to comment.