简体   繁体   English

Accumulo表扫描程序在Java中静默失败

[英]Accumulo table scanner failing silently in Java

I am attempting to scan an entire Accumulo table with the Java API. 我正在尝试使用Java API扫描整个Accumulo表。 I have verified that the meta info is all correct (credentials, ZooKeeper server, Accumlo Instance ID, table name). 我已经验证了元信息都是正确的(凭证,ZooKeeper服务器,Accumlo实例ID,表名)。 At this point I'm at a dead end so any suggestion is appreciated. 在这一点上,我处于死胡同,所以任何建议都值得赞赏。

Accumulo Version Accumulo版本

1.6.2 1.6.2

The code 编码

Borrowed from accumulo read client . 累积借来的客户中借来的。

// scan the whole table
System.out.println("=== whole table ===");
Scanner tableScanner;
try {
  tableScanner = conn.createScanner("geomesa3_records", new Authorizations());
  // conn is of type Connector
  // Connector and Scanner are implemented in org.apache.accumulo.core.client
  // See links below for additional info
} catch (TableNotFoundException ex) {
  throw new RuntimeException("table not found - was SimpleIngestClient run?");
}
System.out.println("-------------------------------------");

for(Map.Entry<Key, Value> kv : tableScanner) { // seemingly freezes here
  System.out.println("----------------- new row ---------------");
  System.out.println(kv.getKey().getRow() + " "
      + kv.getKey().getColumnFamily() + " "
      + kv.getKey().getColumnQualifier() + ": "
      + new String(kv.getValue().get()));
}
tableScanner.close();
System.out.println("-------------------------------------");
System.out.println("=== end table ===");

Intended results 预期结果

=== whole table ===
-------------------------------------
----------------- new row ---------------
// table data
----------------- new row ---------------
// table data
----------------- new row ---------------
// table data
-------------------------------------
=== end table ===

Actual results 实际结果

=== whole table ===
-------------------------------------

Relevant Accumulo Links 相关的Accumulo链接

Scanner API Scanner API

Connector API used for createScanner 用于createScanner Connector API

Scanner interface Scanner界面

I think you might need to set a range on the scanner. 我认为您可能需要在扫描仪上设置范围。 To scan and entire table, just set the range like so: 要扫描整个表格,只需设置范围如下:

scanner.setRange(new Range());

This range will match everything. 此范围将匹配所有内容。 Specifically, this range "goes from negative infinity to positive infinity". 具体地,该范围“从负无穷大到正无穷大”。 Basically it matches all possible Keys. 基本上,它匹配所有可能的键。

I use a similar strategy for a fetch all operation on one of my tables. 我使用类似的策略对我的一张桌子进行所有操作。

Also, just be aware that this sort of thing can definitely cause issues. 另外,请注意,这种事情肯定会引起问题。 If the table gets large, this could take a very long time to run. 如果表变大,则可能需要很长时间才能运行。 In my case I never expect the table to grow above a few hundred logical rows, so I consider it safe. 就我而言,我从不希望该表增长到几百个逻辑行以上,因此我认为它是安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM