Package org.apache.accumulo.core.client

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


      all.putAll(assigned);
      for (Entry<Key, Value> entry : all.entrySet()) {
        TServerInstance alive = tserverSet.find(entry.getValue().toString());
        if (alive == null) {
          Master.log.info("Removing entry " + entry);
          BatchWriter bw = getConnector().createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
          Mutation m = new Mutation(entry.getKey().getRow());
          m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
          bw.addMutation(m);
          bw.close();
          return;
View Full Code Here


              datafiles.clear();
            }
          }
        }
        MetadataTable.addDeleteEntries(range, datafiles, SecurityConstants.getSystemCredentials());
        BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
        try {
          deleteTablets(deleteRange, bw, conn);
        } finally {
          bw.close();
        }
       
        if (followingTablet != null) {
          log.debug("Updating prevRow of " + followingTablet + " to " + range.getPrevEndRow());
          bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
          try {
            Mutation m = new Mutation(followingTablet.getMetadataEntry());
            Constants.METADATA_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(range.getPrevEndRow()));
            Constants.METADATA_CHOPPED_COLUMN.putDelete(m);
            bw.addMutation(m);
View Full Code Here

      BatchWriter bw = null;
      try {
        long fileCount = 0;
        Connector conn = getConnector();
        // Make file entries in highest tablet
        bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
        Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
        scanner.setRange(scanRange);
        Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
        Constants.METADATA_TIME_COLUMN.fetch(scanner);
        Constants.METADATA_DIRECTORY_COLUMN.fetch(scanner);
View Full Code Here

    }
   
  }
 
  private void insertData(long ts) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
    BatchWriter bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
   
    for (int i = 0; i < 10000; i++) {
      String row = String.format("%09d", i);
     
      Mutation m = new Mutation(new Text(row));
View Full Code Here

    return Collections.singletonList(new TableSetup("de"));
  }
 
  @Override
  public void run() throws Exception {
    BatchWriter bw = getConnector().createBatchWriter("de", new BatchWriterConfig());
    Mutation m = new Mutation(new Text("foo"));
    m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes(Constants.UTF8)));
    bw.addMutation(m);
    bw.flush();
   
View Full Code Here

          m.put(new Text(), new Text(), new ColumnVisibility(s), new Value("value".getBytes(Constants.UTF8)));
        }
        BatchWriter writer = null;
        try {
          try {
            writer = conn.createBatchWriter(tableName, new BatchWriterConfig().setMaxMemory(9000l).setMaxWriteThreads(1));
          } catch (TableNotFoundException tnfe) {
            if (tableExists)
              throw new AccumuloException("Table didn't exist when it should have: " + tableName);
            return;
          }
          boolean works = true;
          try {
            writer.addMutation(m);
            writer.close();
          } catch (MutationsRejectedException mre) {
            // Currently no method for detecting reason for mre. Waiting on ACCUMULO-670
            // For now, just wait a second and go again if they can write!
            if (!canWrite)
              return;
           
            if (ambiguousZone) {
              Thread.sleep(1000);
              try {
                writer = conn.createBatchWriter(tableName, new BatchWriterConfig().setMaxWriteThreads(1));
                writer.addMutation(m);
                writer.close();
                writer = null;
              } catch (MutationsRejectedException mre2) {
                throw new AccumuloException("Mutation exception!", mre2);
View Full Code Here

 
  @Override
  public void run() throws Exception {
    getConnector().tableOperations().create("scftt");
   
    BatchWriter bw = getConnector().createBatchWriter("scftt", new BatchWriterConfig());
   
    // create file in the tablet that has mostly column family 0, with a few entries for column family 1

    bw.addMutation(nm(0, 1, 0));
    for (int i = 1; i < 99999; i++) {
View Full Code Here

    write("bt1", 1, 0, 1000000000, 1000);
    write("bt2", 2, 0, 1000000000, 1000);
    write("bt3", 3, 0, 1000000000, 1000);
   
    // test inserting an empty key
    BatchWriter bw = getConnector().createBatchWriter("bt4", new BatchWriterConfig());
    Mutation m = new Mutation(new Text(""));
    m.put(new Text(""), new Text(""), new Value("foo1".getBytes(Constants.UTF8)));
    bw.addMutation(m);
    bw.close();
    getConnector().tableOperations().flush("bt4", null, null, true);
View Full Code Here

    return t2 - t1;
  }
 
  private void write(String table, int depth, long start, long end, int step) throws Exception {
   
    BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
   
    for (long i = start; i < end; i += step) {
      String key = String.format("k_%010d", i);
     
      Mutation m = null;
View Full Code Here

    int maxWriteThreads = Integer.parseInt(getTestProperty("NUM_THREADS"));
   
    // create batch writer
    BatchWriter bw = null;
    try {
      bw = conn.createBatchWriter(tableName, new BatchWriterConfig().setMaxMemory(maxMemory).setMaxLatency(maxLatency, TimeUnit.MILLISECONDS)
          .setMaxWriteThreads(maxWriteThreads));
    } catch (TableNotFoundException e) {
      System.out.println("Table not found: " + tableName);
      e.printStackTrace();
    }
View Full Code Here

TOP

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

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.