Package com.yahoo.ycsb

Examples of com.yahoo.ycsb.DBException


        _columnFamily = getProperties().getProperty("columnfamily");
        if (_columnFamily == null)
        {
            System.err.println("Error, must specify a columnfamily for HBase table");
            throw new DBException("No columnfamily specified");
        }
      _columnFamilyBytes = Bytes.toBytes(_columnFamily);

    }
View Full Code Here


                _hTable.flushCommits();
            }
            long en=System.nanoTime();
            _measurements.measure("UPDATE", (int)((en-st)/1000));
        } catch (IOException e) {
            throw new DBException(e);
        }
    }
View Full Code Here

          if (jdbcFetchSizeStr != null) {
          try {
              this.jdbcFetchSize = Integer.parseInt(jdbcFetchSizeStr);
          } catch (NumberFormatException nfe) {
              System.err.println("Invalid JDBC fetch size specified: " + jdbcFetchSizeStr);
              throw new DBException(nfe);
          }
      }

      String autoCommitStr = props.getProperty(JDBC_AUTO_COMMIT, Boolean.TRUE.toString());
      Boolean autoCommit = Boolean.parseBoolean(autoCommitStr);

      try {
      if (driver != null) {
        Class.forName(driver);
      }
          int shardCount = 0;
          conns = new ArrayList<Connection>(3);
          for (String url: urls.split(",")) {
              System.out.println("Adding shard node URL: " + url);
            Connection conn = DriverManager.getConnection(url, user, passwd);

            // Since there is no explicit commit method in the DB interface, all
            // operations should auto commit, except when explicitly told not to
            // (this is necessary in cases such as for PostgreSQL when running a
            // scan workload with fetchSize)
            conn.setAutoCommit(autoCommit);

            shardCount++;
            conns.add(conn);
          }

          System.out.println("Using " + shardCount + " shards");

      cachedStatements = new ConcurrentHashMap<StatementType, PreparedStatement>();
    } catch (ClassNotFoundException e) {
      System.err.println("Error in initializing the JDBS driver: " + e);
      throw new DBException(e);
    } catch (SQLException e) {
      System.err.println("Error in database operation: " + e);
      throw new DBException(e);
    } catch (NumberFormatException e) {
      System.err.println("Invalid value for fieldcount property. " + e);
      throw new DBException(e);
    }
    initialized = true;
  }
View Full Code Here

  public void cleanup() throws DBException {
    try {
      cleanupAllConnections();
    } catch (SQLException e) {
      System.err.println("Error in closing the connection. " + e);
      throw new DBException(e);
    }
  }
View Full Code Here

    int i = defaultValue;
    if (p != null) {
      try {
        i = Integer.parseInt(p);
      } catch (NumberFormatException e) {
        throw new DBException("Illegal number format in " + key + " property");
      }
    }
    return i;
  }
View Full Code Here

      if (p.equalsIgnoreCase("ABSOLUTE")) {
        config.setConsistency(Consistency.ABSOLUTE);
      } else if (p.equalsIgnoreCase("NONE_REQUIRED")) {
        config.setConsistency(Consistency.NONE_REQUIRED);
      } else {
        throw new DBException("Illegal value in consistency property");
      }
    }
   
    p = properties.getProperty("durability");
    if (p != null) {
      if (p.equalsIgnoreCase("COMMIT_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_NO_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_SYNC")) {
        config.setDurability(Durability.COMMIT_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_WRITE_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
      } else {
        throw new DBException("Illegal value in durability property");
      }
    }
   
    int maxActiveRequests = getPropertyInt(properties,
        "requestLimit.maxActiveRequests", RequestLimitConfig.DEFAULT_MAX_ACTIVE_REQUESTS);
    int requestThresholdPercent = getPropertyInt(properties,
        "requestLimit.requestThresholdPercent", RequestLimitConfig.DEFAULT_REQUEST_THRESHOLD_PERCENT);
    int nodeLimitPercent = getPropertyInt(properties,
        "requestLimit.nodeLimitPercent", RequestLimitConfig.DEFAULT_NODE_LIMIT_PERCENT);
    RequestLimitConfig requestLimitConfig;
    /* It is said that the constructor could throw NodeRequestLimitException in Javadoc, the exception is not provided */
//    try {
      requestLimitConfig = new RequestLimitConfig(maxActiveRequests, requestThresholdPercent, nodeLimitPercent);
//    } catch (NodeRequestLimitException e) {
//      throw new DBException(e);
//    }
    config.setRequestLimit(requestLimitConfig);

    p = properties.getProperty("requestTimeout");
    if (p != null) {
      long timeout = 1;
      try {
        timeout = Long.parseLong(p);
      } catch (NumberFormatException e) {
        throw new DBException("Illegal number format in requestTimeout property");
      }
      try {
        // TODO Support other TimeUnit
        config.setRequestTimeout(timeout, TimeUnit.SECONDS);
      } catch (IllegalArgumentException e) {
        throw new DBException(e);
      }
    }
   
    try {
      store = KVStoreFactory.getStore(config);
    } catch (FaultException e) {
      throw new DBException(e);
    }
  }
View Full Code Here

   public void init() throws DBException {
      try {
         infinispanManager = new DefaultCacheManager("infinispan-config.xml");
      } catch (IOException e) {
         throw new DBException(e);
      }
   }
View Full Code Here

    storeName = getProperties().getProperty("store_name", "usertable");
   
    // Use store name to retrieve client
    storeClient = socketFactory.getStoreClient(storeName);
    if ( storeClient == null )
      throw new DBException("Unable to instantiate store client");
   
  }
View Full Code Here

    try {
      String principal = getProperties().getProperty("accumulo.username");
      AuthenticationToken token = new PasswordToken(getProperties().getProperty("accumulo.password"));
      _connector = _inst.getConnector(principal, token);
    } catch (AccumuloException e) {
      throw new DBException(e);
    } catch (AccumuloSecurityException e) {
      throw new DBException(e);
    }

    _PC_FLAG = getProperties().getProperty("accumulo.PC_FLAG","none");
    if (_PC_FLAG.equals(PC_PRODUCER) || _PC_FLAG.equals(PC_CONSUMER)) {
      System.out.println("*** YCSB Client is "+_PC_FLAG);
View Full Code Here

    try {
      if (_bw != null) {
        _bw.close();
      }
    } catch (MutationsRejectedException e) {
      throw new DBException(e);
    }
    CleanUp.shutdownNow();
  }
View Full Code Here

TOP

Related Classes of com.yahoo.ycsb.DBException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.