Checksum of HDFS data

Source: Internet
Author: User

Datanode verifies the data checksum before actually storing the data.

The client writes data to datanode through pipeline. The last datanode checks the checksum.

When the client reads data from datanode, it also checks and compares the checksum of the actual data and the checksum on the datanode of the contract.

 

Each datanode stores a persistent log for checksum verification. The log contains the last update time of each block of the current datanode.

When the client successfully verifies a block, it will tell datanode, and then datanode will update its log.

Saving this information helps detect bad disks.

 

In addition to verifying the block when the client reads data, each datanode also runs a datablockdown thread in the background to periodically verify all

Block on datanode. This is used to prevent "bit attenuation" on the physical storage media ".

 

Because HDFS stores multiple copies of the same block, it can replace the damaged data copies with good copies.

If a client detects a data error when reading data, it reports information to namenode before throwing a checksumexception.

And datanode. namenode will mark the specified block as "upt", and the client will no longer locate this block, and this block will not

After being copied to another datanode, namenode schedules a normal copy of the block to ensure load balancing. After that, the damaged block copy will be deleted.

 

You can call setverifychecksum () to disable checksum detection before calling open () for filesystem.

You can also specify the-ignorecrc option when running the-Get and-copytolocal commands in shell.

 

 

Localfilesystem has been tested and generated on the client side. If you write a file filename to HDFS, the client will

In the same path as filename, a hidden file named. filename. CRC containing all block checksum information is created transparently. The chunk size of the checksum is specified through the bytes. Per. checksum attribute,

The default value is 512 bytes. The chunk size is also stored in the metadata of the. CRC file, so the file can be correctly parsed even if bytes. Per. checksum is changed later.

The Checksum check is performed when the file is read. If an error occurs, localfilesystem throws a checksumexception.

 

From http://www.cnblogs.com/xuxm2007/archive/2011/06/28/2091887.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.