Package org.apache.accumulo.core.client

Examples of org.apache.accumulo.core.client.Instance


  private static final Logger log = Logger.getLogger(Utils.class);
 
  public static long reserveTable(String tableId, long tid, boolean writeLock, boolean tableMustExist, TableOperation op) throws Exception {
    if (getLock(tableId, tid, writeLock).tryLock()) {
      if (tableMustExist) {
        Instance instance = HdfsZooInstance.getInstance();
        IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
        if (!zk.exists(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId))
          throw new ThriftTableOperationException(tableId, "", op, TableOperationExceptionType.NOTFOUND, "Table does not exists");
      }
      log.info("table " + tableId + " (" + Long.toHexString(tid) + ") locked for " + (writeLock ? "write" : "read") + " operation: " + op);
View Full Code Here


    getLock(tableId, tid, writeLock).unlock();
    log.info("table " + tableId + " (" + Long.toHexString(tid) + ") unlocked for " + (writeLock ? "write" : "read"));
  }
 
  public static long reserveHdfsDirectory(String directory, long tid) throws KeeperException, InterruptedException {
    Instance instance = HdfsZooInstance.getInstance();

    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/"
        + new String(Base64.encodeBase64(directory.getBytes(Constants.UTF8)), Constants.UTF8);

    IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
View Full Code Here

    } else
      return 50;
  }
 
  public static void unreserveHdfsDirectory(String directory, long tid) throws KeeperException, InterruptedException {
    Instance instance = HdfsZooInstance.getInstance();
    String resvPath = ZooUtil.getRoot(instance) + Constants.ZHDFS_RESERVATIONS + "/"
        + new String(Base64.encodeBase64(directory.getBytes(Constants.UTF8)), Constants.UTF8);
    ZooReservation.release(ZooReaderWriter.getRetryingInstance(), resvPath, String.format("%016x", tid));
  }
View Full Code Here

        break;
    }
   
    long scanTime = System.currentTimeMillis() - t1;
   
    Instance instance = master.getInstance();
    Tables.clearCache(instance);
    if (tabletCount == 0 && !Tables.exists(instance, tableId))
      throw new ThriftTableOperationException(tableId, null, TableOperation.COMPACT, TableOperationExceptionType.NOTFOUND, null);
   
    if (serversToFlush.size() == 0 && Tables.getTableState(instance, tableId) == TableState.OFFLINE)
View Full Code Here

  }
 
  @Override
  public Repo<Master> call(long tid, Master master) throws Exception {
   
    Instance instance = master.getInstance();
   
    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
    Utils.tableNameLock.lock();
    try {
      Utils.checkTableDoesNotExist(instance, newTableName, tableId, TableOperation.RENAME);
View Full Code Here

   */
  public static TabletLocator getTabletLocator(Class<?> implementingClass, Configuration conf) throws TableNotFoundException {
    String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE));
    if ("MockInstance".equals(instanceType))
      return new MockTabletLocator();
    Instance instance = getInstance(implementingClass, conf);
    String tableName = getInputTableName(implementingClass, conf);
    return TabletLocator.getInstance(instance, new Text(Tables.getTableId(instance, tableName)));
  }
View Full Code Here

    Collection<Pair<Text,Text>> fetchColumns = Collections.singleton(new Pair<Text,Text>(new Text("foo"), new Text("bar")));
    boolean isolated = true, localIters = true;
    int maxVersions = 5;
    Level level = Level.WARN;

    Instance inst = new MockInstance(instance);
    Connector connector = inst.getConnector(username, password);
    connector.tableOperations().create(table);

    AccumuloInputFormat.setInputInfo(job, username, password, table, auths);
    AccumuloInputFormat.setMockInstance(job, instance);
    AccumuloInputFormat.setRegex(job, org.apache.accumulo.core.client.mapreduce.InputFormatBase.RegexType.ROW, rowRegex);
View Full Code Here

      System.err.println("Usage: " + FindOfflineTablets.class.getName() + " <instance> <zookeepers>");
      System.exit(1);
    }
    String instance = args[0];
    String keepers = args[1];
    Instance zooInst = new ZooKeeperInstance(instance, keepers);
    MetaDataTableScanner rootScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(),
        Constants.ROOT_TABLET_EXTENT.toMetadataRange());
    MetaDataTableScanner metaScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(), Constants.NON_ROOT_METADATA_KEYSPACE);
    @SuppressWarnings("unchecked")
    Iterator<TabletLocationState> scanner = (Iterator<TabletLocationState>) new IteratorChain(rootScanner, metaScanner);
View Full Code Here

  public void setUp(State state) throws Exception {
    String secTableName, systemUserName, tableUserName;
    Connector sysConn;
   
    Connector conn = state.getConnector();
    Instance instance = state.getInstance();
   
    String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
   
    systemUserName = String.format("system_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
    tableUserName = String.format("table_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
    secTableName = String.format("security_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
   
    byte[] sysUserPass = "sysUser".getBytes();
    conn.securityOperations().createUser(systemUserName, sysUserPass, new Authorizations());
    sysConn = instance.getConnector(systemUserName, sysUserPass);
   
    SecurityHelper.setSystemConnector(state, sysConn);
    SecurityHelper.setSysUserName(state, systemUserName);
    SecurityHelper.setSysUserPass(state, sysUserPass);
   
View Full Code Here

    boolean checksum = Boolean.parseBoolean(args[13]);
   
    if (min < 0 || max < 0 || max <= min) {
      throw new IllegalArgumentException("bad min and max");
    }
    Instance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    Connector conn = instance.getConnector(user, password);
    String localhost = InetAddress.getLocalHost().getHostName();
    String path = ZooUtil.getRoot(instance) + Constants.ZTRACERS;
    Tracer.getInstance().addReceiver(new ZooSpanClient(zooKeepers, path, localhost, "cingest", 1000));
   
    if (!conn.tableOperations().exists(table)) {
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.Instance

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.