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:
parent
ffeb4ab1e3
commit
1be3aeda38
|
@ -497,6 +497,8 @@ public class HFile {
|
|||
void close(boolean evictOnClose) throws IOException;
|
||||
|
||||
DataBlockEncoding getEncodingOnDisk();
|
||||
|
||||
boolean hasMVCCInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -387,6 +387,11 @@ public class HFileReaderV2 extends AbstractHFileReader {
|
|||
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
|
||||
* expected type and throws an exception in case of a mismatch. Expected
|
||||
|
|
|
@ -1070,7 +1070,7 @@ public class StoreFile {
|
|||
boolean isCompaction) {
|
||||
return new StoreFileScanner(this,
|
||||
getScanner(cacheBlocks, pread,
|
||||
isCompaction), !isCompaction);
|
||||
isCompaction), !isCompaction, reader.hasMVCCInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,7 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
private KeyValue delayedSeekKV;
|
||||
|
||||
private boolean enforceMVCC = false;
|
||||
private boolean hasMVCCInfo = false;
|
||||
|
||||
private static AtomicLong seekCount;
|
||||
|
||||
|
@ -62,10 +63,11 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
* Implements a {@link KeyValueScanner} on top of the specified {@link HFileScanner}
|
||||
* @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.hfs = hfs;
|
||||
this.enforceMVCC = useMVCC;
|
||||
this.hasMVCCInfo = hasMVCC;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,7 +128,8 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
if (cur != null) {
|
||||
hfs.next();
|
||||
cur = hfs.getKeyValue();
|
||||
skipKVsNewerThanReadpoint();
|
||||
if (hasMVCCInfo)
|
||||
skipKVsNewerThanReadpoint();
|
||||
}
|
||||
} catch(IOException e) {
|
||||
throw new IOException("Could not iterate " + this, e);
|
||||
|
@ -146,7 +149,7 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
|
||||
cur = hfs.getKeyValue();
|
||||
|
||||
return skipKVsNewerThanReadpoint();
|
||||
return !hasMVCCInfo ? true : skipKVsNewerThanReadpoint();
|
||||
} finally {
|
||||
realSeekDone = true;
|
||||
}
|
||||
|
@ -166,7 +169,7 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
}
|
||||
cur = hfs.getKeyValue();
|
||||
|
||||
return skipKVsNewerThanReadpoint();
|
||||
return !hasMVCCInfo ? true : skipKVsNewerThanReadpoint();
|
||||
} finally {
|
||||
realSeekDone = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue