|
@@ -19,6 +19,8 @@ package org.apache.hadoop.hdfs;
|
|
|
|
|
|
import java.io.DataInputStream;
|
|
import java.io.DataInputStream;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
|
+
|
|
|
|
+import java.io.BufferedInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.ByteBuffer;
|
|
@@ -118,7 +120,9 @@ class BlockReaderLocal implements BlockReader {
|
|
// read and handle the common header here. For now just a version
|
|
// read and handle the common header here. For now just a version
|
|
checksumIn.getChannel().position(0);
|
|
checksumIn.getChannel().position(0);
|
|
BlockMetadataHeader header = BlockMetadataHeader
|
|
BlockMetadataHeader header = BlockMetadataHeader
|
|
- .readHeader(new DataInputStream(checksumIn));
|
|
|
|
|
|
+ .readHeader(new DataInputStream(
|
|
|
|
+ new BufferedInputStream(checksumIn,
|
|
|
|
+ BlockMetadataHeader.getHeaderSize())));
|
|
short version = header.getVersion();
|
|
short version = header.getVersion();
|
|
if (version != BlockMetadataHeader.VERSION) {
|
|
if (version != BlockMetadataHeader.VERSION) {
|
|
throw new IOException("Wrong version (" + version + ") of the " +
|
|
throw new IOException("Wrong version (" + version + ") of the " +
|