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

Xiang Li commented on HBASE-16183:
----------------------------------

Patch v1 for mater branch fixes the following errors:

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://<namenode>:<port>/user/<hadoop-user>/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}
public RegionScanner preScannerOpen(final ObserverContext e, final Scan scan,
{code}
into
{code}
public RegionScanner 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
Remove the following code
{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}
Reason:
They are of no use after HBASE-11871 is applied.

5. Section 90.1
change 
{code}
Cell c = CellUtil.createCell(get.getRow(),COLUMN _FAMILY, COLUMN,
            System.currentTimeMillis(), (byte)4, VALUE);
{code}
to
{code}
Cell c = CellUtil.createCell(get.getRow(),COLUMN_FAMILY, COLUMN,
            System.currentTimeMillis(), (byte)4, VALUE);
{code}
Reason
It is a typo, there is a whitespace between "COLUMN" and "_FAMILY"

> 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
>
>
> There are some errors in the example programs for coprocessor in Ref Guide. 
> Such as using deprecated APIs, generic...



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

Reply via email to