summaryrefslogtreecommitdiffstats
path: root/src/H5FDprivate.h
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-01-24 20:49:09 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-01-24 20:49:09 (GMT)
commit0fbd8654f7d5af36621cb4588936c16606bbe298 (patch)
tree5b5ece2acdc7aff07b1dda03ab23cbf677c8a143 /src/H5FDprivate.h
parent33ea1d2b066b1c8b26f6f2df386b5c9ced3a1dc5 (diff)
downloadhdf5-0fbd8654f7d5af36621cb4588936c16606bbe298.zip
hdf5-0fbd8654f7d5af36621cb4588936c16606bbe298.tar.gz
hdf5-0fbd8654f7d5af36621cb4588936c16606bbe298.tar.bz2
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.
Diffstat (limited to 'src/H5FDprivate.h')
-rw-r--r--src/H5FDprivate.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 2aba759..200ae44 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -81,8 +81,7 @@
/* Retries for metadata file */
#define H5FD_VFD_SWMR_MD_FILE_RETRY_MAX 50 /* Maximum retries when opening the MD file */
-#define H5FD_VFD_SWMR_MD_LOAD_RETRY_MAX 20 /* Maximum retries when trying to load the MD file header and index */
-#define H5FD_VFD_SWMR_MD_HEADER_RETRY_MAX 40 /* Maximum retries when deserializing the MD file header */
+#define H5FD_VFD_SWMR_MD_LOAD_RETRY_MAX 120 /* Maximum retries when trying to load the MD file header and index */
#define H5FD_VFD_SWMR_MD_INDEX_RETRY_MAX 5 /* Maximum retries when deserializing the MD file index */