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

Xiang Li edited comment on HBASE-16183 at 7/12/16 6:48 AM:
-----------------------------------------------------------

Hi [~jerryhe], [~carp84], would you please review the patch v1 at your most 
convenience?
The only divergence could be that I proposed the following code could be all 
removed when overriding preGetOp() in class RegionObserverExample in section 
90.1, due to HBASE-11871
{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}
to make it as
{code}
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, 
final Get get, final List<Cell> results)
throws IOException {

  if (Bytes.equals(get.getRow(),ADMIN)) {
    Cell c = CellUtil.createCell(get.getRow(),COLUMN _FAMILY, COLUMN,
    System.currentTimeMillis(), (byte)4, VALUE);
    results.add(c);
    e.bypass();
  }
}
{code}


was (Author: water):
Hi [~jerryhe], [~carp84], would you please review the patch v1 at your most 
convenience?
The only divergence could be that I proposed the following code could be all 
removed when overriding preGetOp() in class RegionObserverExample in section 
90.1
{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}
to make it as
{code}
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, 
final Get get, final List<Cell> results)
throws IOException {

  if (Bytes.equals(get.getRow(),ADMIN)) {
    Cell c = CellUtil.createCell(get.getRow(),COLUMN _FAMILY, COLUMN,
    System.currentTimeMillis(), (byte)4, VALUE);
    results.add(c);
    e.bypass();
  }
}
{code}

> 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-master-v1.patch, 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