コード例 #1
0
 LogEntryIterator(Credentials creds) throws IOException, KeeperException, InterruptedException {
   zookeeperEntries = getLogEntries(creds, RootTable.EXTENT).iterator();
   rootTableEntries =
       getLogEntries(creds, new KeyExtent(new Text(MetadataTable.ID), null, null)).iterator();
   try {
     Scanner scanner =
         HdfsZooInstance.getInstance()
             .getConnector(creds.getPrincipal(), creds.getToken())
             .createScanner(MetadataTable.NAME, Authorizations.EMPTY);
     log.info("Setting range to " + MetadataSchema.TabletsSection.getRange());
     scanner.setRange(MetadataSchema.TabletsSection.getRange());
     scanner.fetchColumnFamily(LogColumnFamily.NAME);
     metadataEntries = scanner.iterator();
   } catch (Exception ex) {
     throw new IOException(ex);
   }
 }
コード例 #2
0
  protected static synchronized Writer getWriter(Credentials credentials) {
    Writer replicationTable = writers.get(credentials);
    if (replicationTable == null) {
      Instance inst = HdfsZooInstance.getInstance();
      Connector conn;
      try {
        conn = inst.getConnector(credentials.getPrincipal(), credentials.getToken());
      } catch (AccumuloException | AccumuloSecurityException e) {
        throw new RuntimeException(e);
      }

      configureMetadataTable(conn, MetadataTable.NAME);

      replicationTable = new Writer(inst, credentials, MetadataTable.ID);
      writers.put(credentials, replicationTable);
    }
    return replicationTable;
  }
コード例 #3
0
 MetaDataTableScanner(
     Instance instance,
     Credentials credentials,
     Range range,
     CurrentState state,
     String tableName) {
   // scan over metadata table, looking for tablets in the wrong state based on the live servers
   // and online tables
   try {
     Connector connector =
         instance.getConnector(credentials.getPrincipal(), credentials.getToken());
     mdScanner = connector.createBatchScanner(tableName, Authorizations.EMPTY, 8);
     configureScanner(mdScanner, state);
     mdScanner.setRanges(Collections.singletonList(range));
     iter = mdScanner.iterator();
   } catch (Exception ex) {
     if (mdScanner != null) mdScanner.close();
     iter = null;
     mdScanner = null;
     throw new RuntimeException(ex);
   }
 }