diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java index a500f0d..2da3192 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java @@ -314,18 +314,25 @@ public class StoreFile { } /** - * @return true if this storefile was created by HFileOutputFormat + * @return true if this storefile was created by bulk load. * for a bulk load. */ boolean isBulkLoadResult() { - return metadataMap.containsKey(BULKLOAD_TIME_KEY); + boolean bulkLoadedHFile = false; + String fileName = this.getPath().getName(); + int startPos = fileName.indexOf("_SeqId_"); + if (startPos != -1) { + bulkLoadedHFile = true; + } + return metadataMap.containsKey(BULKLOAD_TIME_KEY) || bulkLoadedHFile; } /** * Return the timestamp at which this bulk load file was generated. */ public long getBulkLoadTimestamp() { - return Bytes.toLong(metadataMap.get(BULKLOAD_TIME_KEY)); + byte[] bulkLoadTimestamp = metadataMap.get(BULKLOAD_TIME_KEY); + return (bulkLoadTimestamp == null) ? 0 : Bytes.toLong(bulkLoadTimestamp); } /** @@ -368,6 +375,9 @@ public class StoreFile { } if (isBulkLoadResult()){ + + this.reader.isBulkLoadedHFile = true; + // generate the sequenceId from the fileName // fileName is of the form _SeqId__ String fileName = this.getPath().getName(); @@ -1008,6 +1018,7 @@ public class StoreFile { protected long sequenceID = -1; private byte[] lastBloomKey; private long deleteFamilyCnt = -1; + private boolean isBulkLoadedHFile = false; public Reader(FileSystem fs, Path path, CacheConfig cacheConf, Configuration conf) throws IOException { @@ -1050,6 +1061,7 @@ public class StoreFile { /** * Get a scanner to scan over this StoreFile. + * Always ignore MVCC info in bulk loaded file. * * @param cacheBlocks should this scanner cache blocks? * @param pread use pread (for highly concurrent small readers) @@ -1061,7 +1073,8 @@ public class StoreFile { boolean isCompaction, long readPt) { return new StoreFileScanner(this, getScanner(cacheBlocks, pread, isCompaction), - !isCompaction, reader.hasMVCCInfo(), readPt); + !isCompaction, reader.hasMVCCInfo() && !this.isBulkLoadedHFile, + readPt); } /**