Using regex filter in Accumulo Proxy C# client

373 views Asked by At

Functionality attempted: Query and retrieve rows matching a certain pattern. E.g. for search criteria - rowID like "Dining*"

(Accumulo 1.5, Proxy API - CSharp).

Summary:

Unable to retrieve records back (fails at client.nextK..in the code snippet below). I get an error that says - "result {nextK_result(Success: ,Ouch1: ,Ouch2: ,Ouch3: AccumuloSecurityException(Msg: java.lang.RuntimeException: org.apache.accumulo.core.client.impl.AccumuloServerException: Error on server 192.168.1.44:9997))}"

I have pasted the log file content after the code snippet, below.

Code snippet:

List<String> artifactList = new List<String> ();

String rowRegex = rowID + "*";
String colfRegex = null;
String colqRegex = null;
String valueRegex = null;
String orFields = "false";

IteratorSetting iterSttng = new IteratorSetting();
iterSttng.Priority = 15;
iterSttng.Name = "rowIDRegexFilter";
iterSttng.IteratorClass="RegExFilter.class";

Dictionary<string, string> iterProperties = new Dictionary<string, string> ();
iterProperties.Add ("ROW_REGEX", rowRegex);
//iterProperties.Add ("COLF_REGEX", colfRegex);
//iterProperties.Add ("COLQ_REGEX", colqRegex);
//iterProperties.Add ("VALUE_REGEX", valueRegex);
//iterProperties.Add ("OR_FIELDS", orFields);

iterSttng.Properties=iterProperties;

List<IteratorSetting> listIterSttngs = new List<IteratorSetting> ();
listIterSttngs.Add (iterSttng);

THashSet<byte[]> Auths = new THashSet<byte[]>();
Auths.Add (GetBytes("Public"));

var scanOpts = new ScanOptions();

scanOpts.Authorizations=Auths;
scanOpts.Iterators=listIterSttngs;


try{
    String scannerInstance = client.createScanner(loginToken, tableName, scanOpts);

    var more = true;
    while (more)
    {
        var scan = client.nextK(scannerInstance, 10);
        more = scan.More;

        foreach (var entry in scan.Results)
        {
            artifactList.Add (GetString(entry.Key.Row));
        }
    }

    client.closeScanner(scannerInstance);
}catch(Exception e) {
    Console.WriteLine (e.StackTrace);
}

Error in log file:

2013-12-07 15:28:01,126 [tabletserver.TabletServer] INFO : Adding 1 logs for extent 1<< as alias 4 2013-12-07 15:29:36,256 [iterators.IteratorUtil] ERROR: java.lang.ClassNotFoundException: RegExFilter.class 2013-12-07 15:29:36,257 [tabletserver.TabletServer] WARN : exception while scanning tablet 7<< java.io.IOException: java.lang.ClassNotFoundException: RegExFilter.class at org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:248) at org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:213) at org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:191) at org.apache.accumulo.server.tabletserver.Tablet$ScanDataSource.createIterator(Tablet.java:2084) at org.apache.accumulo.server.tabletserver.Tablet$ScanDataSource.iterator(Tablet.java:2022) at org.apache.accumulo.core.iterators.system.SourceSwitchingIterator.seek(SourceSwitchingIterator.java:163) at org.apache.accumulo.server.tabletserver.Tablet.nextBatch(Tablet.java:1737) at org.apache.accumulo.server.tabletserver.Tablet.access$3200(Tablet.java:152) at org.apache.accumulo.server.tabletserver.Tablet$Scanner.read(Tablet.java:1879) at org.apache.accumulo.server.tabletserver.TabletServer$ThriftClientHandler$NextBatchTask.run(TabletServer.java:945) at org.apache.accumulo.trace.instrument.TraceRunnable.run(TraceRunnable.java:47) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at org.apache.accumulo.trace.instrument.TraceRunnable.run(TraceRunnable.java:47) at org.apache.accumulo.core.util.LoggingRunnable.run(LoggingRunnable.java:34) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: RegExFilter.class at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.loadClass(AccumuloVFSClassLoader.java:102) at org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:232) ... 15 more 2013-12-07 15:29:36,260 [thrift.ProcessFunction] ERROR: Internal error processing startScan java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.io.IOException: java.lang.ClassNotFoundException: RegExFilter.class

Attempt: Saved RegExFilter.class to $ACCUMULO_HOME/lib/ext This did not help.

1

There are 1 answers

2
elserj On BEST ANSWER

Accumulo needs to know the full class name to load it properly (package included).

Try using "org.apache.accumulo.core.iterators.user.RegExFilter" instead of "RegExFilter.class" as there is no class with that name and package.

Also, you shouldn't have to put any extra classes in $ACCUMULO_HOME/lib/ext as org.apache.accumulo.core.iterators.user.RegExFilter is already contained in accumulo-core.jar and should be in $ACCUMULO_HOME/lib