Skip to content

Commit

Permalink
Merge pull request brianfrankcooper#304 from gkamat/issue-278
Browse files Browse the repository at this point in the history
Issue brianfrankcooper#278: [hbase] YCSB does not throw error if there is no table created
  • Loading branch information
busbey committed Jun 24, 2015
2 parents 5214452 + 959ebbd commit 11586a4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hbase/src/main/java/com/yahoo/ycsb/db/HBaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.yahoo.ycsb.measurements.Measurements;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HTable;
//import org.apache.hadoop.hbase.client.Scanner;
import org.apache.hadoop.hbase.client.Get;
Expand Down Expand Up @@ -99,6 +100,19 @@ public void init() throws DBException
}
_columnFamilyBytes = Bytes.toBytes(_columnFamily);

// Terminate right now if table does not exist, since the client
// will not propagate this error upstream once the workload
// starts.
String table = com.yahoo.ycsb.workloads.CoreWorkload.table;
try
{
HTable ht = new HTable(config, table);
HTableDescriptor dsc = ht.getTableDescriptor();
}
catch (IOException e)
{
throw new DBException(e);
}
}

/**
Expand Down
16 changes: 16 additions & 0 deletions hbase/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.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.BufferedMutator;
Expand All @@ -36,6 +37,7 @@
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
Expand Down Expand Up @@ -133,6 +135,20 @@ public void init() throws DBException
throw new DBException("No columnfamily specified");
}
_columnFamilyBytes = Bytes.toBytes(_columnFamily);

// Terminate right now if table does not exist, since the client
// will not propagate this error upstream once the workload
// starts.
String table = com.yahoo.ycsb.workloads.CoreWorkload.table;
try
{
final TableName tableName = TableName.valueOf(table);
HTableDescriptor dsc = _connection.getTable(tableName).getTableDescriptor();
}
catch (IOException e)
{
throw new DBException(e);
}
}

/**
Expand Down

0 comments on commit 11586a4

Please sign in to comment.