Search in sources :

Example 36 with DBException

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;
}
Also used : DBException(site.ycsb.DBException) Rados(com.ceph.rados.Rados) RadosException(com.ceph.rados.exceptions.RadosException) Properties(java.util.Properties) File(java.io.File)

Example 37 with DBException

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);
    }
}
Also used : DBException(site.ycsb.DBException) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Example 38 with DBException

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);
    }
}
Also used : DBException(site.ycsb.DBException) Properties(java.util.Properties) DBException(site.ycsb.DBException) TimeoutException(com.stumbleupon.async.TimeoutException)

Example 39 with DBException

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.");
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) DBException(site.ycsb.DBException) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) AuthenticationToken(org.apache.accumulo.core.client.security.tokens.AuthenticationToken) Text(org.apache.hadoop.io.Text) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ClientConfiguration(org.apache.accumulo.core.client.ClientConfiguration) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance)

Example 40 with DBException

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);
    }
}
Also used : AerospikeException(com.aerospike.client.AerospikeException) DBException(site.ycsb.DBException) ClientPolicy(com.aerospike.client.policy.ClientPolicy) Properties(java.util.Properties)

Aggregations

DBException (site.ycsb.DBException)41 Properties (java.util.Properties)20 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)4 TimeoutException (com.stumbleupon.async.TimeoutException)3 ColumnInfo (com.toshiba.mwcloud.gs.ColumnInfo)2 AerospikeException (com.aerospike.client.AerospikeException)1 ClientPolicy (com.aerospike.client.policy.ClientPolicy)1 MongoClientConfiguration (com.allanbank.mongodb.MongoClientConfiguration)1 MongoDbUri (com.allanbank.mongodb.MongoDbUri)1 ClientConfiguration (com.amazonaws.ClientConfiguration)1 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)1 SSECustomerKey (com.amazonaws.services.s3.model.SSECustomerKey)1 ArangoDB (com.arangodb.ArangoDB)1 ArangoDBException (com.arangodb.ArangoDBException)1 Protocol (com.arangodb.Protocol)1 ConsistencyLevel (com.azure.cosmos.ConsistencyLevel)1 CosmosClientBuilder (com.azure.cosmos.CosmosClientBuilder)1 CosmosException (com.azure.cosmos.CosmosException)1 DirectConnectionConfig (com.azure.cosmos.DirectConnectionConfig)1