diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-10-18 18:10:03 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-10-18 18:10:03 (GMT) |
commit | 1bc858b1b889ae2d0eeca463646592d195db8c94 (patch) | |
tree | c4bacbd730fc23478d16bb36138c63b224403dbd /test/tfile.c | |
parent | 5d727f0acde67a5e43b31b1fd3d33f8552b59e2a (diff) | |
download | hdf5-1bc858b1b889ae2d0eeca463646592d195db8c94.zip hdf5-1bc858b1b889ae2d0eeca463646592d195db8c94.tar.gz hdf5-1bc858b1b889ae2d0eeca463646592d195db8c94.tar.bz2 |
[svn-r24331] Changes to track metadata read retries for metadata items with checksum.
Implement new public routine H5Fget_metadata_read_retries_info().
h5committested.
Diffstat (limited to 'test/tfile.c')
-rw-r--r-- | test/tfile.c | 833 |
1 files changed, 723 insertions, 110 deletions
diff --git a/test/tfile.c b/test/tfile.c index 200279c..65ae0bc 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -27,6 +27,7 @@ #include "H5Bprivate.h" #include "H5Pprivate.h" +#include "H5Iprivate.h" /* * This file needs to access private information from the H5F package. @@ -3566,13 +3567,15 @@ test_swmr_read(void) /**************************************************************** ** -** test_read_attempts(): -** This test checks whether the public routines H5Pset_read_attempts() -** and H5Pget_read_attempts() work properly. +** test_metadata_read_attempts(): +** This test checks whether the following two public routines work as +** specified in the reference manuals: +** H5Pset_metadata_read_attempts() +** H5Pget_metadata_read_attempts() ** *****************************************************************/ static void -test_read_attempts(void) +test_metadata_read_attempts(void) { hid_t fapl; /* File access property list */ hid_t file_fapl; /* The file's access property list */ @@ -3581,7 +3584,7 @@ test_read_attempts(void) herr_t ret; /* Generic return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing H5Fget/set_read_attempts()\n")); + MESSAGE(5, ("Testing H5Pget/set_metadata_read_attempts()\n")); /* * Set A: @@ -3594,40 +3597,40 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Get # of read attempts -- should be the default: 1 */ - ret = H5Pget_read_attempts(fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 1, "H5Pget_read_attempts"); + ret = H5Pget_metadata_read_attempts(fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 1, "H5Pget_metadata_read_attempts"); /* Set the # of read attempts to 0--should fail */ - ret = H5Pset_read_attempts(fapl, 0); - VERIFY(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 0); + VERIFY(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Set the # of read attempts to a # > 0--should succeed */ - ret = H5Pset_read_attempts(fapl, 9); - VERIFY(ret, 0, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + VERIFY(ret, 0, "H5Pset_metadata_read_attempts"); - /* Retrieve the # of read attempts -- should succeed and equal to 9 */ - ret = H5Pget_read_attempts(fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 9, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts -- should be 9 */ + ret = H5Pget_metadata_read_attempts(fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 9, "H5Pget_metadata_read_attempts"); - /* Set the # of read attempts to the non-SWMR access default: H5F_READ_ATTEMPTS --should succeed */ - ret = H5Pset_read_attempts(fapl, H5F_READ_ATTEMPTS); - CHECK(ret, FAIL, "H5Pget_read_attempts"); + /* Set the # of read attempts to the default for non-SWMR access: H5F_METADATA_READ_ATTEMPTS --should succeed */ + ret = H5Pset_metadata_read_attempts(fapl, H5F_METADATA_READ_ATTEMPTS); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); - /* Retrieve the # of read attempts -- should succeed and equal to H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); - /* Set the # of read attempts to the SWMR access default: H5F_SWMR_READ_ATEMPTS --should succeed */ - ret = H5Pset_read_attempts(fapl, H5F_SWMR_READ_ATTEMPTS); - VERIFY(ret, 0, "H5Pset_read_attempts"); + /* Set the # of read attempts to the default for SWMR access: H5F_SWMR_METADATA_READ_ATEMPTS --should succeed */ + ret = H5Pset_metadata_read_attempts(fapl, H5F_SWMR_METADATA_READ_ATTEMPTS); + VERIFY(ret, 0, "H5Pset_metadata_read_attempts"); - /* Retrieve the # of read attempts -- should succeed and equal to H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); ret = H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); @@ -3648,10 +3651,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3670,10 +3673,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Fget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Fget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3689,8 +3692,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 9); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open the file with SWMR access and fapl (non-default & set to 9) */ fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); @@ -3701,9 +3704,9 @@ test_read_attempts(void) CHECK(file_fapl, FAIL, "H5Fget_access_plist"); /* Retrieve the # of read attempts from file's fapl -- should be 9 */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 9, "H5Pget_read_attempts"); + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 9, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3719,8 +3722,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 1); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 1); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open the file with SWMR access and fapl (non-default & set to 1) */ fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); @@ -3730,10 +3733,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should succeed and equal to 1 */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 1, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be 1 */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 1, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3756,10 +3759,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3785,10 +3788,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3807,10 +3810,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3826,8 +3829,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 9); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open the file with SWMR access and fapl (non-default & set to 9) */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); @@ -3837,10 +3840,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3856,8 +3859,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 1); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 1); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open the file with SWMR access and fapl (non-default & set to 1) */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); @@ -3867,10 +3870,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should succeed and equal to 1 */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 1, "H5Fget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be 1 */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 1, "H5Fget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3893,10 +3896,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Pget_access_plist"); - /* Retrieve the # of read attempts from file's fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Fget_read_attempts"); + /* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Fget_metadata_read_attempts"); /* Close the file */ ret=H5Fclose(fid); @@ -3907,15 +3910,13 @@ test_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); - - /* Create a copy of file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 9); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Create a file */ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl); @@ -3933,10 +3934,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -3954,10 +3955,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -3992,8 +3993,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 9); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open file again with SWMR access and fapl (non-default & set to 9) */ fid2 = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); @@ -4007,10 +4008,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_SWMR_READ_ATTEMPTS, "H5Fget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Fget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4029,9 +4030,9 @@ test_read_attempts(void) CHECK(file_fapl, FAIL, "H5Fget_access_plist"); /* Retrieve the # of read attempts from file fapl -- should be 9 */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, 9, "H5Pget_read_attempts"); + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, 9, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4072,8 +4073,8 @@ test_read_attempts(void) CHECK(fapl, FAIL, "H5Pcreate"); /* Set the # of read attempts */ - ret = H5Pset_read_attempts(fapl, 9); - CHECK(ret, FAIL, "H5Pset_read_attempts"); + ret = H5Pset_metadata_read_attempts(fapl, 9); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); /* Open file again with non-SWMR access and fapl (non-default & set to 9) */ fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); @@ -4086,10 +4087,10 @@ test_read_attempts(void) /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Fget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Fget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4107,10 +4108,10 @@ test_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be H5F_READ_ATTEMPTS */ - ret = H5Pget_read_attempts(file_fapl, &attempts); - CHECK(ret, FAIL, "H5Pget_read_attempts"); - VERIFY(attempts, H5F_READ_ATTEMPTS, "H5Pget_read_attempts"); + /* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */ + ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); + CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4126,8 +4127,619 @@ test_read_attempts(void) ret=H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); +} /* end test_metadata_read_attempts() */ + +/**************************************************************** +** +** test_metadata_read_retries_info(): +** This test checks whether the public routine H5Fget_metadata_read_retries_info +** works as specified in the reference manual. +** +*****************************************************************/ +static void +test_metadata_read_retries_info(void) +{ + hid_t fapl, new_fapl; /* File access property list */ + hid_t fid, fid1; /* File IDs */ + H5F_retries_info_t info, info1; /* The collection of metadata retries */ + H5F_t *f = NULL, *f1 = NULL; /* Internal file object pointers */ + unsigned i, j, n; /* Local index variables */ + herr_t ret; /* Generic return value */ + hid_t did1, did2; /* Dataset IDs */ + hid_t sid; /* Dataspace ID */ + hid_t dcpl; /* Dataset creation property list */ + hsize_t dims[2] = {6, 10}; /* Dataset dimensions */ + int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */ + hsize_t max_dims_1un[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimensions */ + hsize_t max_dims_2un[2] = {500, H5S_UNLIMITED}; /* Dataset maximum dimensions */ + hsize_t chunk_dims[2] = {2, 2}; /* Chunk dimensions */ + + + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5Fget_metadata_read_retries_info()\n")); + + /* + * Set up file for testing + */ + /* Create a copy of file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create a file without SWMR access */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a chunked dataset with 1 unlimited dimension: extensible array indexing will be used */ + sid = H5Screate_simple(2, dims, max_dims_1un); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + ret = H5Pset_chunk(dcpl, 2, chunk_dims); + did1 = H5Dcreate2(fid, "DSET_1UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + + /* Create a chunked dataset with 2 unlimited dimension: v2 Btree indexing will be used */ + sid = H5Screate_simple(2, dims, max_dims_2un); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + ret = H5Pset_chunk(dcpl, 2, chunk_dims); + did2 = H5Dcreate2(fid, "DSET_2UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + + /* Initialize buffer data */ + for(i = n = 0; i < 6; i++) + for(j = 0; j < 10; j++) + buf[i][j] = n++; + + /* Write to the 2 datasets */ + ret = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + ret = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* Closing */ + ret = H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Case 1: tests on nbins + */ + /* + * Open a file without SWMR access, default # of read attempts-- + * info.nbins should be 0 + * info.retries should all be NULL + */ + /* Open the file without SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open the dataset */ + did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen"); + ret = H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1); + CHECK(ret, FAIL, "H5Dopen"); + + /* Open the dataset */ + did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT); + CHECK(did2, FAIL, "H5Dopen"); + ret = H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2); + CHECK(ret, FAIL, "H5Dopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 0 */ + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret=H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open a file with SWMR access, default # of read attempts-- + * info.nbins should be 2 + * info.retries should all be NULL + */ + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 2 */ + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + + /* + * Open a file with SWMR access, # of read_attempts is 10: + * info.nbins should be 1 + * info.retries should all be NULL + */ + new_fapl = H5Pcopy(fapl); + ret = H5Pset_metadata_read_attempts(new_fapl, 10); + CHECK(ret, FAIL, "H5Pset_metadatda_read_attempts"); + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 1 */ + VERIFY(info.nbins, 1, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open a file with SWMR access, # of read attempts is 101: + * info.nbins should be 3 + * info.retries should all be NULL + */ + new_fapl = H5Pcopy(fapl); + ret = H5Pset_metadata_read_attempts(new_fapl, 101); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 3 */ + VERIFY(info.nbins, 3, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open a file with SWMR access, # of read_attempts is 10000: + * info.nbins should be 4 + * info.retries should all be NULL + */ + new_fapl = H5Pcopy(fapl); + CHECK(new_fapl, FAIL, "H5Pcopy"); + + ret = H5Pset_metadata_read_attempts(new_fapl, 10000); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 4 */ + VERIFY(info.nbins, 4, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open a file with SWMR access, # of read_attempts is 1: + * info.nbins should be 0 + * info.retries should all be NULL + */ + new_fapl = H5Pcopy(fapl); + CHECK(new_fapl, FAIL, "H5Pcopy"); + + ret = H5Pset_metadata_read_attempts(new_fapl, 1); + CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 0 */ + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Closing */ + ret=H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + + + /* + * Case 2: tests on retries info + */ + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open the dataset */ + did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT); + CHECK(did1, FAIL, "H5Dopen"); + + /* Read data from the dataset */ + ret = H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1); + CHECK(ret, FAIL, "H5Dread"); + + /* Open the dataset */ + did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT); + CHECK(did2, FAIL, "H5Dopen"); + + /* Read data from the dataset */ + ret = H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2); + CHECK(ret, FAIL, "H5Dread"); + + /* Retrieve retries information */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 2 */ + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + + /* Get a pointer to the internal file object */ + f = (H5F_t *)H5I_object(fid); + CHECK(f, NULL, "H5I_object"); + + /* + * Increment 1st set of retries for metadata items: + * a) v2 B-tree leaf node--retries[4][1] + * b) Extensive array data block--retries[15][1] + * c) File's superblock--retries[20][0] + */ + + /* v2 B-tree leaf node: log retry 99 for 500 times */ + for(i = 0; i < 500; i++) { + ret = H5F_track_metadata_read_retries(f, H5AC_BT2_LEAF_ID, 99); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* Extensive array data block: log retry 10 for 1000 times */ + for(i = 0; i < 1000; i++) { + ret = H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 10); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* File's superblock: log retry 1 for 1 time */ + ret = H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + + /* Retrieve the collection of metadata read retries */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Verify retries for v2 B-tree leaf node */ + VERIFY(info.retries[4][0], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[4][1], 500, "H5Fget_metadata_read_retries"); + + /* Verify retries for extensive array data block */ + VERIFY(info.retries[15][0], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[15][1], 1000, "H5Fget_metadata_read_retries"); + + /* Verify retries for file's superblock */ + VERIFY(info.retries[20][0], 1, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[20][1], 0, "H5Fget_metadata_read_retries"); + + /* Free memory for info.retries */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + if(info.retries[i] != NULL) + HDfree(info.retries[i]); + } + + /* + * Increment 2nd set of retries for metadata items: + * a) Object header--retries[0][0] + * b) Extensive array datablock--retries[15][0] + * c) Fixed array header--retries[17][1] + * d) File's superblock--retries[20][0] + */ + + /* Object header: log retry 5 for 5 times */ + for(i = 0; i < 5; i++) { + ret = H5F_track_metadata_read_retries(f, H5AC_OHDR_ID, 5); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* Extensive array data block: log retry 4 for 1 time */ + ret = H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 4); + + /* Fixed array header : log retry 50 for 10000 times */ + for(i = 0; i < 10000; i++) { + ret = H5F_track_metadata_read_retries(f, H5AC_FARRAY_HDR_ID, 50); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* File's superblock: log retry 1 for 1 more time */ + ret = H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + + /* Retrieve the collection of metadata read retries */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* + * Verify info has both previous + current retries information: + */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + switch(i) { + case 0: /* Object header */ + VERIFY(info.retries[i][0], 5, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); + break; + + case 4: /* v2 B-tree leaf node */ + VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 500, "H5Fget_metadata_read_retries"); + break; + + case 15: /* Extensive array data block */ + VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 1000, "H5Fget_metadata_read_retries"); + break; + + case 17: /* Fixed array header */ + VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 10000, "H5Fget_metadata_read_retries"); + break; + + case 20: /* File's superblock */ + VERIFY(info.retries[i][0], 2, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); + break; + + default: + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + break; + } + } + + /* Free memory for info.retries */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + if(info.retries[i] != NULL) + HDfree(info.retries[i]); + } + + /* Closing */ + ret=H5Dclose(did1); + CHECK(ret, FAIL, "H5Dclose"); + ret=H5Dclose(did2); + CHECK(ret, FAIL, "H5Dclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Get a copy of the file access property list */ + new_fapl = H5Pcopy(fapl); + + /* Set the number of metadata read attempts to 101 */ + ret = H5Pset_metadata_read_attempts(new_fapl, 101); + + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Get a pointer to the internal file object */ + f = (H5F_t *)H5I_object(fid); + CHECK(f, NULL, "H5I_object"); + + /* File's superblock: log retry 1 for 1 time */ + H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1); + + /* Retrieve the collection of metadata read retries */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 3 */ + VERIFY(info.nbins, 3, "H5Fget_metadata_read_retries"); + + /* Verify retries info */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + switch(i) { + case 20: /* File's superblock */ + VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][2], 0, "H5Fget_metadata_read_retries"); + break; + + default: + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + break; + } + } + + /* Free memory */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + if(info.retries[i] != NULL) + HDfree(info.retries[i]); + } + + /* Closing */ + ret=H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Case 3: Tests on retrieving the collection of retries + * when H5Fopen and H5Freopen the same file. + */ + + /* + * Open a file without SWMR access, default # of read attempts-- + * H5Freopen the same file-- + * Both files should: + * nbins should be 0 + * retries should all be NULL + */ + /* Open the file without SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Re-open fid */ + fid1 = H5Freopen(fid); + CHECK(fid, FAIL, "H5Freopen"); + + /* Retrieve retries information for fid */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Retrieve retries information for fid1*/ + ret = H5Fget_metadata_read_retries_info(fid1, &info1); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Should be 0 */ + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); + VERIFY(info1.nbins, 0, "H5Fget_metadata_read_retries"); + + /* Should be all NULL */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + VERIFY(info1.retries[i], NULL, "H5Fget_metadata_read_retries"); + } + + /* Closing */ + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + ret=H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* + * Open a file with SWMR access, default # of read attempts: + * --increment retries for metadata item: fixed array data block page (retries[19][0]) + * H5Freopen the same file: + * --increment retries for metadata item: free-space sections (retries[9][1])-- + */ + /* Open the file with SWMR access */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Get a pointer to the internal file object for fid */ + f = (H5F_t *)H5I_object(fid); + CHECK(f, NULL, "H5I_object"); + + /* Re-open fid */ + fid1 = H5Freopen(fid); + CHECK(fid, FAIL, "H5Freopen"); + + /* Get a pointer to the internal file object for fid1 */ + f1 = (H5F_t *)H5I_object(fid1); + CHECK(f, NULL, "H5I_object"); + + /* For fid: fixed array data block page--log retry 9 for 500 times */ + for(i = 0; i < 500; i++) { + ret = H5F_track_metadata_read_retries(f, H5AC_FARRAY_DBLK_PAGE_ID, 9); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* For fid1: free-space sections--log retry 99 for 1000 times */ + for(i = 0; i < 1000; i++) { + ret = H5F_track_metadata_read_retries(f1, H5AC_FSPACE_SINFO_ID, 99); + CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); + } + + /* Retrieve the collection of metadata read retries for fid */ + ret = H5Fget_metadata_read_retries_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Retrieve the collection of metadata read retries for fid1 */ + ret = H5Fget_metadata_read_retries_info(fid1, &info1); + CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + + /* Verify nbins for fid & fid1: should be 2 */ + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); + VERIFY(info1.nbins, 2, "H5Fget_metadata_read_retries"); + + /* Verify retries for fid: fixed array data block page */ + VERIFY(info.retries[19][0], 500, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[19][1], 0, "H5Fget_metadata_read_retries"); + + /* Verify retries for fid: free-space sections should be NULL */ + VERIFY(info.retries[9], NULL, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[9], NULL, "H5Fget_metadata_read_retries"); + + /* Verify retries for fid1: free-space sections */ + VERIFY(info1.retries[9][0], 0, "H5Fget_metadata_read_retries"); + VERIFY(info1.retries[9][1], 1000, "H5Fget_metadata_read_retries"); + + /* Verify retries for fid1: fixed array data block page should be NULL */ + VERIFY(info1.retries[19], NULL, "H5Fget_metadata_read_retries"); + VERIFY(info1.retries[19], NULL, "H5Fget_metadata_read_retries"); + + /* Free memory for info.retries and info1.retries */ + for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + if(info.retries[i] != NULL) + HDfree(info.retries[i]); + if(info1.retries[i] != NULL) + HDfree(info1.retries[i]); + } + + /* Closing */ + ret=H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + ret=H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + ret=H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); -} /* end test_read_attempts() */ +} /* end test_metadata_read_retries_info() */ /**************************************************************** ** @@ -4314,7 +4926,8 @@ test_file(void) test_libver_macros2(); /* Test the macros for library version comparison */ test_swmr_write(); /* Tests for SWMR write access flag */ test_swmr_read(); /* Tests for SWMR read access flag */ - test_read_attempts(); /* Tests for public routine H5Fget/set_read_attempts() */ + test_metadata_read_attempts(); /* Tests for public routines H5Fget/set_metadata_read_attempts() */ + test_metadata_read_retries_info(); /* Tests for public routine H5Fget_metadata_read_retries_info() */ #ifndef H5_NO_DEPRECATED_SYMBOLS test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ |