Examples of IteratorSetting


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

    int count = 0;
    Scanner scanner;
   
    ScanTask(Connector conn, long time) throws Exception {
      scanner = conn.createScanner("cct", Constants.NO_AUTHS);
      IteratorSetting slow = new IteratorSetting(30, "slow", SlowIterator.class);
      slow.addOption("sleepTime", "" + time);
      scanner.addScanIterator(slow);
    }
View Full Code Here

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

   
    // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
    // logger.setLevel(Level.TRACE);
   
    getConnector().tableOperations().create("tt");
    IteratorSetting is = new IteratorSetting(5, "Bad Aggregator", BadCombiner.class);
    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("acf")));
    getConnector().tableOperations().attachIterator("tt", is);
   
    BatchWriter bw = getConnector().createBatchWriter("tt", new BatchWriterConfig());
   
    Mutation m = new Mutation(new Text("r1"));
    m.put(new Text("acf"), new Text("foo"), new Value(new byte[] {'1'}));
   
    bw.addMutation(m);
   
    bw.close();
   
    // try to scan table
    Scanner scanner = getConnector().createScanner("tt", Constants.NO_AUTHS);
   
    boolean caught = false;
    try {
      for (Entry<Key,Value> entry : scanner) {
        entry.getKey();
      }
    } catch (Exception e) {
      caught = true;
    }
   
    if (!caught)
      throw new Exception("Scan did not fail");
   
    // try to batch scan the table
    BatchScanner bs = getConnector().createBatchScanner("tt", Constants.NO_AUTHS, 2);
    bs.setRanges(Collections.singleton(new Range()));
   
    caught = false;
    try {
      for (Entry<Key,Value> entry : bs) {
        entry.getKey();
      }
    } catch (Exception e) {
      caught = true;
    }
    if (!caught)
      throw new Exception("batch scan did not fail");
   
    // remove the bad agg so accumulo can shutdown
    TableOperations to = getConnector().tableOperations();
    for (Entry<String,String> e : to.getProperties("tt")) {
      to.removeProperty("tt", e.getKey());
    }
   
    UtilWaitThread.sleep(500);
   
    // should be able to scan now
    scanner = getConnector().createScanner("tt", Constants.NO_AUTHS);
    for (Entry<Key,Value> entry : scanner) {
      entry.getKey();
    }
   
    // set a non existant iterator, should cause scan to fail on server side
    scanner.addScanIterator(new IteratorSetting(100, "bogus", "com.bogus.iterator"));
   
    caught = false;
    try {
      for (Entry<Key,Value> entry : scanner) {
        // should error
View Full Code Here

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

    }

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", new PasswordToken(secret));
    final Scanner s = connector.createScanner(table, Constants.NO_AUTHS);
    IteratorSetting cfg = new IteratorSetting(30, SlowIterator.class);
    cfg.addOption("sleepTime", "500");
    s.addScanIterator(cfg);

    Thread thread = new Thread() {
      public void run() {
        try {
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    ByteBuffer badLogin = client.login("user", properties);
    client.dropLocalUser(creds, "user");
    String table = "test1";
    client.createTable(creds, table, false, TimeType.MILLIS);
   
    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
   
    try {
      client.addConstraint(badLogin, table, NumericValueConstraint.class.getName());
      fail("exception not thrown");
    } catch (AccumuloSecurityException ex) {}
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    } catch (TableNotFoundException ex) {}
    try {
      client.addSplits(creds, doesNotExist, Collections.<ByteBuffer> emptySet());
      fail("exception not thrown");
    } catch (TableNotFoundException ex) {}
    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
    try {
      client.attachIterator(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
      fail("exception not thrown");
    } catch (TableNotFoundException ex) {}
    try {
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    // Should take 5 seconds to read every record
    for (int i = 0; i < 20; i++) {
      client.updateAndFlush(creds, "slow", mutation("row" + i, "cf", "cq", "value"));
    }

    IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "250"));
    client.attachIterator(creds, "slow", setting, EnumSet.allOf(IteratorScope.class));
   
    // scan
    Thread t = new Thread() {
      @Override
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    client.deleteTable(creds, TABLE_TEST);
    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
    HashMap<String,String> options = new HashMap<String,String>();
    options.put("type", "STRING");
    options.put("columns", "cf");
    IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
    client.attachIterator(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
    for (int i = 0; i < 10; i++) {
      client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "1"));
    }
    scanner = client.createScanner(creds, TABLE_TEST, null);
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    String regex = ".*[02468]";
   
    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
    RegExFilter.setRegexs(is, regex, null, null, null, false);
   
    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
    ScanOptions opts = new ScanOptions();
    opts.iterators = Collections.singletonList(pis);
    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
   
    int i = 0;
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    String regex = ".*[02468]";
   
    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
    RegExFilter.setRegexs(is, regex, null, null, null, false);
   
    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
    ScanOptions opts = new ScanOptions();
    opts.iterators = Collections.singletonList(pis);
    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
   
    int i = 0;
View Full Code Here

Examples of org.apache.accumulo.proxy.thrift.IteratorSetting

    String regex = ".*[02468]";
   
    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
    RegExFilter.setRegexs(is, regex, null, null, null, false);
   
    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
    ScanOptions opts = new ScanOptions();
    opts.iterators = Collections.singletonList(pis);
    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
   
    int i = 0;
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.