Skip to content
Snippets Groups Projects
Commit 45631e8b authored by Sean Busbey's avatar Sean Busbey
Browse files

Merge pull request #304 from gkamat/issue-278

Issue #278: [hbase] YCSB does not throw error if there is no table created
parents 9bc02d23 1c3db418
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import java.util.*;
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;
......@@ -99,6 +100,19 @@ public class HBaseClient extends com.yahoo.ycsb.DB
}
_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);
}
}
/**
......
......@@ -27,6 +27,7 @@ import org.apache.hadoop.conf.Configuration;
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;
......@@ -36,6 +37,7 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
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;
......@@ -133,6 +135,20 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
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);
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment