[ 
https://issues.apache.org/jira/browse/HBASE-16183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yu Li updated HBASE-16183:
--------------------------
    Attachment: HBASE-16183.patch

Attaching a patch applying most of the changes mentioned in description, except 
for removing the invocation of {{preGet(e, get, kvs);}} in {{preGetOp}} since 
the preGet CP hook is already removed, refer to HBASE-11919 for more details

> 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: Yu 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)

Reply via email to