Skip to content
Snippets Groups Projects
Commit d59ce9bf authored by Govind Kamat's avatar Govind Kamat
Browse files

[hbase] Verify that the table exists during DB binding initialization

and bail out if not found.  If this is not checked here, the workload
will continue running and generating errors until it finishes.
parent dfd79c80
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("Error accessing HBase table: " + table);
}
}
/**
......
......@@ -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
{
HTable ht = new HTable(config, table);
HTableDescriptor dsc = ht.getTableDescriptor();
}
catch (IOException e)
{
throw new DBException("Error accessing HBase table: " + table);
}
}
/**
......
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