HBASE-10225 Bug in calls to RegionObsever.postScannerFilterRow

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1553079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
anoopsamjohn 2013-12-23 07:03:03 +00:00
parent e6b2e7ff45
commit 9b2effdcc4
5 changed files with 15 additions and 9 deletions

View File

@ -436,7 +436,8 @@ public abstract class BaseRegionObserver implements RegionObserver {
@Override @Override
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e, public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final byte[] currentRow, final boolean hasMore) throws IOException { final InternalScanner s, final byte[] currentRow, final int offset, final short length,
final boolean hasMore) throws IOException {
return hasMore; return hasMore;
} }

View File

@ -967,12 +967,15 @@ public interface RegionObserver extends Coprocessor {
* @param c the environment provided by the region server * @param c the environment provided by the region server
* @param s the scanner * @param s the scanner
* @param currentRow The current rowkey which got filtered out * @param currentRow The current rowkey which got filtered out
* @param offset offset to rowkey
* @param length length of rowkey
* @param hasMore the 'has more' indication * @param hasMore the 'has more' indication
* @return whether more rows are available for the scanner or not * @return whether more rows are available for the scanner or not
* @throws IOException * @throws IOException
*/ */
boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> c, boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> c,
final InternalScanner s, final byte[] currentRow, final boolean hasMore) throws IOException; final InternalScanner s, final byte[] currentRow, final int offset, final short length,
final boolean hasMore) throws IOException;
/** /**
* Called before the client closes a scanner. * Called before the client closes a scanner.

View File

@ -3944,8 +3944,8 @@ public class HRegion implements HeapSize { // , Writable{
resetFilters(); resetFilters();
// Calling the hook in CP which allows it to do a fast forward // Calling the hook in CP which allows it to do a fast forward
return this.region.getCoprocessorHost() == null return this.region.getCoprocessorHost() == null
|| this.region.getCoprocessorHost().postScannerFilterRow(this, || this.region.getCoprocessorHost()
currentRow); .postScannerFilterRow(this, currentRow, offset, length);
} }
protected boolean isStopRow(byte[] currentRow, int offset, short length) { protected boolean isStopRow(byte[] currentRow, int offset, short length) {

View File

@ -1503,11 +1503,13 @@ public class RegionCoprocessorHost
* filter. * filter.
* @param s the scanner * @param s the scanner
* @param currentRow The current rowkey which got filtered out * @param currentRow The current rowkey which got filtered out
* @param offset offset to rowkey
* @param length length of rowkey
* @return whether more rows are available for the scanner or not * @return whether more rows are available for the scanner or not
* @throws IOException * @throws IOException
*/ */
public boolean postScannerFilterRow(final InternalScanner s, final byte[] currentRow) public boolean postScannerFilterRow(final InternalScanner s, final byte[] currentRow, int offset,
throws IOException { short length) throws IOException {
boolean hasMore = true; // By default assume more rows there. boolean hasMore = true; // By default assume more rows there.
ObserverContext<RegionCoprocessorEnvironment> ctx = null; ObserverContext<RegionCoprocessorEnvironment> ctx = null;
for (RegionEnvironment env : coprocessors) { for (RegionEnvironment env : coprocessors) {
@ -1515,7 +1517,7 @@ public class RegionCoprocessorHost
ctx = ObserverContext.createAndPrepare(env, ctx); ctx = ObserverContext.createAndPrepare(env, ctx);
try { try {
hasMore = ((RegionObserver) env.getInstance()).postScannerFilterRow(ctx, s, currentRow, hasMore = ((RegionObserver) env.getInstance()).postScannerFilterRow(ctx, s, currentRow,
hasMore); offset, length, hasMore);
} catch (Throwable e) { } catch (Throwable e) {
handleCoprocessorThrowable(env, e); handleCoprocessorThrowable(env, e);
} }

View File

@ -73,7 +73,7 @@ class ReversedRegionScannerImpl extends RegionScannerImpl {
// Calling the hook in CP which allows it to do a fast forward // Calling the hook in CP which allows it to do a fast forward
if (this.region.getCoprocessorHost() != null) { if (this.region.getCoprocessorHost() != null) {
return this.region.getCoprocessorHost().postScannerFilterRow(this, return this.region.getCoprocessorHost().postScannerFilterRow(this,
currentRow); currentRow, offset, length);
} }
return true; return true;
} }