public void setIterator(String table, IteratorSetting setting) { try { // Remove any existing iterator settings of the same name, if applicable Map<String, EnumSet<IteratorScope>> iterators = connector.tableOperations().listIterators(table); if (iterators.containsKey(setting.getName())) { connector.tableOperations().removeIterator(table, setting.getName(), iterators.get(setting.getName())); } connector.tableOperations().attachIterator(table, setting); } catch (AccumuloSecurityException | AccumuloException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to set iterator on table " + table, e); } catch (TableNotFoundException e) { throw new PrestoException(ACCUMULO_TABLE_DNE, "Failed to set iterator, table does not exist", e); } }
.listIterators(OptUtil.getTableOpt(cl, shellState)).containsKey(name)) { Shell.log.warn("no iterators found that match your criteria"); return 0;
} else if (tables) { iterators = shellState.getAccumuloClient().tableOperations() .listIterators(OptUtil.getTableOpt(cl, shellState)); } else { throw new IllegalArgumentException("No table or namespace specified");
Map<String,EnumSet<IteratorScope>> iterators = null; try { iterators = tops.listIterators(tableName); } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) { throw new RuntimeException(e);
public Map<String,EnumSet<IteratorUtil.IteratorScope>> listIterators(String tableName) throws D4mException { TableOperations tops = this.connector.tableOperations(); try { return tops.listIterators(tableName); } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) { log.warn("",e); throw new D4mException(e); } }
private void removeAgeOffIterators(Connector con, String tableName) throws Exception { Map<String, EnumSet<IteratorScope>> iters = con.tableOperations().listIterators(tableName); for (String name : iters.keySet()) { if (name.startsWith("ageoff")) { con.tableOperations().removeIterator(tableName, name, AGEOFF_SCOPES); } } }
@Override public Map<String,Set<org.apache.accumulo.proxy.thrift.IteratorScope>> listIterators( ByteBuffer login, String tableName) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException { try { Map<String,EnumSet<IteratorScope>> iterMap = getConnector(login).tableOperations() .listIterators(tableName); Map<String,Set<org.apache.accumulo.proxy.thrift.IteratorScope>> result = new HashMap<>(); for (Map.Entry<String,EnumSet<IteratorScope>> entry : iterMap.entrySet()) { result.put(entry.getKey(), getProxyIteratorScopes(entry.getValue())); } return result; } catch (Exception e) { handleExceptionTNF(e); return null; } }
protected static void ensureRowDeletingIteratorIsAttached(Connector connector, String tableName) { try { synchronized (addIteratorLock) { IteratorSetting is = new IteratorSetting(ROW_DELETING_ITERATOR_PRIORITY, ROW_DELETING_ITERATOR_NAME, RowDeletingIterator.class); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { try { connector.tableOperations().attachIterator(tableName, is); } catch (Exception ex) { // If many processes are starting up at the same time (see YARN). It's possible that there will be a collision. final int SLEEP_TIME = 5000; LOGGER.warn("Failed to attach RowDeletingIterator. Retrying in " + SLEEP_TIME + "ms."); Thread.sleep(SLEEP_TIME); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { connector.tableOperations().attachIterator(tableName, is); } } } } } catch (Exception e) { throw new VertexiumException("Could not attach RowDeletingIterator", e); } }
@Test public void testCombinerSetOnMetadata() throws Exception { TableOperations tops = getConnector().tableOperations(); Map<String,EnumSet<IteratorScope>> iterators = tops.listIterators(MetadataTable.NAME); Assert.assertTrue(iterators.containsKey(ReplicationTableUtil.COMBINER_NAME)); EnumSet<IteratorScope> scopes = iterators.get(ReplicationTableUtil.COMBINER_NAME); Assert.assertEquals(3, scopes.size()); Assert.assertTrue(scopes.contains(IteratorScope.scan)); Assert.assertTrue(scopes.contains(IteratorScope.minc)); Assert.assertTrue(scopes.contains(IteratorScope.majc)); Iterable<Entry<String,String>> propIter = tops.getProperties(MetadataTable.NAME); HashMap<String,String> properties = new HashMap<>(); for (Entry<String,String> entry : propIter) { properties.put(entry.getKey(), entry.getValue()); } for (IteratorScope scope : scopes) { String key = Property.TABLE_ITERATOR_PREFIX.getKey() + scope.name() + "." + ReplicationTableUtil.COMBINER_NAME + ".opt.columns"; Assert.assertTrue("Properties did not contain key : " + key, properties.containsKey(key)); Assert.assertEquals(MetadataSchema.ReplicationSection.COLF.toString(), properties.get(key)); } }
private static void ensureRowDeletingIteratorIsAttached(Connector connector, String tableName) { try { synchronized (addIteratorLock) { IteratorSetting is = new IteratorSetting(ROW_DELETING_ITERATOR_PRIORITY, ROW_DELETING_ITERATOR_NAME, RowDeletingIterator.class); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { try { connector.tableOperations().attachIterator(tableName, is); } catch (Exception ex) { // If many processes are starting up at the same time (see YARN). It's possible that there will be a collision. final int SLEEP_TIME = 5000; LOGGER.warn("Failed to attach RowDeletingIterator. Retrying in " + SLEEP_TIME + "ms."); Thread.sleep(SLEEP_TIME); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { connector.tableOperations().attachIterator(tableName, is); } } } } } catch (Exception e) { throw new SecureGraphException("Could not attach RowDeletingIterator", e); } }
.listIterators(OptUtil.getTableOpt(cl, shellState)).containsKey(name)) { Shell.log.warn("no iterators found that match your criteria"); return 0;
} else if (tables) { iterators = shellState.getConnector().tableOperations() .listIterators(OptUtil.getTableOpt(cl, shellState)); } else { throw new IllegalArgumentException("No table or namespace specified");
protected static void ensureRowDeletingIteratorIsAttached(Connector connector, String tableName) { try { synchronized (addIteratorLock) { IteratorSetting is = new IteratorSetting(ROW_DELETING_ITERATOR_PRIORITY, ROW_DELETING_ITERATOR_NAME, RowDeletingIterator.class); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { try { connector.tableOperations().attachIterator(tableName, is); } catch (Exception ex) { // If many processes are starting up at the same time (see YARN). It's possible that there will be a collision. final int SLEEP_TIME = 5000; LOGGER.warn("Failed to attach RowDeletingIterator. Retrying in %dms.", SLEEP_TIME); Thread.sleep(SLEEP_TIME); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { connector.tableOperations().attachIterator(tableName, is); } } } } } catch (Exception e) { throw new VertexiumException("Could not attach RowDeletingIterator", e); } }
protected static void ensureRowDeletingIteratorIsAttached(Connector connector, String tableName) { try { synchronized (addIteratorLock) { IteratorSetting is = new IteratorSetting(ROW_DELETING_ITERATOR_PRIORITY, ROW_DELETING_ITERATOR_NAME, RowDeletingIterator.class); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { try { connector.tableOperations().attachIterator(tableName, is); } catch (Exception ex) { // If many processes are starting up at the same time (see YARN). It's possible that there will be a collision. final int SLEEP_TIME = 5000; LOGGER.warn("Failed to attach RowDeletingIterator. Retrying in %dms.", SLEEP_TIME); Thread.sleep(SLEEP_TIME); if (!connector.tableOperations().listIterators(tableName).containsKey(ROW_DELETING_ITERATOR_NAME)) { connector.tableOperations().attachIterator(tableName, is); } } } } } catch (Exception e) { throw new VertexiumException("Could not attach RowDeletingIterator", e); } }
Map<String,EnumSet<IteratorScope>> iterators = null; try { iterators = tops.listIterators(tableName); } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) { throw new RuntimeException(e);
/** * This method takes a store and the name of an iterator to be * removed. * * @param store the accumulo store * @param iteratorName the name of the iterator update * @throws StoreException if any issues occur when updating the iterator */ public static void removeIterator(final AccumuloStore store, final String iteratorName) throws StoreException { try { if (store.getConnection().tableOperations().listIterators(store.getTableName()).containsKey(iteratorName)) { store.getConnection() .tableOperations() .removeIterator(store.getTableName(), iteratorName, EnumSet.of(IteratorScope.majc, IteratorScope.minc, IteratorScope.scan)); } } catch (final AccumuloSecurityException | AccumuloException | TableNotFoundException | StoreException e) { throw new StoreException("Unable remove iterator with Name: " + iteratorName, e); } }
throws AccumuloException, TableNotFoundException, AccumuloSecurityException { TableOperations tops = getConnector().tableOperations(); Map<String,EnumSet<IteratorScope>> iterators = tops.listIterators(ReplicationTable.NAME);
try { if ((iterators != null) && (iterators.length > 0)) { final Map<String,EnumSet<IteratorUtil.IteratorScope>> iteratorScopes = tops.listIterators(tableName); for (final IteratorConfig iteratorConfig : iterators) { boolean mustDelete = false;
assertTrue(s.iterator().hasNext()); assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName)); assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName)); assertEquals(setting, setting2); assertTrue(c.namespaceOperations().listIterators(namespace).containsKey(iterName)); assertTrue(c.tableOperations().listIterators(t1).containsKey(iterName)); s = c.createScanner(t1, Authorizations.EMPTY); assertFalse(s.iterator().hasNext()); sleepUninterruptibly(2, TimeUnit.SECONDS); assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName)); assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName)); s = c.createScanner(t1, Authorizations.EMPTY); assertTrue(s.iterator().hasNext());
for (int i = 0; i < 10 && !conn.tableOperations().listIterators(ReplicationTable.NAME).keySet() .contains(ReplicationTable.COMBINER_NAME); i++) { sleepUninterruptibly(2, TimeUnit.SECONDS); .listIterators(ReplicationTable.NAME).keySet().contains(ReplicationTable.COMBINER_NAME));