Package org.apache.accumulo.core.client.impl

Examples of org.apache.accumulo.core.client.impl.Writer


  private static final Logger log = Logger.getLogger(MetadataTableUtil.class);

  private MetadataTableUtil() {}

  public synchronized static Writer getMetadataTable(Credentials credentials) {
    Writer metadataTable = metadata_tables.get(credentials);
    if (metadataTable == null) {
      metadataTable = new Writer(HdfsZooInstance.getInstance(), credentials, MetadataTable.ID);
      metadata_tables.put(credentials, metadataTable);
    }
    return metadataTable;
  }
View Full Code Here


    }
    return metadataTable;
  }

  private synchronized static Writer getRootTable(Credentials credentials) {
    Writer rootTable = root_tables.get(credentials);
    if (rootTable == null) {
      rootTable = new Writer(HdfsZooInstance.getInstance(), credentials, RootTable.ID);
      root_tables.put(credentials, rootTable);
    }
    return rootTable;
  }
View Full Code Here

  private static void update(Credentials credentials, Mutation m, KeyExtent extent) {
    update(credentials, null, m, extent);
  }

  public static void update(Credentials credentials, ZooLock zooLock, Mutation m, KeyExtent extent) {
    Writer t = extent.isMeta() ? getRootTable(credentials) : getMetadataTable(credentials);
    update(t, credentials, zooLock, m);
  }
View Full Code Here

  public void test() throws Exception {

    getConnector().securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);

    Credentials credentials = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
    Writer w = new Writer(super.getConnector().getInstance(), credentials, MetadataTable.ID);
    KeyExtent extent = new KeyExtent(new Text("5"), null, null);


    Mutation m = new Mutation(extent.getMetadataEntry());
    // unknown columns should cause contraint violation
View Full Code Here

  private MetadataTable() {
   
  }
 
  public synchronized static Writer getMetadataTable(AuthInfo credentials) {
    Writer metadataTable = metadata_tables.get(credentials);
    if (metadataTable == null) {
      metadataTable = new Writer(HdfsZooInstance.getInstance(), credentials, Constants.METADATA_TABLE_ID);
      metadata_tables.put(credentials, metadataTable);
    }
    return metadataTable;
  }
View Full Code Here

  public static void update(AuthInfo credentials, Mutation m) {
    update(credentials, null, m);
  }
 
  public static void update(AuthInfo credentials, ZooLock zooLock, Mutation m) {
    Writer t;
    t = getMetadataTable(credentials);
    if (zooLock != null)
      putLockID(zooLock, m);
    while (true) {
      try {
        t.update(m);
        return;
      } catch (AccumuloException e) {
        log.error(e, e);
      } catch (AccumuloSecurityException e) {
        log.error(e, e);
View Full Code Here

      } else if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)) {
        if (justLoc) {
          System.out.println("Problem at key " + entry.getKey());
          sawProblems = true;
          if (patch) {
            Writer t = MetadataTable.getMetadataTable(new AuthInfo(user, ByteBuffer.wrap(pass), HdfsZooInstance.getInstance().getInstanceID()));
            Key k = entry.getKey();
            Mutation m = new Mutation(k.getRow());
            m.putDelete(k.getColumnFamily(), k.getColumnQualifier());
            try {
              t.update(m);
              System.out.println("Deleted " + k);
            } catch (ConstraintViolationException e) {
              e.printStackTrace();
            }
          }
View Full Code Here

    metadata.setBatchSize(1000 * 1000);
    metadata.setRange(Constants.METADATA_KEYSPACE);
    metadata.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
    int count = 0;
    int missing = 0;
    Writer writer = MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials());
    for (Entry<Key,Value> entry : metadata) {
      count++;
      Key key = entry.getKey();
      String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()));
      Path map = new Path(ServerConstants.getTablesDir() + "/" + table + key.getColumnQualifier().toString());
      if (!fs.exists(map)) {
        missing++;
        log.info("File " + map + " is missing");
        Mutation m = new Mutation(key.getRow());
        m.putDelete(key.getColumnFamily(), key.getColumnQualifier());
        if (args.length > 4) {
          writer.update(m);
          log.info("entry removed from metadata table: " + m);
        }
      }
    }
    log.info(String.format("%d files of %d missing", missing, count));
View Full Code Here

  private MetadataTable() {
   
  }
 
  public synchronized static Writer getMetadataTable(AuthInfo credentials) {
    Writer metadataTable = metadata_tables.get(credentials);
    if (metadataTable == null) {
      metadataTable = new Writer(HdfsZooInstance.getInstance(), credentials, Constants.METADATA_TABLE_ID);
      metadata_tables.put(credentials, metadataTable);
    }
    return metadataTable;
  }
View Full Code Here

  public static void update(AuthInfo credentials, Mutation m) {
    update(credentials, null, m);
  }
 
  public static void update(AuthInfo credentials, ZooLock zooLock, Mutation m) {
    Writer t;
    t = getMetadataTable(credentials);
    if (zooLock != null)
      putLockID(zooLock, m);
    while (true) {
      try {
        t.update(m);
        return;
      } catch (AccumuloException e) {
        log.error(e, e);
      } catch (AccumuloSecurityException e) {
        log.error(e, e);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.impl.Writer

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.