HBASE-4935 hbase 0.92.0 doesn't work going against 0.20.205.0, its packaged hadoop

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1221033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-12-20 00:10:02 +00:00
parent 1222383f1d
commit 77e16e8027
2 changed files with 25 additions and 16 deletions

View File

@ -457,6 +457,7 @@ Release 0.92.0 - Unreleased
HBASE-4946 HTable.coprocessorExec (and possibly coprocessorProxy) does not work with HBASE-4946 HTable.coprocessorExec (and possibly coprocessorProxy) does not work with
dynamically loaded coprocessors (Andrei Dragomir) dynamically loaded coprocessors (Andrei Dragomir)
HBASE-5026 Add coprocessor hook to HRegionServer.ScannerListener.leaseExpired() HBASE-5026 Add coprocessor hook to HRegionServer.ScannerListener.leaseExpired()
HBASE-4935 hbase 0.92.0 doesn't work going against 0.20.205.0, its packaged hadoop
TESTS TESTS
HBASE-4450 test for number of blocks read: to serve as baseline for expected HBASE-4450 test for number of blocks read: to serve as baseline for expected

View File

@ -26,6 +26,7 @@ import java.lang.Class;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -104,13 +105,20 @@ public class SequenceFileLogReader implements HLog.Reader {
Field fIn = FilterInputStream.class.getDeclaredField("in"); Field fIn = FilterInputStream.class.getDeclaredField("in");
fIn.setAccessible(true); fIn.setAccessible(true);
Object realIn = fIn.get(this.in); Object realIn = fIn.get(this.in);
Method getFileLength = realIn.getClass(). // In hadoop 0.22, DFSInputStream is a standalone class. Before this,
getMethod("getFileLength", new Class<?> []{}); // it was an inner class of DFSClient.
getFileLength.setAccessible(true); if (realIn.getClass().getName().endsWith("DFSInputStream")) {
long realLength = ((Long)getFileLength. Method getFileLength = realIn.getClass().
invoke(realIn, new Object []{})).longValue(); getDeclaredMethod("getFileLength", new Class<?> []{});
assert(realLength >= this.length); getFileLength.setAccessible(true);
adjust = realLength - this.length; long realLength = ((Long)getFileLength.
invoke(realIn, new Object []{})).longValue();
assert(realLength >= this.length);
adjust = realLength - this.length;
} else {
LOG.info("Input stream class: " + realIn.getClass().getName() +
", not adjusting length");
}
} catch(Exception e) { } catch(Exception e) {
SequenceFileLogReader.LOG.warn( SequenceFileLogReader.LOG.warn(
"Error while trying to get accurate file length. " + "Error while trying to get accurate file length. " +