[ https://issues.apache.org/jira/browse/HBASE-16183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
li xiang updated HBASE-16183: ----------------------------- Description: 1. In Section 89.3.3 change String path = "hdfs://<namenode>:<port>/user/<hadoop-user>/coprocessor.jar"; into Path path = new Path("hdfs://bdavm1506.svl.ibm.com:8020/user/hbase/coprocessor.jar"); 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 HBaseAdmin admin = new HBaseAdmin(conf); into Connection connection = ConnectionFactory.createConnection(conf); Admin admin = connection.getAdmin(); 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 public void preGetOp(final ObserverContext e, final Get get, final List results) into public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, final Get get, final List<Cell> results) change List kvs = new ArrayList(results.size()); into List<Cell> kvs = new ArrayList<Cell>(results.size()); change public RegionScanner preScannerOpen(final ObserverContext e, final Scan scan, into preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e, final Scan scan, change public boolean postScannerNext(final ObserverContext e, final InternalScanner s, final List results, final int limit, final boolean hasMore) throws IOException { into public boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e, final InternalScanner s, inal List<Result> results, final int limit, final boolean hasMore) throws IOException { change Iterator iterator = results.iterator(); into Iterator<Result> iterator = results.iterator(); reason Generic 4. In section 90.1 change preGet(e, get, kvs); into super.preGetOp(e, get, kvs); 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 kvs.add(KeyValueUtil.ensureKeyValue(c)); into kvs.add(c); 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 > 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: li xiang > Assignee: li xiang > Priority: Minor > > 1. In Section 89.3.3 > change > String path = "hdfs://<namenode>:<port>/user/<hadoop-user>/coprocessor.jar"; > into > Path path = new > Path("hdfs://bdavm1506.svl.ibm.com:8020/user/hbase/coprocessor.jar"); > 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 > HBaseAdmin admin = new HBaseAdmin(conf); > into > Connection connection = ConnectionFactory.createConnection(conf); > Admin admin = connection.getAdmin(); > 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 > public void preGetOp(final ObserverContext e, final Get get, final List > results) > into > public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e, > final Get get, final List<Cell> results) > change > List kvs = new ArrayList(results.size()); > into > List<Cell> kvs = new ArrayList<Cell>(results.size()); > change > public RegionScanner preScannerOpen(final ObserverContext e, final Scan > scan, > into > preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e, final > Scan scan, > change > public boolean postScannerNext(final ObserverContext e, final > InternalScanner s, > final List results, final int limit, final boolean hasMore) throws > IOException { > into > public boolean postScannerNext(final > ObserverContext<RegionCoprocessorEnvironment> e, final InternalScanner s, > inal List<Result> results, final int limit, final boolean hasMore) throws > IOException { > change > Iterator iterator = results.iterator(); > into > Iterator<Result> iterator = results.iterator(); > reason > Generic > 4. In section 90.1 > change > preGet(e, get, kvs); > into > super.preGetOp(e, get, kvs); > 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 > kvs.add(KeyValueUtil.ensureKeyValue(c)); > into > kvs.add(c); > 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)