Package org.apache.accumulo.core.client

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


  private void test2(String table, boolean doFlush) throws Exception {
    // test sending multiple mutations with multiple constrain violations... all of the non violating mutations
    // should go through
    int numericErrors = 2;
   
    BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
    bw.addMutation(newMut("r1", "cf1", "cq1", "123"));
    bw.addMutation(newMut("r1", "cf1", "cq2", "I'm a bad value"));
    if (doFlush) {
      try {
        bw.flush();
        throw new Exception("Didn't find a bad mutation");
      } catch (MutationsRejectedException mre) {
        // ignored
        try {
          bw.close();
        } catch (MutationsRejectedException ex) {
          // ignored
        }
        bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
        numericErrors = 1;
      }
    }
    bw.addMutation(newMut("r1", "cf1", "cq3", "I'm a naughty value"));
    bw.addMutation(newMut("@bad row@", "cf1", "cq2", "456"));
View Full Code Here


   
    c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1M");
    c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(), "2M");
    c.tableOperations().setProperty(table1, Property.TABLE_FILE_MAX.getKey(), "23");
   
    BatchWriter bw = c.createBatchWriter(table1, new BatchWriterConfig());
   
    Mutation m1 = new Mutation("001");
    m1.put("data", "x", "9");
    m1.put("data", "y", "7");
   
View Full Code Here

   
  }
 
  private void runLatencyTest() throws Exception {
    // should automatically flush after 3 seconds
    BatchWriter bw = getConnector().createBatchWriter("bwlt", new BatchWriterConfig().setMaxLatency(2000, TimeUnit.MILLISECONDS));
    Scanner scanner = getConnector().createScanner("bwlt", Constants.NO_AUTHS);
   
    Mutation m = new Mutation(new Text(String.format("r_%10d", 1)));
    m.put(new Text("cf"), new Text("cq"), new Value("1".getBytes(Constants.UTF8)));
    bw.addMutation(m);
View Full Code Here

   
    bw.close();
  }
 
  private void runFlushTest() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException, Exception {
    BatchWriter bw = getConnector().createBatchWriter("bwft", new BatchWriterConfig());
    Scanner scanner = getConnector().createScanner("bwft", Constants.NO_AUTHS);
    Random r = new Random();
   
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < NUM_TO_FLUSH; j++) {
View Full Code Here

    final String TEST_TABLE_1 = PREFIX + "_mapreduce_table_1";

    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
    c.tableOperations().create(TEST_TABLE_1);
    BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
      bw.addMutation(m);
    }
View Full Code Here

    PasswordToken password = new PasswordToken("");

    MockInstance mockInstance = new MockInstance("testPartialInputSplitDelegationToConfiguration");
    Connector c = mockInstance.getConnector(user, password);
    c.tableOperations().create("testtable");
    BatchWriter bw = c.createBatchWriter("testtable", new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
      bw.addMutation(m);
    }
View Full Code Here

    PasswordToken password = new PasswordToken("");

    MockInstance mockInstance = new MockInstance("testPartialFailedInputSplitDelegationToConfiguration");
    Connector c = mockInstance.getConnector(user, password);
    c.tableOperations().create("testtable");
    BatchWriter bw = c.createBatchWriter("testtable", new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
      bw.addMutation(m);
    }
View Full Code Here

    options.processor(new Processor<Iface>(new Receiver()));
    server = new TThreadPoolServer(options);
    final InetSocketAddress address = new InetSocketAddress(hostname, sock.getLocalPort());
    registerInZooKeeper(AddressUtil.toString(address));
   
    writer = new AtomicReference<BatchWriter>(this.connector.createBatchWriter(table, new BatchWriterConfig().setMaxLatency(5, TimeUnit.SECONDS)));
  }
View Full Code Here

  }
 
  private void resetWriter() {
    BatchWriter writer = null;
    try {
      writer = connector.createBatchWriter(table, new BatchWriterConfig().setMaxLatency(5, TimeUnit.SECONDS));
    } catch (Exception ex) {
      log.warn("Unable to create a batch writer, will retry. Set log level to DEBUG to see stacktrace. cause: " + ex);
      log.debug("batch writer creation failed with exception.", ex);
    } finally {
      /* Trade in the new writer (even if null) for the one we need to close. */
 
View Full Code Here

   
    // ensure there is no data from previous test
    Assert.assertEquals(0, count);
   
    Connector conn = instance.getConnector(credential.getPrincipal(), CredentialHelper.extractToken(credential));
    BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
    for (String line : metadata) {
      String[] parts = line.split(" ");
      String[] columnParts = parts[1].split(":");
      Mutation m = new Mutation(parts[0]);
      m.put(new Text(columnParts[0]), new Text(columnParts[1]), new Value(parts[2].getBytes()));
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.