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
dynamically loaded coprocessors (Andrei Dragomir)
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
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.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -104,13 +105,20 @@ public class SequenceFileLogReader implements HLog.Reader {
Field fIn = FilterInputStream.class.getDeclaredField("in");
fIn.setAccessible(true);
Object realIn = fIn.get(this.in);
// In hadoop 0.22, DFSInputStream is a standalone class. Before this,
// it was an inner class of DFSClient.
if (realIn.getClass().getName().endsWith("DFSInputStream")) {
Method getFileLength = realIn.getClass().
getMethod("getFileLength", new Class<?> []{});
getDeclaredMethod("getFileLength", new Class<?> []{});
getFileLength.setAccessible(true);
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) {
SequenceFileLogReader.LOG.warn(
"Error while trying to get accurate file length. " +