hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiang Li (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HBASE-16183) Correct errors in example program of coprocessor in Ref Guide
Date Fri, 08 Jul 2016 09:22:11 GMT

    [ https://issues.apache.org/jira/browse/HBASE-16183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367439#comment-15367439
] 

Xiang Li edited comment on HBASE-16183 at 7/8/16 9:22 AM:
----------------------------------------------------------

[~carp84] Thanks for the review and the patch!
After reading HBASE-11919, I think the following part in preGetOp() in RegionObserverExample
in section 90.1 can be all removed
{code}
List kvs = new ArrayList(results.size());
for (Cell c : results) {
  kvs.add(KeyValueUtil.ensureKeyValue(c));
}
preGet(e, get, kvs);
results.clear();
results.addAll(kvs);
{code}

Those logic is useful because originally kvs is List<KeyValue> (Please see the description
of HBASE-11919). After HBASE-11919 is applied, those logic seem of no use.

Do you think so?


was (Author: waterlx):
[~carp84] Thanks for the review and the patch!
After reading HBASE-11919, I think the following part in preGetOp() in RegionObserverExample
in section 90.1 can be all removed
{code}
List kvs = new ArrayList(results.size());
for (Cell c : results) {
  kvs.add(KeyValueUtil.ensureKeyValue(c));
}
preGet(e, get, kvs);
results.clear();
results.addAll(kvs);
{code}

Those logic is useful because originally kvs is List<KeyValue> (Please see the description
of HBASE-19119). After HBASE-19119 is applied, those logic seem of no use.

Do you think so?

> Correct errors in example program of coprocessor in Ref Guide
> -------------------------------------------------------------
>
>                 Key: HBASE-16183
>                 URL: https://issues.apache.org/jira/browse/HBASE-16183
>             Project: HBase
>          Issue Type: Bug
>          Components: documentation
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>         Attachments: HBASE-16183.patch
>
>
> 1. In Section 89.3.3
> change
> {code}
> String path = "hdfs://<namenode>:<port>/user/<hadoop-user>/coprocessor.jar";
> {code}
> into
> {code}
> Path path = new Path("hdfs://bdavm1506.svl.ibm.com:8020/user/hbase/coprocessor.jar");
> {code}
> Reason:
>   The second parameter of HTableDescriptor.addCoprocessor() is org.apache.hadoop.fs.Path,
not String.
>   See http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/HTableDescriptor.html
> 2. In Section 89.3.3
> change
> {code}
> HBaseAdmin admin = new HBaseAdmin(conf);
> {code}
> into
> {code}
> Connection connection = ConnectionFactory.createConnection(conf);
> Admin admin = connection.getAdmin();
> {code}
> Reason:
>   HBASE-12083 makes new HBaseAdmin() deprecated and the instance of Admin is supposed
to get from Connection.getAdmin()
>   Also see http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/client/HBaseAdmin.html
> 3. In section 90.1
> change
> {code}
> public void preGetOp(final ObserverContext e, final Get get, final List results)
> {code}
> into
> {code}
> public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, final
Get get, final List<Cell> results)
> {code}
> change
> {code}
> List kvs = new ArrayList(results.size());
> {code}
> into
> {code}
> List<Cell> kvs = new ArrayList<Cell>(results.size());
> {code}
> change
> {code}
> public RegionScanner preScannerOpen(final ObserverContext e, final Scan scan,
> {code}
> into
> {code}
> preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e, final Scan
scan´╝î
> {code}
> change
> {code}
> public boolean postScannerNext(final ObserverContext e, final InternalScanner s, final
List results, final int limit, final boolean hasMore) throws IOException {
> {code}
> into
> {code}
> public boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment>
e, final InternalScanner s, final List<Result> results, final int limit, final boolean
hasMore) throws IOException {
> {code}
> change
> {code}
> Iterator iterator = results.iterator();
> {code}
> into
> {code}
> Iterator<Result> iterator = results.iterator();
> {code}
> Reason:
>   Generic
> 4. In section 90.1
> change
> {code}
> preGet(e, get, kvs);
> {code}
> into
> {code}
> super.preGetOp(e, get, kvs);
> {code}
> Reason:
>   There is not a function called preGet() provided by BaseRegionObserver or its super
class/interface. I believe we need to call preGetOp() of the super class of RegionObserverExample
here.
> 5. In section 90.1
> change
> {code}
> kvs.add(KeyValueUtil.ensureKeyValue(c));
> {code}
> into
> {code}
> kvs.add(c);
> {code}
> Reason:
>   KeyValueUtil.ensureKeyValue() is deprecated.
>   See http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/KeyValueUtil.html
>   and https://issues.apache.org/jira/browse/HBASE-12079



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message