Examples of BatchWriterOpts


Examples of org.apache.accumulo.core.cli.BatchWriterOpts

import org.apache.hadoop.io.Text;

public class GCLotsOfCandidatesTest {
  public static void main(String args[]) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
    ClientOpts opts = new ClientOpts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(GCLotsOfCandidatesTest.class.getName(), args, bwOpts);
   
    Connector conn = opts.getConnector();
    conn.securityOperations().grantTablePermission(conn.whoami(), Constants.METADATA_TABLE_NAME, TablePermission.WRITE);
    BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, bwOpts.getBatchWriterConfig());
   
    for (int i = 0; i < 100000; ++i) {
      final Text emptyText = new Text("");
      Text row = new Text(String.format("%s%s%020d%s", Constants.METADATA_DELETE_FLAG_PREFIX, "/", i,
          "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj"));
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

  }
 
  public static void main(String[] args) throws Exception {
    Opts opts = new Opts();
    ScannerOpts scanOpts = new ScannerOpts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(RemoveEntriesForMissingFiles.class.getName(), args, scanOpts, bwOpts);
    FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
    Connector connector = opts.getConnector();
    Scanner metadata = connector.createScanner(Constants.METADATA_TABLE_NAME, opts.auths);
    metadata.setBatchSize(scanOpts.scanBatchSize);
    metadata.setRange(Constants.METADATA_KEYSPACE);
    metadata.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
    int count = 0;
    int missing = 0;
    BatchWriter writer = null;
    if (opts.fix)
      writer = connector.createBatchWriter(Constants.METADATA_TABLE_NAME, bwOpts.getBatchWriterConfig());
    for (Entry<Key,Value> entry : metadata) {
      count++;
      Key key = entry.getKey();
      String table = new String(KeyExtent.tableOfMetadataRow(entry.getKey().getRow()));
      String file = key.getColumnQualifier().toString();
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

    long num = 0;
  }
 
  public static void main(String[] args) {
    Opts opts = new Opts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    ScannerOpts scanOpts = new ScannerOpts();
    opts.parseArgs(TestBinaryRows.class.getName(), args, scanOpts, bwOpts);
   
    try {
      Connector connector = opts.getConnector();
     
      if (opts.mode.equals("ingest") || opts.mode.equals("delete")) {
        BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
        boolean delete = opts.mode.equals("delete");
       
        for (long i = 0; i < opts.num; i++) {
          byte[] row = encodeLong(i + opts.start);
          String value = "" + (i + opts.start);
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

  
   * @param args
   */
  public static void main(String[] args) throws Exception {
    Opts opts = new Opts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(AddFilesWithMissingEntries.class.getName(), args, bwOpts);
   
    final Key rootTableEnd = new Key(Constants.ROOT_TABLET_EXTENT.getEndRow());
    final Range range = new Range(rootTableEnd.followingKey(PartialKey.ROW), true, Constants.METADATA_RESERVED_KEYSPACE_START_KEY, false);
    final Scanner scanner = opts.getConnector().createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
    scanner.setRange(range);
    final Configuration conf = new Configuration();
    final FileSystem fs = FileSystem.get(conf);
   
    KeyExtent last = new KeyExtent();
    String directory = null;
    Set<String> knownFiles = new HashSet<String>();
   
    int count = 0;
    final MultiTableBatchWriter writer = opts.getConnector().createMultiTableBatchWriter(bwOpts.getBatchWriterConfig());
   
    // collect the list of known files and the directory for each extent
    for (Entry<Key,Value> entry : scanner) {
      Key key = entry.getKey();
      KeyExtent ke = new KeyExtent(key.getRow(), (Text) null);
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

  }
 
  public static void main(String[] args) throws Exception {
    String program = CreateTestTable.class.getName();
    Opts opts = new Opts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    ScannerOpts scanOpts = new ScannerOpts();
    opts.parseArgs(program, args, bwOpts, scanOpts);
   
    // create the test table within accumulo
    Connector connector = opts.getConnector();
   
    if (!opts.readOnly) {
      TreeSet<Text> keys = new TreeSet<Text>();
      for (int i = 0; i < opts.count / 100; i++) {
        keys.add(new Text(String.format("%05d", i * 100)));
      }
     
      // presplit
      connector.tableOperations().create(opts.getTableName());
      connector.tableOperations().addSplits(opts.getTableName(), keys);
      BatchWriter b = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
     
      // populate
      for (int i = 0; i < opts.count; i++) {
        Mutation m = new Mutation(new Text(String.format("%05d", i)));
        m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes()));
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

  }

  public static void main(String[] args) throws Exception {
   
    Opts opts = new Opts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(ContinuousIngest.class.getName(), args, bwOpts);
   
    initVisibilities(opts);

    if (opts.min < 0 || opts.max < 0 || opts.max <= opts.min) {
      throw new IllegalArgumentException("bad min and max");
    }
    Connector conn = opts.getConnector();
   
    if (!conn.tableOperations().exists(opts.getTableName()))
      try {
        conn.tableOperations().create(opts.getTableName());
      } catch (TableExistsException tee) {}

    BatchWriter bw = conn.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
    bw = Trace.wrapAll(bw, new CountSampler(1024));
   
    Random r = new Random();
   
    byte[] ingestInstanceId = UUID.randomUUID().toString().getBytes();
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

    scanner.fetchColumn(new Text("dir"), new Text("counts"));
    assertFalse(scanner.iterator().hasNext());
   
    Opts opts = new Opts();
    ScannerOpts scanOpts = new ScannerOpts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.instance = "counttest";
    opts.tableName = "dirlisttable";
    opts.password = new Password("secret");
    opts.mock = true;
    opts.password = new Opts.Password("");
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

   
    Opts(String table) { super(table); }
  }
  public static void main(String[] args) throws Exception {
    Opts opts = new Opts(table_name);
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(RandomWriter.class.getName(), args, bwOpts);
   
    long start = System.currentTimeMillis();
    log.info("starting at " + start + " for user " + opts.principal);
    try {
      Connector connector = opts.getConnector();
      BatchWriter bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
      log.info("Writing " + opts.count + " mutations...");
      bw.addMutations(new RandomMutationGenerator(opts.count));
      bw.close();
    } catch (Exception e) {
      log.error(e);
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

    opts.cols = cols;
    opts.dataSize = width;
    opts.startRow = offset;
    opts.columnFamily = colf;
    opts.createTable = true;
    TestIngest.ingest(connector, opts, new BatchWriterOpts());
  }
View Full Code Here

Examples of org.apache.accumulo.core.cli.BatchWriterOpts

    log.info("Creating " + splits.size() + " splits");
    c.tableOperations().addSplits("unused", splits);
    List<String> tservers = c.instanceOperations().getTabletServers();
    TestIngest.Opts opts = new TestIngest.Opts();
    opts.rows = 200000;
    TestIngest.ingest(c, opts, new BatchWriterOpts());
    c.tableOperations().flush("test_ingest", null, null, false);
    UtilWaitThread.sleep(45 * 1000);
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));

    MasterMonitorInfo stats = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.