mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Sync no longer requires clearing the past hash
It no longer assumes past hashes are valid if even a single unsynced block exists, which indicates a previous sync was interrupted. While this makes syncing slower after an interruption, it preserves the past hash in the content file, enabling a more reliable fix if a disk fails following an incomplete sync. This ensures the --import option remains functional even after an interrupted sync.
This commit is contained in:
parent
fd13d8e161
commit
fe82b48d96
7 changed files with 117 additions and 150 deletions
|
|
@ -1796,35 +1796,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
if (ret > 0)
|
||||
exit(EXIT_SYNC_NEEDED);
|
||||
} else if (operation == OPERATION_SYNC) {
|
||||
|
||||
/* in the next state read ensures to clear all the past hashes in case */
|
||||
/* we are reading from an incomplete sync */
|
||||
/* The indeterminate hash are only for CHG/DELETED blocks for which we don't */
|
||||
/* know if the previous interrupted sync was able to update or not the parity. */
|
||||
/* The sync process instead needs to trust this information because it's used */
|
||||
/* to avoid to recompute the parity if all the input are equals as before. */
|
||||
|
||||
/* In these cases we don't know if the old state is still the one */
|
||||
/* stored inside the parity, because after an aborted sync, the parity */
|
||||
/* may be or may be not have been updated with the data that may be now */
|
||||
/* deleted. Then we reset the hash to a bogus value. */
|
||||
|
||||
/* An example for CHG blocks is: */
|
||||
/* - One file is added creating a CHG block with ZERO state */
|
||||
/* - Sync aborted after updating the parity to the new state, */
|
||||
/* but without saving the content file representing this new BLK state. */
|
||||
/* - File is now deleted after the aborted sync */
|
||||
/* - Sync again, deleting the blocks over the CHG ones */
|
||||
/* with the hash of CHG blocks not representing the real parity state */
|
||||
|
||||
/* An example for DELETED blocks is: */
|
||||
/* - One file is deleted creating DELETED blocks */
|
||||
/* - Sync aborted after, updating the parity to the new state, */
|
||||
/* but without saving the content file representing this new EMPTY state. */
|
||||
/* - Another file is added again over the DELETE ones */
|
||||
/* with the hash of DELETED blocks not representing the real parity state */
|
||||
state.clear_past_hash = 1;
|
||||
|
||||
state_read(&state);
|
||||
|
||||
/* mark the files that have to be reallocated */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue