在Accumulo Proxy C#客户端中使用正则表达式过滤器

时间:2013-12-07 22:23:20

标签: c# regex proxy accumulo

尝试的功能: 查询和检索与特定模式匹配的行。 例如。对于搜索条件 - rowID如“Dining *”

(Accumulo 1.5,Proxy API - CSharp)。

要点:

  

无法检索回记录(在代码中的client.nextK..失败)   下面的片段)。我得到一个错误,上面写着 -   “结果{nextK_result(成功:,哎哟1:,哎哟2:   ,Ouch3:AccumuloSecurityException(Msg:   了java.lang.RuntimeException:   org.apache.accumulo.core.client.impl.AccumuloServerException:错误   服务器192.168.1.44:9997))}“

我已在下面的代码段后粘贴了日志文件内容。

代码段:

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);
}

日志文件错误:

  

2013-12-07 15:28:01,126 [tabletserver.TabletServer]信息:添加1   范围1的日志&lt;&lt; as alias 4 2013-12-07 15:29:36,256   [iterators.IteratorUtil]错误:java.lang.ClassNotFoundException:   RegExFilter.class 2013-12-07 15:29:36,257 [tabletserver.TabletServer]   警告:扫描平板电脑7时异常&lt;&lt; java.io.IOException异常:   java.lang.ClassNotFoundException:RegExFilter.class at   org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:248)     在   org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:213)     在   org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:191)     在   org.apache.accumulo.server.tabletserver.Tablet $ ScanDataSource.createIterator(Tablet.java:2084)     在   org.apache.accumulo.server.tabletserver.Tablet $ ScanDataSource.iterator(Tablet.java:2022)     在   org.apache.accumulo.core.iterators.system.SourceSwitchingIterator.seek(SourceSwitchingIterator.java:163)     在   org.apache.accumulo.server.tabletserver.Tablet.nextBatch(Tablet.java:1737)     在   org.apache.accumulo.server.tabletserver.Tablet.access $ 3200(Tablet.java:152)     在   org.apache.accumulo.server.tabletserver.Tablet $ Scanner.read(Tablet.java:1879)     在   org.apache.accumulo.server.tabletserver.TabletServer $ ThriftClientHandler $ NextBatchTask.run(TabletServer.java:945)     在   org.apache.accumulo.trace.instrument.TraceRunnable.run(TraceRunnable.java:47)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.runTask(ThreadPoolExecutor.java:886)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:908)     在   org.apache.accumulo.trace.instrument.TraceRunnable.run(TraceRunnable.java:47)     在   org.apache.accumulo.core.util.LoggingRunnable.run(LoggingRunnable.java:34)     在java.lang.Thread.run(Thread.java:662)引起:   java.lang.ClassNotFoundException:RegExFilter.class at   org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:175)     在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)     在   org.apache.accumulo.core.iterators.IteratorUtil.loadIterators(IteratorUtil.java:232)     ... 15更多2013-12-07 15:29:36,260 [thrift.ProcessFunction]错误:   内部错误处理startScan java.lang.RuntimeException:   java.util.concurrent.ExecutionException:java.io.IOException:   java.lang.ClassNotFoundException:RegExFilter.class

尝试: 将RegExFilter.class保存到$ ACCUMULO_HOME / lib / ext 这没有用。

1 个答案:

答案 0 :(得分:1)

Accumulo需要知道完整的类名才能正确加载它(包括包)。

尝试使用“org.apache.accumulo.core.iterators.user.RegExFilter”而不是“RegExFilter.class”,因为没有具有该名称和包的类。

此外,您不必在$ ACCUMULO_HOME / lib / ext中添加任何额外的类,因为org.apache.accumulo.core.iterators.user.RegExFilter已经包含在accumulo-core.jar中,并且应该在$中ACCUMULO_HOME / lib中