use of site.ycsb.DBException in project YCSB by brianfrankcooper.
the class RadosClient method init.
public void init() throws DBException {
Properties props = getProperties();
String configfile = props.getProperty(CONFIG_FILE_PROPERTY);
if (configfile == null) {
configfile = CONFIG_FILE_DEFAULT;
}
String id = props.getProperty(ID_PROPERTY);
if (id == null) {
id = ID_DEFAULT;
}
String pool = props.getProperty(POOL_PROPERTY);
if (pool == null) {
pool = POOL_DEFAULT;
}
// try {
// } catch (UnsatisfiedLinkError e) {
// throw new DBException("RADOS library is not loaded.");
// }
rados = new Rados(id);
try {
rados.confReadFile(new File(configfile));
rados.connect();
ioctx = rados.ioCtxCreate(pool);
} catch (RadosException e) {
throw new DBException(e.getMessage() + ": " + e.getReturnValue());
}
isInited = true;
}
use of site.ycsb.DBException in project YCSB by brianfrankcooper.
the class RadosClientTest method setupClass.
@BeforeClass
public static void setupClass() throws DBException {
radosclient = new RadosClient();
Properties p = new Properties();
p.setProperty(POOL_PROPERTY, POOL_TEST);
try {
radosclient.setProperties(p);
radosclient.init();
} catch (DBException | UnsatisfiedLinkError e) {
assumeNoException("Ceph cluster is not running. Skipping tests.", e);
}
}
use of site.ycsb.DBException in project YCSB by brianfrankcooper.
the class KuduYCSBClient method init.
@Override
public void init() throws DBException {
Properties prop = getProperties();
this.tableName = prop.getProperty(TABLENAME_PROPERTY, TABLENAME_PROPERTY_DEFAULT);
this.partitionSchema = prop.getProperty(PARTITION_SCHEMA_OPT, DEFAULT_PARTITION_SCHEMA);
this.zeropadding = Integer.parseInt(prop.getProperty(ZERO_PADDING_PROPERTY, ZERO_PADDING_PROPERTY_DEFAULT));
if (prop.getProperty(INSERT_ORDER_PROPERTY, INSERT_ORDER_PROPERTY_DEFAULT).compareTo("hashed") == 0) {
this.orderedinserts = false;
} else {
this.orderedinserts = true;
}
initClient();
this.session = client.newSession();
if (getProperties().getProperty(SYNC_OPS_OPT) != null && getProperties().getProperty(SYNC_OPS_OPT).equals("false")) {
this.session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_BACKGROUND);
this.session.setMutationBufferSpace(getIntFromProp(getProperties(), BUFFER_NUM_OPS_OPT, BUFFER_NUM_OPS_DEFAULT));
} else {
this.session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_SYNC);
}
try {
this.kuduTable = client.openTable(tableName);
this.schema = kuduTable.getSchema();
} catch (Exception e) {
throw new DBException("Could not open a table because of:", e);
}
}
use of site.ycsb.DBException in project YCSB by brianfrankcooper.
the class AccumuloClient method init.
@Override
public void init() throws DBException {
colFam = new Text(getProperties().getProperty("accumulo.columnFamily"));
colFamBytes = colFam.toString().getBytes(UTF_8);
inst = new ZooKeeperInstance(new ClientConfiguration().withInstance(getProperties().getProperty("accumulo.instanceName")).withZkHosts(getProperties().getProperty("accumulo.zooKeepers")));
try {
String principal = getProperties().getProperty("accumulo.username");
AuthenticationToken token = new PasswordToken(getProperties().getProperty("accumulo.password"));
connector = inst.getConnector(principal, token);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new DBException(e);
}
if (!(getProperties().getProperty("accumulo.pcFlag", "none").equals("none"))) {
System.err.println("Sorry, the ZK based producer/consumer implementation has been removed. " + "Please see YCSB issue #416 for work on adding a general solution to coordinated work.");
}
}
use of site.ycsb.DBException in project YCSB by brianfrankcooper.
the class AerospikeClient method init.
@Override
public void init() throws DBException {
insertPolicy.recordExistsAction = RecordExistsAction.CREATE_ONLY;
updatePolicy.recordExistsAction = RecordExistsAction.REPLACE_ONLY;
Properties props = getProperties();
namespace = props.getProperty("as.namespace", DEFAULT_NAMESPACE);
String host = props.getProperty("as.host", DEFAULT_HOST);
String user = props.getProperty("as.user");
String password = props.getProperty("as.password");
int port = Integer.parseInt(props.getProperty("as.port", DEFAULT_PORT));
int timeout = Integer.parseInt(props.getProperty("as.timeout", DEFAULT_TIMEOUT));
readPolicy.timeout = timeout;
insertPolicy.timeout = timeout;
updatePolicy.timeout = timeout;
deletePolicy.timeout = timeout;
ClientPolicy clientPolicy = new ClientPolicy();
if (user != null && password != null) {
clientPolicy.user = user;
clientPolicy.password = password;
}
try {
client = new com.aerospike.client.AerospikeClient(clientPolicy, host, port);
} catch (AerospikeException e) {
throw new DBException(String.format("Error while creating Aerospike " + "client for %s:%d.", host, port), e);
}
}
Aggregations