Do you know the write hole problem in raid?

Source: Internet
Author: User

RAID there will be a system called Write Hole question, what exactly is the problem? What are the implications for users? How does the current open source RAID system solve this problem? What is the way to solve such problems? Storage Old Wu from the perspective of research and development and everyone to analyze this problem, to see the nature of the problem and the solution of ideas.

Write Hole is a very image of the description. For a system with data protection by verifying data within a stripe, when the application is updating the stripe internal data, if the system suddenly loses power and the stripe data does not update properly, then the data part of the stripe will be updated to complete. In this case, when the system restarts, the data in the stripe is incomplete, the checksum data does not match the valid data in the stripe, and the stripe is in inconsistent data. This problem is called the Write Hole problem, as shown in:

650) this.width=650; "title=" 1.jpg "src=" Http:// " alt= "Wkiol1xwcatygszeaadgjf1ya2g532.jpg"/>

when updating the stripe data,D2 Datahas been updated intoD2 ', but the stripe checksum dataP,Qthe system was restarted due to a failure while the update was not completed. In this case, the stripe data is in an inconsistent state. After the system restarts, it is usuallyRAIDThe system is not aware of this inconsistent data stripe. In this case, if theD3 againIf a failure occurs, it is necessary to verify the dataPRecoveryD3. In the process of data recovery, the use of theD2 'data, then obviously the recovered data will be wrong, no longer the originalD3data. Therefore, the data inconsistency of the stripe will further introduce the problem of data correctness. ThatWrite HoleThe problem not only destroys the updated data, but also potentially affects the correctness of the data that is not updated, which in extreme cases affects the correctness of the entire band of data.

consider the occurrenceWrite Holeproblem, that is, when the stripe data is updated, the system suddenly loses power,RAIDThere are several bands of inconsistent data in the system. After the system restarts, the stripe that is inconsistent with these data can be repaired with the data inconsistency stripe in the way of full system scan. This is also the current manyRAIDThe methods commonly used in this system can prevent data inconsistency and the correctness of data not being updated. In theRAIDthe system typically hasSYNCfunction, when the system restarts illegally, you canSYNCfunction onRAIDCheck all the bands in and fix the data inconsistencies stripe. This way you can preventWrite Holeproblem, but it still leads toRAIDThe total loss of some data in the system.

in order to completely solve Write Hole problem, in the design RAID The following two ways can be used:

1, using the journal (log) design idea of file system, realize the atom processing of writing request

2, the use of non-volatile memory as a write cache, to achieve the purpose of atomic write operations

The two approaches are essentially similar, and the second is the optimization of the first. We know that when the file system is updated, in order to ensure the atomicity of the data update, we can use the log method to treat the data update operation as aTransaction (Business). That is, no matter how many times a data update operationIO, from the outside it is an atomic operation, which can be calledAtomic Write. WhenAtomic WriteIn the event of an intermediate process failure, the system can continue after a reboot to ensure that the data is either updated or not written at all, and there is no intermediate state. RAIDThe system wants to solveWrite Holeproblems, it is also necessary to introduce suchAtomic Writethe mechanism. The very direct idea is that every timeRAIDwhen the stripe data is updated, record the log, save the event type and related data, and then submit the data to the stripe, and then clear the log data after all the strip data has been updated. This way can guarantee the atomic write, even in the strip data update process of system failure, after the system restarts, through the log data can continue the writing process, to ensure that the stripe data completely updated, and in a consistent state of data.

The log looks perfect, but it can seriously affect performance. In a disk storage system, log updates are time-consuming, and an update requires multiple disk IO Operations, and if the log storage space and stripe storage space are physically discontinuous, disk jitter problems can be introduced, severely impacting performance. For flash storage systems, after the introduction of the log system, all data operations will introduce double data write operations, write amplification problems become very tricky. Therefore, in the open source RAID System, does not provide this kind of log operation, usually need the upper file system to solve this write hole problem. In the commercial RAID system, in order to guarantee the extreme data reliability, some system realizes this kind of log data update way, achieves Atomic Write 's purpose.

another way to be better than logging is to introduce non-volatile memory NVRAM . when the RAID data is updated, the data is first written to nonvolatile memory and then updated to the stripe after the data in the NVRAM has been aggregated. When the data in the stripe is updated, the data in the NVRAM is clear. In the process of stripe data Update, if the system is unexpectedly restarted, The data in the stripe will be updated again, there will be no intermediate data state and there will be no Write Hole the problem.

AdoptNVRAMThis method is more perfect.Write Holesolution to the problem. For hardRAID, often using a hot-spare battery or a super-capacitor to protectRAIDThe memory on the card is the function. So, and the softRAIDcompared to the hardRAIDThis is going to be a better one. In softRAIDcan be used in the system.PCIe NVRAMorNVDIMMto achieveRAIDnon-volatile data cache. Typically in a storage system, a softRAIDTo the file system, the upper-level application system ,NVRAMwill be shared with the file system to resolveWrite Holethe problem. EMCMany storage systems will use non-volatile memoryNVRAM, let the file system andRAIDto cooperate to avoidRAIDinWrite Hole'sstate.

Write Hole is a RAID a more difficult problem to solve, but with the help of the latest NVDIMM after the non-volatile memory technology, this kind of problem can be effectively avoided and solved.

This article is from the "Save the Way" blog, make sure to keep this source

Do you know the write hole problem in raid?

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: 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.