Package org.apache.accumulo.core.client

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


  }
 
  @Override
  public Repo<Master> call(long tid, Master environment) throws Exception {
   
    Instance instance = HdfsZooInstance.getInstance();
   
    environment.clearMigrations(tableId);
   
    int refCount = 0;
   
    try {
      // look for other tables that references this tables files
      Connector conn = instance.getConnector(SecurityConstants.getSystemCredentials());
      BatchScanner bs = conn.createBatchScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS, 8);
      try {
        bs.setRanges(Collections.singleton(Constants.NON_ROOT_METADATA_KEYSPACE));
        bs.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
        IteratorSetting cfg = new IteratorSetting(40, "grep", GrepIterator.class);
View Full Code Here


 
  @Test
  public void testMockConnectorReturnsCorrectInstance() throws AccumuloException,
      AccumuloSecurityException{
    String name = "an-interesting-instance-name";
    Instance mockInstance = new MockInstance(name);
    Assert.assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance());
    Assert.assertEquals(name, mockInstance.getConnector("foo","bar").getInstance().getInstanceName());
  }
View Full Code Here

      Scanner scanner;
      split = (RangeInputSplit) inSplit;
      log.debug("Initializing input split: " + split.getRange());
      Configuration conf = InputFormatBase.getConfiguration(attempt);

      Instance instance = split.getInstance();
      if (null == instance) {
        instance = getInstance(conf);
      }

      String user = split.getUsername();
      if (null == user) {
        user = getUsername(conf);
      }

      byte[] password = split.getPassword();
      if (null == password) {
        password = getPassword(conf);
      }

      Authorizations authorizations = split.getAuths();
      if (null == authorizations) {
        authorizations = getAuthorizations(conf);
      }

      String table = split.getTable();
      if (null == table) {
        table = getTablename(conf);
      }
     
      Boolean isOffline = split.isOffline();
      if (null == isOffline) {
        isOffline = isOfflineScan(conf);
      }

      Boolean isIsolated = split.isIsolatedScan();
      if (null == isIsolated) {
        isIsolated = isIsolated(conf);
      }

      Boolean usesLocalIterators = split.usesLocalIterators();
      if (null == usesLocalIterators) {
        usesLocalIterators = usesLocalIterators(conf);
      }

      String rowRegex = split.getRowRegex();
      if (null == rowRegex) {
        rowRegex = conf.get(ROW_REGEX);
      }

      String colfRegex = split.getColfamRegex();
      if (null == colfRegex) {
        colfRegex = conf.get(COLUMN_FAMILY_REGEX);
      }

      String colqRegex = split.getColqualRegex();
      if (null == colqRegex) {
        colqRegex = conf.get(COLUMN_QUALIFIER_REGEX);
      }

      String valueRegex = split.getValueRegex();
      if (null == valueRegex) {
        valueRegex = conf.get(VALUE_REGEX);
      }

      Integer maxVersions = split.getMaxVersions();
      if (null == maxVersions) {
        maxVersions = getMaxVersions(conf);
      }
     
      List<AccumuloIterator> iterators = split.getIterators();
      if (null == iterators) {
        iterators = getIterators(conf);
      }
     
      List<AccumuloIteratorOption> options = split.getOptions();
      if (null == options) {
        options = getIteratorOptions(conf);
      }
     
      Set<Pair<Text,Text>> columns = split.getFetchedColumns();
      if (null == columns) {
        columns = getFetchedColumns(conf);
      }

      try {
        log.debug("Creating connector with user: " + user);
        Connector conn = instance.getConnector(user, password);
        log.debug("Creating scanner for table: " + table);
        log.debug("Authorizations are: " + authorizations);
        if (isOffline) {
          scanner = new OfflineScanner(instance, new AuthInfo(user, ByteBuffer.wrap(password), instance.getInstanceID()), Tables.getTableId(instance, table),
              authorizations);
        } else {
          scanner = conn.createScanner(table, authorizations);
        }
        if (isIsolated) {
View Full Code Here

 
  @Override
  public void setUp(State state) throws Exception {
   
    Connector conn = state.getConnector();
    Instance instance = state.getInstance();
   
    SortedSet<Text> splits = new TreeSet<Text>();
    for (int i = 1; i < 256; i++) {
      splits.add(new Text(String.format("%04x", i << 8)));
    }
View Full Code Here

 
  @Override
  public void setUp(State state) throws Exception {
   
    Connector conn = state.getConnector();
    Instance instance = state.getInstance();
   
    String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
   
    seqTableName = String.format("sequential_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
    state.set("seqTableName", seqTableName);
View Full Code Here

    long min = Long.parseLong(args[5]);
    long max = Long.parseLong(args[6]);
   
    long sleepTime = Long.parseLong(args[7]);
   
    Instance instance = new ZooKeeperInstance(instanceName, zooKeepers);
   
    String localhost = InetAddress.getLocalHost().getHostName();
    String path = ZooUtil.getRoot(instance) + Constants.ZTRACERS;
    Tracer.getInstance().addReceiver(new ZooSpanClient(zooKeepers, path, localhost, "cwalk", 1000));
    Accumulo.enableTracing(localhost, "ContinuousWalk");
    Connector conn = instance.getConnector(user, password.getBytes());
   
    Random r = new Random();
    RandomAuths randomAuths = new RandomAuths(authsFile);
   
    ArrayList<Value> values = new ArrayList<Value>();
View Full Code Here

    deletes = new String[] {"~blip/1636/b-0001", "~del/1636/b-0001/I0000"};
    test1(metadata, deletes, 1, 0);
  }
 
  private void test1(String[] metadata, String[] deletes, int expectedInitial, int expected) throws Exception {
    Instance instance = new MockInstance();
    FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
    AccumuloConfiguration aconf = DefaultConfiguration.getInstance();
   
    load(instance, metadata, deletes);
View Full Code Here

   
    int numToScan = Integer.parseInt(args[8]);
   
    RandomAuths randomAuths = new RandomAuths(authsFile);

    Instance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    Connector conn = instance.getConnector(user, password.getBytes());
    Authorizations auths = randomAuths.getAuths(r);
    Scanner scanner = ContinuousUtil.createScanner(conn, table, auths);
   
    double delta = Math.min(.05, .05 / (numToScan / 1000.0));
    // System.out.println("Delta "+delta);
View Full Code Here

  @Override
  public long isReady(long tid, Master master) throws Exception {
    if (!Utils.getReadLock(tableId, tid).tryLock())
      return 100;
   
    Instance instance = HdfsZooInstance.getInstance();
    Tables.clearCache(instance);
    if (Tables.getTableState(instance, tableId) == TableState.ONLINE) {
      long reserve1, reserve2;
      reserve1 = reserve2 = Utils.reserveHdfsDirectory(sourceDir, tid);
      if (reserve1 == 0)
View Full Code Here

      rdr.sync(path);
      return rdr.exists(path);
    }
   
    public static void start(String type, long tid) throws KeeperException, InterruptedException {
      Instance instance = HdfsZooInstance.getInstance();
      IZooReaderWriter writer = ZooReaderWriter.getInstance();
      writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type, new byte[] {}, NodeExistsPolicy.OVERWRITE);
      writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, new byte[] {}, NodeExistsPolicy.OVERWRITE);
      writer.putPersistentData(ZooUtil.getRoot(instance) + "/" + type + "/" + tid + "-running", new byte[] {}, NodeExistsPolicy.OVERWRITE);
    }
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.