HBASE-9751 Excessive readpoints checks in StoreFileScanner

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1531790 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2013-10-14 03:57:15 +00:00
parent ffeb4ab1e3
commit 1be3aeda38
4 changed files with 15 additions and 5 deletions

View File

@ -497,6 +497,8 @@ public class HFile {
void close(boolean evictOnClose) throws IOException; void close(boolean evictOnClose) throws IOException;
DataBlockEncoding getEncodingOnDisk(); DataBlockEncoding getEncodingOnDisk();
boolean hasMVCCInfo();
} }
/** /**

View File

@ -387,6 +387,11 @@ public class HFileReaderV2 extends AbstractHFileReader {
return dataBlockEncoder.diskToCacheFormat(hfileBlock, isCompaction); return dataBlockEncoder.diskToCacheFormat(hfileBlock, isCompaction);
} }
@Override
public boolean hasMVCCInfo() {
return includesMemstoreTS && decodeMemstoreTS;
}
/** /**
* Compares the actual type of a block retrieved from cache or disk with its * Compares the actual type of a block retrieved from cache or disk with its
* expected type and throws an exception in case of a mismatch. Expected * expected type and throws an exception in case of a mismatch. Expected

View File

@ -1070,7 +1070,7 @@ public class StoreFile {
boolean isCompaction) { boolean isCompaction) {
return new StoreFileScanner(this, return new StoreFileScanner(this,
getScanner(cacheBlocks, pread, getScanner(cacheBlocks, pread,
isCompaction), !isCompaction); isCompaction), !isCompaction, reader.hasMVCCInfo());
} }
/** /**

View File

@ -53,6 +53,7 @@ public class StoreFileScanner implements KeyValueScanner {
private KeyValue delayedSeekKV; private KeyValue delayedSeekKV;
private boolean enforceMVCC = false; private boolean enforceMVCC = false;
private boolean hasMVCCInfo = false;
private static AtomicLong seekCount; private static AtomicLong seekCount;
@ -62,10 +63,11 @@ public class StoreFileScanner implements KeyValueScanner {
* Implements a {@link KeyValueScanner} on top of the specified {@link HFileScanner} * Implements a {@link KeyValueScanner} on top of the specified {@link HFileScanner}
* @param hfs HFile scanner * @param hfs HFile scanner
*/ */
public StoreFileScanner(StoreFile.Reader reader, HFileScanner hfs, boolean useMVCC) { public StoreFileScanner(StoreFile.Reader reader, HFileScanner hfs, boolean useMVCC, boolean hasMVCC) {
this.reader = reader; this.reader = reader;
this.hfs = hfs; this.hfs = hfs;
this.enforceMVCC = useMVCC; this.enforceMVCC = useMVCC;
this.hasMVCCInfo = hasMVCC;
} }
/** /**
@ -126,7 +128,8 @@ public class StoreFileScanner implements KeyValueScanner {
if (cur != null) { if (cur != null) {
hfs.next(); hfs.next();
cur = hfs.getKeyValue(); cur = hfs.getKeyValue();
skipKVsNewerThanReadpoint(); if (hasMVCCInfo)
skipKVsNewerThanReadpoint();
} }
} catch(IOException e) { } catch(IOException e) {
throw new IOException("Could not iterate " + this, e); throw new IOException("Could not iterate " + this, e);
@ -146,7 +149,7 @@ public class StoreFileScanner implements KeyValueScanner {
cur = hfs.getKeyValue(); cur = hfs.getKeyValue();
return skipKVsNewerThanReadpoint(); return !hasMVCCInfo ? true : skipKVsNewerThanReadpoint();
} finally { } finally {
realSeekDone = true; realSeekDone = true;
} }
@ -166,7 +169,7 @@ public class StoreFileScanner implements KeyValueScanner {
} }
cur = hfs.getKeyValue(); cur = hfs.getKeyValue();
return skipKVsNewerThanReadpoint(); return !hasMVCCInfo ? true : skipKVsNewerThanReadpoint();
} finally { } finally {
realSeekDone = true; realSeekDone = true;
} }