Index: src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java (revision 1331652) +++ src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java (working copy) @@ -110,7 +110,6 @@ // Use hbase checksums. assertEquals(true, hfs.useHBaseChecksum()); - assertEquals(true, hfs.getNoChecksumFs() != hfs.getBackingFs()); // Do a read that purposely introduces checksum verification failures. FSDataInputStream is = fs.open(path); @@ -217,7 +216,6 @@ // Verify hbase checksums. assertEquals(true, hfs.useHBaseChecksum()); - assertEquals(true, hfs.getNoChecksumFs() != hfs.getBackingFs()); // Read data back from file. FSDataInputStream is = fs.open(path); Index: src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java (revision 1331652) +++ src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java (working copy) @@ -28,6 +28,7 @@ import org.apache.hadoop.fs.FilterFileSystem; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; +import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.Progressable; @@ -66,7 +67,11 @@ // filesystem object that has cksum verification turned off. // We will avoid verifying checksums in the fs client, instead do it // inside of hbase. - if (useHBaseChecksum) { + // If this is the local file system hadoop has a bug where seeks + // do not go to the correct location if setVerifyChecksum(false) is called. + // This manifests itself in that incorrect data is read and HFileBlocks won't be able to read + // their header magic numbers. See HBASE-5885 + if (useHBaseChecksum && !(fs instanceof LocalFileSystem)) { this.noChecksumFs = newInstanceFileSystem(conf); this.noChecksumFs.setVerifyChecksum(false); } else {