对于0.94版本来说,有几个地方会发生检验
(1)HFile (HRegionServer里面)
(2)FSInputChecker (DFSClient里面)
DFSClient :
非本地读取,通过DataNode读取,RemoteBlockReader
Disk -> DataNode -> DFSClient(
RemoteBlockReader
) -> HFile (HRegionServer)
Disk -> DataNode -> DFSClient(
RemoteBlockReader
) -> HLog (HRegionServer)
本地读取,BlockReaderLocal
Disk -> DFSClient(
BlockReaderLocal
) -> HFile (HRegionServer)
Disk -> DFSClient(
BlockReaderLocal
) -> HLog (HRegionServer)
其中:
RemoteBlockReader 和
BlockReaderLocal 都继承自FSInputChecker
HFileSystem:里面有两个FileSystem实例 一个是 fs,一个是 FileSystem noChecksumFs; // read hfile data from storage
(1) noChecksumFs 用于HFile
(2) fs 可以用于HLog、以及其他文件
目前0.94.1以及之前的版本noChecksumFs 和 fs 使用相同的配置(configuration),只有verifyChecksum不同
support checksums in HBase block cache
public static final String HBASE_CHECKSUM_VERIFICATION =
"hbase.regionserver.checksum.verify"
;
默认为true,所以HRegionServer通过DFSClient读取到HFile的数据后会进行检验。
通过DataNode读取(RemoteBlockReader)是否检验由 DistributedFileSystem.verifyChecksum 来决定
本地读取,DFSClient直接读取文件,
是否检验由
public static final String DFS_CLIENT_READ_SHORTCIRCUIT_SKIP_CHECKSUM_KEY
= "dfs.client.read.shortcircuit.skip.checksum";
来决定
如果DFS_CLIENT_READ_SHORTCIRCUIT_KEY = "dfs.client.read.shortcircuit";设置为true,并且DataNode是local的,那么DFSClient会先跟DataNode通信获取block的path,然后自己直接读取block(
本地读取,
BlockReaderLocal)。
Skip checksum is broke; are we double-checksumming by default?
关于本地读的建议:
Read short circuit should always be enabled, unless you’re constantly trashing the cache.
来自committer Jean-Daniel Cryans,
http://files.meetup.com/1350427/hug_ebay_jdcryans.pdf
Read short circuit should always be enabled, unless you’re constantly trashing the cache.
来自committer Jean-Daniel Cryans,
http://files.meetup.com/1350427/hug_ebay_jdcryans.pdf