Commits
David Young committed 0fbd8654f7d
Prepare the VFD SWMR reader for a "floating" shadow index by overhauling the way that the shadow header and shadow index are loaded. In H5FD__vfd_swmr_load_hdr_and_idx(), adopt a new protocol for reading the shadow file: 0 If the maximum number of retries have been attempted, then exit with an error. 1 Try to read the shadow file *header*. If successful, continue to 2. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 2 If the tick number in the header is less than the tick last read by the VFD, then return an error. 3 If the tick number in the header is equal to the last tick read by the VFD, then exit without doing anything. 4 Try to read the shadow file *index*. If successful, continue to 5. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 5 If a different tick number was read from the index than from the index, then continue at 0. 6 Try to *re-read* the shadow file *header*. If successful, continue to 7. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 7 Compare the header that was read previously with the new header. If the new header is different than the old, then we may not have read the index at the right shadow-file offset, or the index may have been read in an inconsistent state, so sleep and retry at 0. Otherwise, return success. Simplify H5FD__vfd_swmr_header_deserialize() and H5FD__vfd_swmr_index_deserialize(). Remove their retry loops. Make each return TRUE on success, FALSE on an error that may be transient, and FAIL on an irrecoverable error. In H5FD__vfd_swmr_header_deserialize(), do not check the size of the shadow file with fstat(2), since the read(2) will fail if the file is too small. This saves us a system call. Lightly consti-ify H5FD__vfd_swmr_index_deserialize() arguments. In H5FD__vfd_swmr_load_hdr_and_idx(): Consolidate all of the retry-looping. Increase the initial retry delay from 1ns to 1/10s. Delete the disused maximum-retry constants. Use #if 0 to disable some error-checking code that ought to be unnecessary under the new protocol. Don't memset() the header and index header, but make sure they're fully initialized with real content, instead.