use of org.apache.accumulo.core.dataImpl.thrift.IterInfo in project accumulo by apache.
the class ActiveCompactionImpl method getIterators.
@Override
public List<IteratorSetting> getIterators() {
ArrayList<IteratorSetting> ret = new ArrayList<>();
for (IterInfo ii : tac.getSsiList()) {
IteratorSetting settings = new IteratorSetting(ii.getPriority(), ii.getIterName(), ii.getClassName());
Map<String, String> options = tac.getSsio().get(ii.getIterName());
settings.addOptions(options);
ret.add(settings);
}
return ret;
}
use of org.apache.accumulo.core.dataImpl.thrift.IterInfo in project accumulo by apache.
the class IterConfigUtilTest method testInvalidIteratorFormats.
/**
* Iterators should not contain dots in the name. Also, if the split size on "." is greater than
* one, it should be 3, i.e., itername.opt.optname
*/
@Test
public void testInvalidIteratorFormats() {
Map<String, String> data = new HashMap<>();
Map<String, Map<String, String>> options = new HashMap<>();
AccumuloConfiguration conf;
// create iterator with 'dot' in name
List<IterInfo> iterators = new ArrayList<>();
try {
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.bar", "50," + SummingCombiner.class.getName());
conf = new ConfigurationCopy(data);
iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, iterators, options, conf);
} catch (IllegalArgumentException ex) {
log.debug("caught expected exception: " + ex.getMessage());
}
data.clear();
iterators.clear();
options.clear();
// second part must be 'opt'.
try {
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.bar.baz", "49," + SummingCombiner.class.getName());
conf = new ConfigurationCopy(data);
iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, iterators, options, conf);
} catch (IllegalArgumentException ex) {
log.debug("caught expected exception: " + ex.getMessage());
}
data.clear();
iterators.clear();
options.clear();
// create iterator with invalid option format
try {
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foobar", "48," + SummingCombiner.class.getName());
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foobar.opt", "fakevalue");
conf = new ConfigurationCopy(data);
iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, iterators, options, conf);
assertEquals(1, iterators.size());
IterInfo ii = iterators.get(0);
assertEquals(new IterInfo(48, SummingCombiner.class.getName(), "foobar"), ii);
} catch (IllegalArgumentException ex) {
log.debug("caught expected exception: " + ex.getMessage());
}
data.clear();
iterators.clear();
options.clear();
// create iterator with 'opt' in incorrect position
try {
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foobaz", "47," + SummingCombiner.class.getName());
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foobaz.fake.opt", "fakevalue");
conf = new ConfigurationCopy(data);
iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, iterators, options, conf);
assertEquals(1, iterators.size());
IterInfo ii = iterators.get(0);
assertEquals(new IterInfo(47, SummingCombiner.class.getName(), "foobaz"), ii);
} catch (IllegalArgumentException ex) {
log.debug("caught expected exception: " + ex.getMessage());
}
}
use of org.apache.accumulo.core.dataImpl.thrift.IterInfo in project accumulo by apache.
the class IterConfigUtilTest method onlyReadsRelevantIteratorScopeConfigurations.
@Test
public void onlyReadsRelevantIteratorScopeConfigurations() {
Map<String, String> data = new HashMap<>();
// Make some configuration items, one with a bogus scope
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo", "50," + SummingCombiner.class.getName());
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.opt.all", "true");
data.put(Property.TABLE_ITERATOR_PREFIX + ".fakescope.bar", "50," + SummingCombiner.class.getName());
data.put(Property.TABLE_ITERATOR_SCAN_PREFIX + "foo.opt.fakeopt", "fakevalue");
AccumuloConfiguration conf = new ConfigurationCopy(data);
List<IterInfo> iterators = IterConfigUtil.parseIterConf(IteratorScope.scan, EMPTY_ITERS, new HashMap<>(), conf);
assertEquals(1, iterators.size());
IterInfo ii = iterators.get(0);
assertEquals(new IterInfo(50, SummingCombiner.class.getName(), "foo"), ii);
}
use of org.apache.accumulo.core.dataImpl.thrift.IterInfo in project accumulo by apache.
the class ScannerOptions method removeScanIterator.
@Override
public synchronized void removeScanIterator(String iteratorName) {
checkArgument(iteratorName != null, "iteratorName is null");
// if no iterators are set, we don't have it, so it is already removed
if (serverSideIteratorList.isEmpty()) {
return;
}
for (IterInfo ii : serverSideIteratorList) {
if (ii.iterName.equals(iteratorName)) {
serverSideIteratorList.remove(ii);
break;
}
}
serverSideIteratorOptions.remove(iteratorName);
}
use of org.apache.accumulo.core.dataImpl.thrift.IterInfo in project accumulo by apache.
the class ScannerOptions method addScanIterator.
@Override
public synchronized void addScanIterator(IteratorSetting si) {
checkArgument(si != null, "si is null");
if (serverSideIteratorList.isEmpty()) {
serverSideIteratorList = new ArrayList<>();
}
for (IterInfo ii : serverSideIteratorList) {
if (ii.iterName.equals(si.getName())) {
throw new IllegalArgumentException("Iterator name is already in use " + si.getName());
}
if (ii.getPriority() == si.getPriority()) {
throw new IllegalArgumentException("Iterator priority is already in use " + si.getPriority());
}
}
serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName()));
if (serverSideIteratorOptions.isEmpty()) {
serverSideIteratorOptions = new HashMap<>();
}
serverSideIteratorOptions.computeIfAbsent(si.getName(), k -> new HashMap<>()).putAll(si.getOptions());
}
Aggregations