} else if (tables) { setting = shellState.getAccumuloClient().tableOperations() .getIteratorSetting(OptUtil.getTableOpt(cl, shellState), name, scope); } else { throw new IllegalArgumentException("No table or namespace specified");
/** * FInds the priority associated with versioning iterator. Assumes the name is "vers". * * @param tops * @param scope * The scope of the iterator. * @return The priority of the versioning iterator, or 20 if not found. * @throws AccumuloSecurityException * @throws AccumuloException * @throws TableNotFoundException */ private int getVersionIteratorPriority(final TableOperations tops, final IteratorScope scope) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { final IteratorSetting versioningIterator = tops.getIteratorSetting(tableName, "vers", scope); return ((null == versioningIterator) ? DEFAULT_VERSIONING_ITERATOR_PRIORITY : versioningIterator.getPriority()); }
public IteratorSetting getIteratorSetting(String tableName, String name, IteratorUtil.IteratorScope scope) throws D4mException { TableOperations tops = this.connector.tableOperations(); try { return tops.getIteratorSetting(tableName, name, scope); } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) { log.warn("",e); //e.printStackTrace(); throw new D4mException(e); } }
EnumSet<IteratorUtil.IteratorScope> enumSet = EnumSet.noneOf(IteratorUtil.IteratorScope.class); for (IteratorUtil.IteratorScope scope : scopesToConsider) { existing = tops.getIteratorSetting(table, itset.getName(), scope); if (existing == null) enumSet.add(scope);
@Override public void configureTable(String table, TableOperations tops, Configuration conf) throws Exception { IteratorSetting is = tops.getIteratorSetting(table, ITER_NAME, IteratorUtil.IteratorScope.scan); String metricName = metric.toString(); if (is == null) { // create a fresh iterator Map<String,String> options = new TreeMap<>(); options.put("type", "STRING"); options.put("columns", metricName); is = new IteratorSetting(ITER_PRIORITY, ITER_NAME, SummingCombiner.class, options); tops.attachIterator(table, is); } else { // if iterator exists, piggyback on it String columns = is.getOptions().get("columns"); if (!columns.contains(metricName)) { for (IteratorUtil.IteratorScope scope : IteratorUtil.IteratorScope.values()) { String config = String.format("table.iterator.%s.%s.opt.columns", scope, ITER_NAME); tops.setProperty(table, config, columns.concat("," + metricName)); } } } }
} else if (tables) { setting = shellState.getConnector().tableOperations() .getIteratorSetting(OptUtil.getTableOpt(cl, shellState), name, scope); } else { throw new IllegalArgumentException("No table or namespace specified");
/** Put a SummingIterator on all columns. */ public static void assignDegreeAccumulator(String tableName, Connector c) { IteratorSetting cfg = null; try { cfg = c.tableOperations().getIteratorSetting(tableName, ITER_SUMALL_NAME, IteratorUtil.IteratorScope.scan); } catch (AccumuloSecurityException | AccumuloException ignored) { } catch (TableNotFoundException e) { log.warn(tableName + " does not exist", e); } if (cfg != null) { log.info("table "+tableName+": iterator "+ITER_SUMALL_NAME+" already exists with priority "+cfg.getPriority()+" and options: "+cfg.getOptions()); } else { cfg = new IteratorSetting(2, ITER_SUMALL_NAME, SummingCombiner.class); //Combiner.setColumns(cfg, columnList); Combiner.setCombineAllColumns(cfg, true); LongCombiner.setEncodingType(cfg, LongCombiner.Type.STRING); try { //c.tableOperations().checkIteratorConflicts(tableName, cfg, EnumSet.allOf(IteratorUtil.IteratorScope.class)); c.tableOperations().attachIterator(tableName, cfg); } catch (AccumuloSecurityException | AccumuloException e) { log.warn("error trying to add "+ITER_SUMALL_NAME+" iterator to " + tableName, e); } catch (TableNotFoundException e) { log.warn(tableName + " does not exist", e); } } }
.containsAll(EnumSet.allOf(IteratorScope.class))); for (IteratorScope scope : EnumSet.allOf(IteratorScope.class)) { IteratorSetting is = tops.getIteratorSetting(ReplicationTable.NAME, ReplicationTable.COMBINER_NAME, scope); Assert.assertEquals(30, is.getPriority());
while (it.hasNext()) { final IteratorUtil.IteratorScope scope = it.next(); final IteratorSetting setting = tops.getIteratorSetting(tableName, iteratorConfig.getIteratorName(), scope); if (setting != null) { final Map<String,String> existingOptions = setting.getOptions();
IteratorSetting existingSetting = connector.tableOperations().getIteratorSetting(tableName, ageoffConfig.getName(), IteratorUtil.IteratorScope.scan); if (existingSetting == null || !existingSetting.equals(ageoffConfig)) {
@Override public org.apache.accumulo.proxy.thrift.IteratorSetting getIteratorSetting(ByteBuffer login, String tableName, String iteratorName, org.apache.accumulo.proxy.thrift.IteratorScope scope) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException { try { IteratorSetting is = getConnector(login).tableOperations().getIteratorSetting(tableName, iteratorName, getIteratorScope(scope)); return new org.apache.accumulo.proxy.thrift.IteratorSetting(is.getPriority(), is.getName(), is.getIteratorClass(), is.getOptions()); } catch (Exception e) { handleExceptionTNF(e); return null; } }
final IteratorSetting versioningIterSetting; try { aggItrSetting = store.getConnection().tableOperations().getIteratorSetting(tableName, AccumuloStoreConstants.AGGREGATOR_ITERATOR_NAME, iteratorScope); if (null != aggItrSetting) { aggItrSetting.removeOption(AccumuloStoreConstants.SCHEMA); aggItrSetting.removeOption(COLUMN_FAMILIES_OPTION); validatorItrSetting = store.getConnection().tableOperations().getIteratorSetting(tableName, AccumuloStoreConstants.VALIDATOR_ITERATOR_NAME, iteratorScope); if (null != validatorItrSetting) { validatorItrSetting.removeOption(AccumuloStoreConstants.SCHEMA); validatorItrSetting.removeOption(COLUMN_FAMILIES_OPTION); versioningIterSetting = store.getConnection().tableOperations().getIteratorSetting(tableName, "vers", iteratorScope); } catch (final AccumuloSecurityException | AccumuloException | TableNotFoundException e) { throw new StoreException("Unable to find iterators on the table " + tableName, e);
@Test public void shouldDisableMetricsWhenConfigFails() throws Exception { String table = MetricsConfiguration.getTable(conf); // Using mocks to force error during tops.getIteratorSetting() TableOperations tops = EasyMock.createMock(TableOperations.class); EasyMock.expect(tops.getIteratorSetting(EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyObject(IteratorScope.class))).andThrow( new AccumuloException("")); EasyMock.replay(tops); // run test configHelper.configure(tops); assertFalse(MetricsConfiguration.isEnabled(conf)); }
IteratorSetting newIter = tops.getIteratorSetting(table, "sum", IteratorScope.scan);
@Test public void shouldConfigureAggregators() throws Exception { String table = MetricsConfiguration.getTable(conf); configHelper.configure(tops); IteratorSetting is = tops.getIteratorSetting(table, "sum", IteratorScope.scan); assertEquals(SummingCombiner.class.getName(), is.getIteratorClass()); assertEquals(TestKeyValueCountMetricsReceiver.ITER_PRIORITY, is.getPriority()); Map<String,String> options = is.getOptions(); String type = options.get("type"); String columns = options.get("columns"); assertEquals(Metric.KV_PER_TABLE.toString(), columns); assertEquals("STRING", type); }
break; case 14: ops.getIteratorSetting(tableName, "a", IteratorScope.scan); fail(); break;