diff options
author | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2021-11-17 17:25:20 (GMT) |
---|---|---|
committer | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2021-11-17 17:25:20 (GMT) |
commit | 97a37aa84913808792418e6814126bdee856288e (patch) | |
tree | e613e8f34a3988777909e0fa813dd8b7ee60df44 /test | |
parent | f3293556b7af7191496909f4577e983da19a9e68 (diff) | |
download | hdf5-97a37aa84913808792418e6814126bdee856288e.zip hdf5-97a37aa84913808792418e6814126bdee856288e.tar.gz hdf5-97a37aa84913808792418e6814126bdee856288e.tar.bz2 |
1) Core changes for adding NFS/updater support as described in the RFC.
src/H5Pfapl.c
src/H5Fvfd_swmr.c
src/H5Fpublic.h
src/H5Fpkg.h
src/H5Fprivate.h
2) For VFD SWMR testing, add private property for checksum generation of metadata files:
src/H5Fint.c
src/H5Fvfd_swmr.c
src/H5Pfapl.c
src/H5Fpkg.h
src/H5Fprivate.h
3) Fix the following in H5F_vfd_swmr_init() and H5F_vfd_swmr_close_or_flush():
(a) Allocate metadata file index right after metadata file header.
(b) Set tick number to 0 when creating header and index for file open case.
(c) Remove tick number increment at file close.
src/H5Fvfd_swmr.c
src/H5Ftest.c
4) To be consistent with the RFC, change the name for field "chksum" to "checksum" in struct H5FD_vfd_swmr_idx_entry_t:
src/H5FDprivate.h
src/H5FDtest.c
src/H5FDvfd_swmr.c
src/H5Ftest.c
src/H5PB.c
4) Add tests for NFS/updater
test/vfd_swmr.c
5) Modify common routine init_vfd_swmr_config() to accept updater_file_path
test/vfd_swmr_common.c
test/vfd_swmr_common.h
6) Changes to the tests due to the common routine init_vfd_swmr_config():
test/vfd_swmr_addrem_writer.c
test/vfd_swmr_attrdset_writer.c
test/vfd_swmr_bigset_writer.c
test/vfd_swmr_dsetchks_writer.c
test/vfd_swmr_dsetops_writer.c
test/vfd_swmr_generator.c
test/vfd_swmr_gfail_writer.c
test/vfd_swmr_gperf_writer.c
test/vfd_swmr_group_writer.c
test/vfd_swmr_reader.c
test/vfd_swmr_remove_reader.c
test/vfd_swmr_remove_writer.c
test/vfd_swmr_sparse_reader.c
test/vfd_swmr_sparse_writer.c
test/vfd_swmr_vlstr_reader.c
test/vfd_swmr_vlstr_writer.c
test/vfd_swmr_writer.c
test/page_buffer.c
Diffstat (limited to 'test')
-rw-r--r-- | test/page_buffer.c | 2 | ||||
-rw-r--r-- | test/vfd_swmr.c | 1378 | ||||
-rw-r--r-- | test/vfd_swmr_addrem_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_attrdset_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_bigset_writer.c | 6 | ||||
-rw-r--r-- | test/vfd_swmr_common.c | 13 | ||||
-rw-r--r-- | test/vfd_swmr_common.h | 8 | ||||
-rw-r--r-- | test/vfd_swmr_dsetchks_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_dsetops_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_generator.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_gfail_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_gperf_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_group_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_reader.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_remove_reader.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_remove_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_sparse_reader.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_sparse_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_vlstr_reader.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_vlstr_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_writer.c | 5 | ||||
-rw-r--r-- | test/vfd_swmr_zoo_writer.c | 5 |
22 files changed, 1245 insertions, 247 deletions
diff --git a/test/page_buffer.c b/test/page_buffer.c index 61e9696..53c9b74 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -101,6 +101,8 @@ swmr_fapl_augment(hid_t fapl, const char *filename, uint32_t max_lag) .tick_len = 4, .max_lag = max_lag, .writer = true, + .maintain_metadata_file = true, + .generate_updater_files = false, .md_pages_reserved = 128}; char * bname = NULL; char * dname = NULL; diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index 3ed73c1..e93a399 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -41,6 +41,7 @@ #define FS_PAGE_SIZE 512 #define FILENAME "vfd_swmr_file.h5" #define MD_FILENAME "vfd_swmr_metadata_file" +#define UD_FILENAME "vfd_swmr_updater_file" #define FILENAME2 "vfd_swmr_file2.h5" #define MD_FILENAME2 "vfd_swmr_metadata_file2" @@ -48,61 +49,50 @@ #define FILENAME3 "vfd_swmr_file3.h5" #define MD_FILENAME3 "vfd_swmr_metadata_file3" +#define FILENAME4 "vfd_swmr_file4.h5" +#define MD_FILE "vfd_swmr_md_file" +#define UD_FILE "vfd_swmr_ud_file" + #define FNAME "non_vfd_swmr_file.h5" -/* test routines for VFD SWMR */ -static unsigned test_fapl(void); -static unsigned test_file_end_tick(void); -static unsigned test_file_fapl(void); -static unsigned test_writer_md(void); +/* Defines used by verify_updater_flags() and verify_ud_chk() helper routine */ -/* helper routines */ -static hid_t init_vfd_swmr_config_fapl(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, - hbool_t is_writer, uint32_t md_pages_reserved, - const char *md_file_path, size_t pbuf_size); +/* Offset of "flags" in updater file header */ +#define UD_HD_FLAGS_OFFSET 6 -/*------------------------------------------------------------------------- - * Function: init_vfd_swmr_config_fapl - * - * Purpose: Helper routine to initialize the fields for VFD SWMR configuration - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static hid_t -init_vfd_swmr_config_fapl(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, - hbool_t is_writer, uint32_t md_pages_reserved, const char *md_file_path, - size_t pbuf_size) -{ - hid_t fapl; +/* Offset of "sequence number" in updater file header */ +#define UD_HD_SEQ_NUM_OFFSET 12 - HDmemset(config, 0, sizeof(*config)); +/* Offset of "change list length" in updater file header */ +#define UD_HD_CHANGE_LIST_LEN_OFFSET 36 - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = tick_len; - config->max_lag = max_lag; - config->writer = is_writer; - config->md_pages_reserved = md_pages_reserved; - HDstrcpy(config->md_file_path, md_file_path); +/* Offset of "number of change list entries" in updater file change list header */ +#define UD_CL_NUM_CHANGE_LIST_ENTRIES_OFFSET H5F_UD_HEADER_SIZE + 44 - /* Create a copy of the file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return H5I_INVALID_HID; +/* Size of "sequence number", "tick number" and "change list length" fields in the updater file header */ +#define UD_SIZE_8 8 - if (H5Pset_vfd_swmr_config(fapl, config) < 0) { - (void)H5Pclose(fapl); - return H5I_INVALID_HID; - } +/* Size of checksum and "number of change list entries" field in the updater change list header */ +#define UD_SIZE_4 4 - /* Enable page buffering */ - if (pbuf_size != 0 && H5Pset_page_buffer_size(fapl, pbuf_size, 0, 0) < 0) { - (void)H5Pclose(fapl); - return H5I_INVALID_HID; - } +/* Size of "flags" field in the updater file header */ +#define UD_SIZE_2 2 + +/* test routines for VFD SWMR */ +static unsigned test_fapl(void); +static unsigned test_file_end_tick(void); +static unsigned test_file_fapl(void); +static unsigned test_writer_md(void); + +static unsigned test_updater_flags(void); +static unsigned test_updater_flags_same_file_opens(void); +static herr_t verify_updater_flags(char *ud_name, uint16_t expected_flags); + +static void clean_chk_ud_files(char *md_file_path, char *updater_file_path); +static herr_t verify_ud_chk(char *md_file_path, char *ud_file_path); +static herr_t md_ck_cb(char *md_file_path, uint64_t tick_num); +static unsigned test_updater_generate_md_checksums(hbool_t file_create); - return fapl; -} /* init_vfd_swmr_config_fapl() */ /*------------------------------------------------------------------------- * Function: test_fapl() @@ -114,6 +104,12 @@ init_vfd_swmr_config_fapl(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint * --max_lag: should be >= 3 * --md_pages_reserved: should be >= 2 * --md_file_path: should contain the metadata file path (POSIX) + * --at least one of maintain_metadata_file and generate_updater_files + * must be true + * --if both the writer and maintain_metadata_file fields are true, + * then md_file_path field shouldn't be empty + * --if both the writer and generate_updater_files fields are true, + * then updater_file_path field shouldn't be empty * B) Verify that info set in the fapl is retrieved correctly. * * Return: 0 if test is sucessful @@ -195,9 +191,40 @@ test_fapl(void) if (ret >= 0) TEST_ERROR; + my_config->writer = TRUE; + /* Should fail: at least one of maintain_metadata_file and generate_updater_files must be true */ + H5E_BEGIN_TRY + { + ret = H5Pset_vfd_swmr_config(fapl, my_config); + } + H5E_END_TRY; + if (ret >= 0) + TEST_ERROR; + + my_config->writer = TRUE; + my_config->maintain_metadata_file = TRUE; + /* Should fail: empty md_file_path */ + H5E_BEGIN_TRY + { + ret = H5Pset_vfd_swmr_config(fapl, my_config); + } + H5E_END_TRY; + if (ret >= 0) + TEST_ERROR; + + my_config->generate_updater_files = TRUE; + /* Should fail: empty updater_file_path */ + H5E_BEGIN_TRY + { + ret = H5Pset_vfd_swmr_config(fapl, my_config); + } + H5E_END_TRY; + if (ret >= 0) + TEST_ERROR; + /* Set md_file_path */ HDstrcpy(my_config->md_file_path, MD_FILENAME); - my_config->writer = TRUE; + my_config->generate_updater_files = FALSE; /* Should succeed in setting the configuration info */ if (H5Pset_vfd_swmr_config(fapl, my_config) < 0) @@ -215,6 +242,33 @@ test_fapl(void) TEST_ERROR; if (my_config->md_pages_reserved != 2) TEST_ERROR; + if (my_config->generate_updater_files) + TEST_ERROR; + if (HDstrcmp(my_config->md_file_path, MD_FILENAME) != 0) + TEST_ERROR; + + my_config->generate_updater_files = TRUE; + /* Set updater_file_path */ + HDstrcpy(my_config->updater_file_path, UD_FILENAME); + + /* Should succeed in setting the configuration info */ + if (H5Pset_vfd_swmr_config(fapl, my_config) < 0) + TEST_ERROR; + + /* Clear the configuration structure */ + HDmemset(my_config, 0, sizeof(H5F_vfd_swmr_config_t)); + + /* Retrieve the configuration info just set */ + if (H5Pget_vfd_swmr_config(fapl, my_config) < 0) + TEST_ERROR; + + /* Verify the configuration info */ + if (!my_config->generate_updater_files) + TEST_ERROR; + if (HDstrcmp(my_config->updater_file_path, UD_FILENAME) != 0) + TEST_ERROR; + if (!my_config->maintain_metadata_file) + TEST_ERROR; if (HDstrcmp(my_config->md_file_path, MD_FILENAME) != 0) TEST_ERROR; @@ -290,8 +344,17 @@ test_file_fapl(void) if ((file_config = (H5F_vfd_swmr_config_t *)HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) FAIL_STACK_ERROR; - /* Configured as VFD SWMR reader + no page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 6, FALSE, 2, MD_FILENAME, 0); + + /* + * Configured as VFD SWMR reader + no page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, FALSE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 0, config1); if (fapl1 == H5I_INVALID_HID) TEST_ERROR @@ -307,8 +370,17 @@ test_file_fapl(void) if (H5Pclose(fapl1) < 0) FAIL_STACK_ERROR - /* Configured as VFD SWMR writer + no page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 6, TRUE, 2, MD_FILENAME, 0); + /* + * Configured as VFD SWMR writer + no page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 0, config1); + if (fapl1 == H5I_INVALID_HID) TEST_ERROR @@ -321,13 +393,10 @@ test_file_fapl(void) if (fid >= 0) TEST_ERROR; - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR - - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; + } /* Should fail to create: no page buffering */ H5E_BEGIN_TRY @@ -341,8 +410,17 @@ test_file_fapl(void) if (H5Pclose(fapl1) < 0) FAIL_STACK_ERROR - /* Configured as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 6, TRUE, 2, MD_FILENAME, 4096); + /* + * Configured as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 7, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) TEST_ERROR @@ -404,8 +482,17 @@ test_file_fapl(void) if (H5Pclose(fapl1) < 0) FAIL_STACK_ERROR; - /* Set up different VFD SWMR configuration + page_buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 4, 10, TRUE, 2, MD_FILENAME, 4096); + /* + * Set up different VFD SWMR configuration + page_buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); + if (fapl2 == H5I_INVALID_HID) TEST_ERROR @@ -435,10 +522,20 @@ test_file_fapl(void) /* The file previously opened as VDF SWMR writer is still open */ /* with VFD SWMR configuration in config2 */ - /* Set up as VFD SWMR writer in config1 but different from config2 */ - fapl1 = init_vfd_swmr_config_fapl(config1, 3, 8, TRUE, 3, MD_FILENAME, 4096); + + /* + * Set up as VFD SWMR writer in config1 but different from config2 + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 3, 8, TRUE, TRUE, FALSE, TRUE, 3, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) - TEST_ERROR; + TEST_ERROR /* Re-open the same file with config1 */ /* Should fail to open since config1 is different from config2 setting */ @@ -454,10 +551,17 @@ test_file_fapl(void) if (H5Pclose(fapl1) < 0) FAIL_STACK_ERROR; - /* Set up as VFD SWMR reader in config1 which is same as config2 */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 10, TRUE, 2, MD_FILENAME, 4096); + /* + * Set up as VFD SWMR reader in config1 which is same as config2 + */ + + init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) - TEST_ERROR; + TEST_ERROR /* Re-open the same file as VFD SWMR writer */ /* Should succeed since config1 is same as the setting in config2 */ @@ -530,6 +634,7 @@ error: return 1; } /* test_file_fapl() */ + /*------------------------------------------------------------------------- * Function: test_file_end_tick() * @@ -589,28 +694,52 @@ test_file_end_tick(void) if ((config3 = HDmalloc(sizeof(*config3))) == NULL) FAIL_STACK_ERROR; - /* Configured file 1 as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 10, 15, TRUE, 2, MD_FILENAME, 4096); + /* + * Configured file 1 as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 10, 15, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) - FAIL_STACK_ERROR; + TEST_ERROR + + /* + * Configured file 2 as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 5, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); - /* Configured file 2 as VFD SWMR writer + page buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 5, 6, TRUE, 2, MD_FILENAME2, 4096); if (fapl2 == H5I_INVALID_HID) - FAIL_STACK_ERROR; + TEST_ERROR - /* Configured file 3 as VFD SWMR writer + page buffering */ - fapl3 = init_vfd_swmr_config_fapl(config3, 3, 6, TRUE, 2, MD_FILENAME3, 4096); - if (fapl3 == H5I_INVALID_HID) - FAIL_STACK_ERROR; + /* + * Configured file 3 as VFD SWMR writer + page buffering + */ - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config3, 3, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME3, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl3 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config3); + + if (fapl3 == H5I_INVALID_HID) + TEST_ERROR - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create file 1 with VFD SWMR writer */ if ((fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl1)) < 0) @@ -776,18 +905,23 @@ test_writer_create_open_flush(void) if ((my_config = HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) FAIL_STACK_ERROR; - /* Set up the VFD SWMR configuration + page buffering */ - fapl = init_vfd_swmr_config_fapl(my_config, 1, 3, TRUE, 2, MD_FILENAME, 4096); - if (fapl == H5I_INVALID_HID) - FAIL_STACK_ERROR; + /* + * Set up the VFD SWMR configuration + page buffering + */ - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(my_config, 1, 3, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, my_config); + if (fapl == H5I_INVALID_HID) + TEST_ERROR + + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create an HDF5 file with VFD SWMR configured */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) @@ -797,7 +931,6 @@ test_writer_create_open_flush(void) if (H5F__vfd_swmr_writer_create_open_flush_test(fid, TRUE) < 0) FAIL_STACK_ERROR; -#ifdef LATER /* Will activate the test when flush is implemented */ /* Flush the HDF5 file */ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) FAIL_STACK_ERROR @@ -805,7 +938,6 @@ test_writer_create_open_flush(void) /* Verify info in metadata file when flushing the HDF5 file */ if (H5F__vfd_swmr_writer_create_open_flush_test(fid, FALSE) < 0) FAIL_STACK_ERROR -#endif /* Close the file */ if (H5Fclose(fid) < 0) @@ -891,6 +1023,7 @@ test_writer_md(void) hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ H5FD_vfd_swmr_idx_entry_t *index = NULL; /* Pointer to the index entries */ H5F_vfd_swmr_config_t * my_config = NULL; /* Configuration for VFD SWMR */ + H5F_t * f = NULL; /* Internal file object pointer */ TESTING("Verify the metadata file for VFD SWMR writer"); @@ -898,25 +1031,28 @@ test_writer_md(void) if ((my_config = HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) FAIL_STACK_ERROR; - /* Set up the VFD SWMR configuration + page buffering */ - fapl = init_vfd_swmr_config_fapl(my_config, 1, 3, TRUE, 256, MD_FILENAME, FS_PAGE_SIZE); - if (fapl == H5I_INVALID_HID) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(my_config, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, my_config); + if (fapl == H5I_INVALID_HID) + TEST_ERROR - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; - if (H5Pset_file_space_page_size(fcpl, FS_PAGE_SIZE) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, FS_PAGE_SIZE)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create an HDF5 file with VFD SWMR configured */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; + /* Get a pointer to the internal file object */ + if (NULL == (f = (H5F_t *)H5VL_object(fid))) + FAIL_STACK_ERROR; + /* Allocate num_entries for the data buffer */ if ((buf = HDcalloc(num_entries, FS_PAGE_SIZE)) == NULL) FAIL_STACK_ERROR; @@ -932,6 +1068,7 @@ test_writer_md(void) index[i].md_file_page_offset = 1 + (num_entries - i) * 5; index[i].length = (uint32_t)FS_PAGE_SIZE; index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = f->shared->tick_num; } /* Update with index and verify info in the metadata file */ @@ -970,8 +1107,10 @@ test_writer_md(void) } /* (B) Update every other entry in the index */ - for (i = 0; i < num_entries; i += 2) + for (i = 0; i < num_entries; i += 2) { index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = f->shared->tick_num; + } /* Update with index and verify info in the metadata file */ /* Also verify that 5 entries will be on the delayed list */ @@ -1007,8 +1146,10 @@ test_writer_md(void) } /* (C) Update every 3 entry in the index */ - for (i = 0; i < num_entries; i += 3) + for (i = 0; i < num_entries; i += 3) { index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = f->shared->tick_num; + } /* Update with index and verify info in the metadata file */ /* Also verify that 4 entries will be on the delayed list */ @@ -1042,7 +1183,9 @@ test_writer_md(void) /* (D) Update two entries in the index */ index[1].entry_ptr = &buf[1 * FS_PAGE_SIZE]; + index[1].tick_of_last_change = f->shared->tick_num; index[5].entry_ptr = &buf[5 * FS_PAGE_SIZE]; + index[5].tick_of_last_change = f->shared->tick_num; /* Update with index and verify info in the metadata file */ /* Also verify that 2 entries will be on the delayed list */ @@ -1202,21 +1345,23 @@ test_reader_md_concur(void) if ((config_writer = HDmalloc(sizeof(*config_writer))) == NULL) FAIL_STACK_ERROR; - /* Set up the VFD SWMR configuration + page buffering */ - fapl_writer = init_vfd_swmr_config_fapl(config_writer, 1, 3, TRUE, 256, MD_FILENAME, FS_PAGE_SIZE); - if (fapl_writer == H5I_INVALID_HID) - FAIL_STACK_ERROR; + /* + * Set up the VFD SWMR configuration + page buffering + */ - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); + if (fapl_writer == H5I_INVALID_HID) + TEST_ERROR - if (H5Pset_file_space_page_size(fcpl, FS_PAGE_SIZE) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, FS_PAGE_SIZE)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create an HDF5 file with VFD SWMR configured */ if ((fid_writer = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl_writer)) < 0) @@ -1276,10 +1421,19 @@ test_reader_md_concur(void) if ((config_reader = HDmalloc(sizeof(*config_reader))) == NULL) HDexit(EXIT_FAILURE); - /* Set up the VFD SWMR configuration as reader + page buffering */ - fapl_reader = init_vfd_swmr_config_fapl(config_reader, 1, 3, FALSE, 256, MD_FILENAME, FS_PAGE_SIZE); + /* + * Set up the VFD SWMR configuration as reader + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); + if (fapl_reader == H5I_INVALID_HID) - HDexit(EXIT_FAILURE); + TEST_ERROR /* Open the test file as reader */ if ((fid_reader = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl_reader)) < 0) @@ -1479,6 +1633,9 @@ test_reader_md_concur(void) if ((fid_writer = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_writer)) < 0) FAIL_STACK_ERROR; + /* Get the file pointer */ + file_writer = H5VL_object(fid_writer); + /* Send notification 1 to reader to start verfication */ notify = 1; if (HDwrite(parent_pfd[1], ¬ify, sizeof(int)) < 0) @@ -1544,11 +1701,9 @@ test_reader_md_concur(void) index[i].md_file_page_offset = 1 + (num_entries - i) * 5; index[i].length = (uint32_t)FS_PAGE_SIZE; index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = file_writer->shared->tick_num; } - /* Get the file pointer */ - file_writer = H5VL_object(fid_writer); - /* Update the metadata file with the index */ if (H5F_update_vfd_swmr_metadata_file(file_writer, num_entries, index) < 0) TEST_ERROR; @@ -1605,8 +1760,10 @@ test_reader_md_concur(void) /* Update 3 entries in the index */ num_entries = 3; - for (i = 0; i < num_entries; i++) + for (i = 0; i < num_entries; i++) { index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = file_writer->shared->tick_num; + } /* Update the metadata file with the index */ if (H5F_update_vfd_swmr_metadata_file(file_writer, num_entries, index) < 0) @@ -1658,8 +1815,10 @@ test_reader_md_concur(void) /* Update 5 entries in the index */ num_entries = 5; - for (i = 0; i < num_entries; i++) + for (i = 0; i < num_entries; i++) { index[i].entry_ptr = &buf[i * FS_PAGE_SIZE]; + index[i].tick_of_last_change = file_writer->shared->tick_num; + } /* Update the metadata file with the index */ if (H5F_update_vfd_swmr_metadata_file(file_writer, num_entries, index) < 0) @@ -1816,16 +1975,10 @@ test_multiple_file_opens_concur(void) TESTING("EOT queue entries when opening files concurrently with VFD SWMR"); - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR - - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; - - if (H5Pset_file_space_page_size(fcpl, FS_PAGE_SIZE) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, FS_PAGE_SIZE)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create file A */ if ((fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) @@ -1886,7 +2039,14 @@ test_multiple_file_opens_concur(void) HDexit(EXIT_FAILURE); /* Set the VFD SWMR configuration in fapl_writer + page buffering */ - fapl_writer = init_vfd_swmr_config_fapl(config_writer, 1, 3, TRUE, 256, MD_FILENAME2, FS_PAGE_SIZE); + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME2, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); + if (fapl_writer == H5I_INVALID_HID) HDexit(EXIT_FAILURE); @@ -1948,8 +2108,13 @@ test_multiple_file_opens_concur(void) if ((config1 = HDmalloc(sizeof(*config1))) == NULL) FAIL_STACK_ERROR - /* Set the VFD SWMR configuration in fapl1 + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 7, 10, TRUE, 256, MD_FILENAME, FS_PAGE_SIZE); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 7, 10, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR @@ -1986,8 +2151,13 @@ test_multiple_file_opens_concur(void) if ((config2 = HDmalloc(sizeof(*config2))) == NULL) FAIL_STACK_ERROR - /* Set the VFD SWMR configuration in fapl2 + page buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 1, 3, FALSE, 256, MD_FILENAME2, FS_PAGE_SIZE); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME2, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config2); + if (fapl2 == H5I_INVALID_HID) FAIL_STACK_ERROR @@ -2120,21 +2290,24 @@ test_disable_enable_eot_concur(void) if ((config_writer = HDmalloc(sizeof(*config_writer))) == NULL) FAIL_STACK_ERROR; - /* Set up the VFD SWMR configuration + page buffering */ - fapl_writer = init_vfd_swmr_config_fapl(config_writer, 1, 3, TRUE, 256, MD_FILENAME, FS_PAGE_SIZE); - if (fapl_writer == H5I_INVALID_HID) - FAIL_STACK_ERROR; + /* + * Set up the VFD SWMR configuration + page buffering + */ - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); - if (H5Pset_file_space_page_size(fcpl, FS_PAGE_SIZE) < 0) - FAIL_STACK_ERROR; + if (fapl_writer == H5I_INVALID_HID) + FAIL_STACK_ERROR + + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, FS_PAGE_SIZE)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); + FAIL_STACK_ERROR + } /* Create an HDF5 file with VFD SWMR configured */ if ((fid_writer = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl_writer)) < 0) @@ -2197,10 +2370,19 @@ test_disable_enable_eot_concur(void) if ((config_reader = HDmalloc(sizeof(*config_reader))) == NULL) HDexit(EXIT_FAILURE); - /* Set up the VFD SWMR configuration as reader + page buffering */ - fapl_reader = init_vfd_swmr_config_fapl(config_reader, 1, 3, FALSE, 256, MD_FILENAME, FS_PAGE_SIZE); + /* + * Set up the VFD SWMR configuration as reader + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); + if (fapl_reader == H5I_INVALID_HID) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR /* Open the test file as reader */ if ((fid_reader = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl_reader)) < 0) @@ -2400,21 +2582,24 @@ test_file_end_tick_concur(void) if ((config_writer = HDmalloc(sizeof(*config_writer))) == NULL) FAIL_STACK_ERROR; - /* Set up the VFD SWMR configuration + page buffering */ - fapl_writer = init_vfd_swmr_config_fapl(config_writer, 1, 3, TRUE, 256, MD_FILENAME, FS_PAGE_SIZE); - if (fapl_writer == H5I_INVALID_HID) - FAIL_STACK_ERROR; + /* + * Set up the VFD SWMR configuration + page buffering + */ - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_writer, 1, 3, TRUE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_writer = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_writer); - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) + if (fapl_writer == H5I_INVALID_HID) FAIL_STACK_ERROR; - if (H5Pset_file_space_page_size(fcpl, FS_PAGE_SIZE) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, FS_PAGE_SIZE)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create an HDF5 file with VFD SWMR configured */ if ((fid_writer = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl_writer)) < 0) @@ -2477,10 +2662,15 @@ test_file_end_tick_concur(void) if ((config_reader = HDmalloc(sizeof(*config_reader))) == NULL) HDexit(EXIT_FAILURE); - /* Set up the VFD SWMR configuration as reader + page buffering */ - fapl_reader = init_vfd_swmr_config_fapl(config_reader, 1, 3, FALSE, 256, MD_FILENAME, FS_PAGE_SIZE); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config_reader, 1, 3, FALSE, TRUE, FALSE, TRUE, 256, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl_reader = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, FS_PAGE_SIZE, config_reader); + if (fapl_reader == H5I_INVALID_HID) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR /* Open the test file as reader */ if ((fid_reader1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl_reader)) < 0) @@ -2667,23 +2857,33 @@ test_multiple_file_opens(void) if ((config2 = HDmalloc(sizeof(*config2))) == NULL) FAIL_STACK_ERROR; - /* Configured as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 6, TRUE, 2, MD_FILENAME, 4096); + /* + * Configured as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* Configured as VFD SWMR writer + page buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 4, 6, TRUE, 2, MD_FILENAME2, 4096); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); + if (fapl2 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR - - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR; + } /* Create a file without VFD SWMR */ if ((fid = H5Fcreate(FNAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2854,13 +3054,10 @@ test_same_file_opens(void) if ((config2 = HDmalloc(sizeof(*config2))) == NULL) FAIL_STACK_ERROR; - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR - - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; + } /* * Tests for first column @@ -2874,8 +3071,17 @@ test_same_file_opens(void) if (H5Fclose(fid) < 0) FAIL_STACK_ERROR; - /* Set the VFD SWMR configuration in fapl1 + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 10, TRUE, 2, MD_FILENAME, 4096); + /* + * Set the VFD SWMR configuration in fapl1 + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; @@ -2893,8 +3099,17 @@ test_same_file_opens(void) if (H5Fclose(fid2) < 0) FAIL_STACK_ERROR; - /* Set the VFD SWMR configuration in fapl2 + page buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 3, 8, FALSE, 3, MD_FILENAME, 4096); + /* + * Set the VFD SWMR configuration in fapl2 + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 3, 8, FALSE, TRUE, FALSE, TRUE, 3, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); + if (fapl2 == H5I_INVALID_HID) FAIL_STACK_ERROR; @@ -2939,8 +3154,18 @@ test_same_file_opens(void) * Tests for second column */ - /* Set up as VFD SWMR reader + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 10, FALSE, 2, MD_FILENAME, 4096); + + /* + * Set up as VFD SWMR reader + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, FALSE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; @@ -2967,8 +3192,17 @@ test_same_file_opens(void) if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Set up as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 10, TRUE, 2, MD_FILENAME, 4096); + /* + * Set up as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; @@ -3014,8 +3248,17 @@ test_same_file_opens(void) if ((fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Set up as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 10, TRUE, 2, MD_FILENAME, 4096); + /* + * Set up as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; @@ -3216,28 +3459,52 @@ test_enable_disable_eot(void) if ((config3 = HDmalloc(sizeof(*config3))) == NULL) FAIL_STACK_ERROR; - /* Configured first file as VFD SWMR writer + page buffering */ - fapl1 = init_vfd_swmr_config_fapl(config1, 4, 6, TRUE, 2, MD_FILENAME, 4096); + /* + * Configured first file as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + if (fapl1 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* Configured second file as VFD SWMR writer + page buffering */ - fapl2 = init_vfd_swmr_config_fapl(config2, 4, 6, TRUE, 2, MD_FILENAME2, 4096); + /* + * Configured second file as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config2, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME2, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl2 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config2); + if (fapl2 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* Configured third file as VFD SWMR writer + page buffering */ - fapl3 = init_vfd_swmr_config_fapl(config3, 4, 6, TRUE, 2, MD_FILENAME3, 4096); + /* + * Configured third file as VFD SWMR writer + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config3, 4, 6, TRUE, TRUE, FALSE, TRUE, 2, MD_FILENAME3, NULL); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl3 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config3); + if (fapl3 == H5I_INVALID_HID) FAIL_STACK_ERROR; - /* Create a copy of the file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); FAIL_STACK_ERROR - - /* Set file space strategy */ - if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - FAIL_STACK_ERROR; + } /* Create a file without VFD SWMR */ if ((fid = H5Fcreate(FNAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3425,6 +3692,703 @@ error: } /* test_enable_disable_eot() */ /*------------------------------------------------------------------------- + * Function: verify_updater_flags() + * + * Purpose: This is the helper routine used to verify whether + * "flags" in the updater file is as expected. + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static herr_t +verify_updater_flags(char *ud_name, uint16_t expected_flags) +{ + FILE* ud_fp; /* Updater file pointer */ + uint16_t flags; + size_t ret; /* Return value */ + + + /* Open the updater file */ + if((ud_fp = HDfopen(ud_name, "r")) == NULL) + FAIL_STACK_ERROR; + + /* Seek to the position of "flags" in the updater file's header */ + if(HDfseek(ud_fp, (HDoff_t)UD_HD_FLAGS_OFFSET, SEEK_SET) < 0) + FAIL_STACK_ERROR; + + /* Read "flags" from the updater file */ + if((ret = HDfread(&flags, UD_SIZE_2, 1, ud_fp)) != (size_t)1) + FAIL_STACK_ERROR; + + if (flags != expected_flags) + TEST_ERROR; + + if (HDfclose(ud_fp) < 0) + FAIL_STACK_ERROR; + + return 0; + +error: + return 1; + +} /* verify_updater_flags() */ + +/*------------------------------------------------------------------------- + * Function: test_updater_flags + * + * Purpose: Verify "flags" in the updater file is as expected for + * file creation. + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_updater_flags(void) +{ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list ID */ + hid_t fapl = -1; /* File access property list ID */ + hid_t file_fapl = -1; /* File access property list ID associated with the file */ + H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */ + H5F_vfd_swmr_config_t *file_config = NULL; /* Configuration for VFD SWMR */ + uint64_t seq_num = 0; /* Sequence number for updater file */ + uint64_t i = 0; /* Local index variable */ + char namebuf[H5F__MAX_VFD_SWMR_FILE_NAME_LEN]; /* Updater file path */ + h5_stat_t sb; /* Info returned by stat system call */ + + TESTING("VFD SWMR updater file flags"); + + /* Should succeed without VFD SWMR configured */ + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close the file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Allocate memory for the configuration structure */ + if ((config = (H5F_vfd_swmr_config_t *)HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) + FAIL_STACK_ERROR; + if ((file_config = (H5F_vfd_swmr_config_t *)HDmalloc(sizeof(H5F_vfd_swmr_config_t))) == NULL) + FAIL_STACK_ERROR; + + /* + * Configured as VFD SWMR writer + page buffering + generate updater files + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config); + + if (fapl == H5I_INVALID_HID) + TEST_ERROR + + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); + FAIL_STACK_ERROR + } + + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + TEST_ERROR; + + /* Get the file's file access property list */ + if ((file_fapl = H5Fget_access_plist(fid)) < 0) + FAIL_STACK_ERROR; + + /* Retrieve the VFD SWMR configuration from file_fapl */ + if (H5Pget_vfd_swmr_config(file_fapl, file_config) < 0) + TEST_ERROR; + + /* Verify the retrieved info is the same as config1 */ + if (HDmemcmp(config, file_config, sizeof(H5F_vfd_swmr_config_t)) != 0) + TEST_ERROR; + + /* Verify the first updater file: "flags" field and file size */ + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num); + + /* Verify "flags" of the first updater file */ + if(verify_updater_flags(namebuf, CREATE_METADATA_FILE_ONLY_FLAG) < 0) + TEST_ERROR; + + /* Check updater file size */ + if (HDstat(namebuf, &sb) == 0 && sb.st_size != H5F_UD_HEADER_SIZE) + TEST_ERROR; + + /* Closing */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Look for the last updater file */ + for (seq_num = 0; ; seq_num++) { + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num); + if (HDaccess(namebuf, F_OK) != 0) + break; + } + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num-1); + + /* Verify "flags" of the last updater file */ + if(verify_updater_flags(namebuf, FINAL_UPDATE_FLAG) < 0) + TEST_ERROR; + + if (H5Pclose(file_fapl) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(fcpl) < 0) + FAIL_STACK_ERROR; + + /* Remove updater files */ + for (i = 0; i < seq_num; i++) { + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, i); + HDremove(namebuf); + } + + /* Free buffers */ + if (config) + HDfree(config); + if (file_config) + HDfree(file_config); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(file_fapl); + H5Pclose(fcpl); + H5Fclose(fid); + } + H5E_END_TRY; + if (config) + HDfree(config); + if (file_config) + HDfree(file_config); + + return 1; +} /* test_updater_flags() */ + +/*------------------------------------------------------------------------- + * Function: test_updater_flags_same_file_opens() + * + * Purpose: Verify "flags" in the updater file is as expected for + * multiple opens of the same file. + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_updater_flags_same_file_opens(void) +{ + hid_t fid = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list ID */ + hid_t fapl1 = -1; /* File access property list ID */ + H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ + uint64_t seq_num = 0; /* Sequence number for updater file */ + uint64_t i = 0; /* Local index variable */ + char namebuf[H5F__MAX_VFD_SWMR_FILE_NAME_LEN]; /* Updater file path */ + + TESTING("VFD SWMR updater file flags for multiple opens of the same file"); + + /* Should succeed without VFD SWMR configured */ + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close the file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Allocate memory for the configuration structure */ + if ((config1 = HDmalloc(sizeof(*config1))) == NULL) + FAIL_STACK_ERROR; + + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); + FAIL_STACK_ERROR + } + + /* Create the test file */ + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close the file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* + * Set the VFD SWMR configuration in fapl1 + page buffering + */ + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config1, 4, 10, TRUE, TRUE, TRUE, TRUE, 2, MD_FILENAME, UD_FILENAME); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl1 = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config1); + + if (fapl1 == H5I_INVALID_HID) + FAIL_STACK_ERROR; + + /* Open the file as VFD SWMR writer */ + /* Keep the file open */ + if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl1)) < 0) + TEST_ERROR; + + /* Open the same file again as VFD SWMR writer */ + /* Should succeed: 1st open--VFD SWMR writer, 2nd open--VFD SWMR writer */ + if ((fid2 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl1)) < 0) + TEST_ERROR; + + /* Close the second file open */ + if (H5Fclose(fid2) < 0) + FAIL_STACK_ERROR; + + + /* Verify the first updater file for first file open */ + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num); + + /* Verify "flags" of the first updater file is 0*/ + if(verify_updater_flags(namebuf, 0) < 0) + TEST_ERROR; + + /* Look for the last updater file */ + for (seq_num = 0; ; seq_num++) { + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num); + if (HDaccess(namebuf, F_OK) != 0) + break; + } + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num-1); + + /* Verify "flags" of the last updater file is 0 */ + if(verify_updater_flags(namebuf, 0) < 0) + TEST_ERROR; + + /* Close the 1st open file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Look for the last updater file */ + for (seq_num = 0; ; seq_num++) { + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num); + if (HDaccess(namebuf, F_OK) != 0) + break; + } + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, seq_num-1); + + /* Verify "flags" of the last updater file after closing file */ + if(verify_updater_flags(namebuf, FINAL_UPDATE_FLAG) < 0) + TEST_ERROR; + + /* Clean up updater files */ + for (i = 0; i < seq_num; i++) { + HDsprintf(namebuf, "%s.%lu", UD_FILENAME, i); + HDremove(namebuf); + } + + if (H5Pclose(fcpl) < 0) + FAIL_STACK_ERROR; + + /* Free buffers */ + if (config1) + HDfree(config1); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl1); + H5Pclose(fcpl); + H5Fclose(fid); + H5Fclose(fid2); + } + H5E_END_TRY; + if (config1) + HDfree(config1); + return 1; +} /* test_updater_flags_same_file_opens() */ + + +/*------------------------------------------------------------------------- + * Function: clean_chk_ud_files() + * + * Purpose: This is the helper routine used to clean up + * the checksum file and the updater files. + * + * Return: void + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static void +clean_chk_ud_files(char *md_file_path, char *updater_file_path) +{ + char chk_name[1024 + 4]; + char ud_name[1024 + 4]; + uint64_t i; + + /* Name of the checksum file: <md_file_path>.chk */ + HDsprintf(chk_name, "%s.chk", md_file_path); + + /* Remove the checksum file if exists. + If not, the callback will just continue appending + checksums to the existing file */ + if(HDaccess(chk_name, F_OK) == 0) { + HDremove(chk_name); + } + + /* Remove all the updater files if exist: <updater_file_path>.<i> */ + for(i = 0; ; i++) { + sprintf(ud_name, "%s.%lu", updater_file_path, i); + if(HDaccess(ud_name, F_OK) != 0) + break; + HDremove(ud_name); + } + +} /* clean_chk_ud_files() */ + + +/*------------------------------------------------------------------------- + * Function: verify_ud_chk() + * + * Purpose: This is the helper routine used by + * test_updater_generate_md_checksums() to verify + * contents of the checksum file and the updater files. + * --verify the sequence number in each updater's file header + * corresponds to the ith sequence number of the updater + * file name. + * --verify the tick number in each updater's file header + * corresponds to the tick number stored in the checksum file + * --verify the change_list_len in each updater's file header + * is consistent with num_change_list_entries in each updater's + * change list header + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static herr_t +verify_ud_chk(char *md_file_path, char *ud_file_path) +{ + char chk_name[1024 + 4]; /* Checksum file name */ + char ud_name[1024 + 4]; /* Updater file name */ + FILE* chk_fp; /* Checksum file pointer */ + FILE* ud_fp; /* Updater file pointer */ + uint64_t ud_seq_num; /* Sequence number in the updater file */ + uint64_t chk_ud_seq_num; /* Updater sequence number in the checksum file */ + uint64_t i; /* Local index variable */ + long size = 0; /* Size of the file */ + size_t change_list_len; /* change_list_len in the updater file header */ + uint32_t num_change_list_entries; /* num_change_list_entries in the updater change list header */ + + /* Open the checksum file */ + HDsprintf(chk_name, "%s.chk", md_file_path); + if((chk_fp = HDfopen(chk_name, "r")) == NULL) + FAIL_STACK_ERROR; + + for(i = 0; ; i++) { + /* Generate updater file name: <ud_file_path>.<i> */ + HDsprintf(ud_name, "%s.%lu", ud_file_path, i); + + /* Open the updater file */ + if ((ud_fp = HDfopen(ud_name, "r")) == NULL) + break; + else { + /* Seek to the position of the sequence number in the updater file's header */ + if(HDfseek(ud_fp, (off_t)UD_HD_SEQ_NUM_OFFSET, SEEK_SET) < 0) + FAIL_STACK_ERROR; + + /* Read the sequence number from the updater file */ + if(HDfread(&ud_seq_num, UD_SIZE_8, 1, ud_fp) != 1) + FAIL_STACK_ERROR; + + /* Compare the sequence number with i */ + if(ud_seq_num != i) + TEST_ERROR; + + /* Read change_list_len from updater file's header */ + if(HDfseek(ud_fp, (off_t)UD_HD_CHANGE_LIST_LEN_OFFSET, SEEK_SET) < 0) + FAIL_STACK_ERROR; + + if(HDfread(&change_list_len, UD_SIZE_8, 1, ud_fp) != 1) + FAIL_STACK_ERROR; + + if(i != 0) { + + /* Read num_change_list_entries from updater file's change list */ + if(HDfseek(ud_fp, (off_t)UD_CL_NUM_CHANGE_LIST_ENTRIES_OFFSET, SEEK_SET) < 0) + FAIL_STACK_ERROR; + + if(HDfread(&num_change_list_entries, UD_SIZE_4, 1, ud_fp) != 1) + FAIL_STACK_ERROR; + + if(num_change_list_entries == 0) { + if(change_list_len != H5F_UD_CL_SIZE(0)) + TEST_ERROR; + } else { + if (change_list_len != H5F_UD_CL_SIZE(num_change_list_entries)) + TEST_ERROR + } + } + + /* Close the updater file */ + if(HDfclose(ud_fp) < 0) + FAIL_STACK_ERROR; + + /* Read the updater sequence number from checksum file */ + if(HDfread(&chk_ud_seq_num, UD_SIZE_8, 1, chk_fp) != 1) + FAIL_STACK_ERROR; + + /* Compare sequence number in updater file with sequence number in checksum file */ + if (ud_seq_num != chk_ud_seq_num) + TEST_ERROR; + + /* Advance checksum file to the next sequence number */ + if(HDfseek(chk_fp, (off_t)UD_SIZE_4, SEEK_CUR) < 0) + FAIL_STACK_ERROR; + } + } + + /* Get the size of the chksum file */ + if ((size = HDftell(chk_fp)) < 0) + FAIL_STACK_ERROR; + + /* Size of sequence number and checksum in the checksum file */ + if((unsigned)size != (i * (UD_SIZE_8 + UD_SIZE_4))) + TEST_ERROR; + + return 0; + +error: + return (-1); + +} /* verify_ud_chk() */ + +/*------------------------------------------------------------------------- + * Function: md_ck_cb() + * + * Purpose: This is the callback function used by + * test_updater_generate_md_checksums() when the + * H5F_ACS_GENERATE_MD_CK_CB_NAME property is set in fapl. + * --Opens and read the metadata file into a buffer. + * --Generate checksum for the metadata file + * --Write the tick number and the checksum to the checksum file + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + *------------------------------------------------------------------------- + */ +static herr_t +md_ck_cb(char *md_file_path, uint64_t updater_seq_num) +{ + FILE* md_fp = NULL; /* Metadata file pointer */ + FILE* chk_fp = NULL; /* Checksum file pointer */ + long size = 0; /* File size returned from HDftell() */ + void *buf = NULL; /* Buffer for holding the metadata file content */ + uint32_t chksum = 0; /* The checksum generated for the metadata file */ + char chk_name[1024 + 4]; /* Buffer for the checksum file name */ + size_t ret; /* Return value */ + + /* Open the metadata file */ + if((md_fp = HDfopen(md_file_path, "r")) == NULL) + FAIL_STACK_ERROR; + + /* Set file pointer at end of file.*/ + if(HDfseek(md_fp, 0, SEEK_END) < 0) + FAIL_STACK_ERROR; + + /* Get the current position of the file pointer.*/ + if ((size = HDftell(md_fp)) < 0) + FAIL_STACK_ERROR; + + if(size != 0) { + + HDrewind(md_fp); + + if((buf = HDmalloc((size_t)size)) == NULL) + FAIL_STACK_ERROR; + + /* Read the metadata file to buf */ + if ((ret = HDfread(buf, 1, (size_t)size, md_fp)) != (size_t)size) + FAIL_STACK_ERROR; + + /* Calculate checksum of the metadata file */ + chksum = H5_checksum_metadata(buf, (size_t)size, 0); + } + + /* Close the metadata file */ + if(md_fp && HDfclose(md_fp) < 0) + FAIL_STACK_ERROR; + + /* + * Checksum file + */ + + /* Generate checksum file name: <md_file_path>.chk */ + HDsprintf(chk_name, "%s.chk", md_file_path); + + /* Open checksum file for append */ + if((chk_fp = HDfopen(chk_name, "a")) == NULL) + FAIL_STACK_ERROR; + + /* Write the updater sequence number to the checksum file */ + if((ret = HDfwrite(&updater_seq_num, sizeof(uint64_t), 1, chk_fp)) != 1) + FAIL_STACK_ERROR; + + /* Write the checksum to the checksum file */ + if((ret = HDfwrite(&chksum, sizeof(uint32_t), 1, chk_fp)) != 1) + FAIL_STACK_ERROR; + + /* Close the checksum file */ + if(chk_fp && HDfclose(chk_fp) != 0) + FAIL_STACK_ERROR; + + if(buf) + HDfree(buf); + + return 0; + +error: + if(buf) + HDfree(buf); + if(md_fp) + HDfclose(md_fp); + if(chk_fp) + HDfclose(chk_fp); + + return -1; +} /* md_ck_cb() */ + +/*------------------------------------------------------------------------- + * Function: test_updater_generate_md_checksums() + * + * Purpose: It enables the generation of checksums for the metadata file + * created by the writer end of tick function. + * It also verifies the contents of the checksum file and the + * updater files. + * + * The test is invoked when the file is created via H5Fcreate() + * and via H5Fopen(). + * + * Return: 0 if test is sucessful + * 1 if test fails + * + * Programmer: Vailin Choi; October 2021 + * + * Note: It is important to clean up the checksum file and the updater files. + * + *------------------------------------------------------------------------- + */ +static unsigned +test_updater_generate_md_checksums(hbool_t file_create) +{ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list ID */ + hid_t fapl = -1; /* File access property list ID */ + H5F_vfd_swmr_config_t config; /* Configuration for VFD SWMR */ + H5F_generate_md_ck_cb_t cb_info; /* Callback */ + + if(file_create) { + TESTING("VFD SWMR updater generate checksums for metadata file with H5Fcreate"); + } else { + TESTING("VFD SWMR updater generate checksums for metadata file with H5Fopen"); + } + + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, TRUE, TRUE, TRUE, TRUE, 2, MD_FILE, UD_FILE); + + /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ + fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, &config); + + if (fapl == H5I_INVALID_HID) + TEST_ERROR + + if ((fcpl = vfd_swmr_create_fcpl(H5F_FSPACE_STRATEGY_PAGE, 4096)) < 0) { + HDprintf("vfd_swmr_create_fcpl() failed"); + FAIL_STACK_ERROR + } + + /* Set up callback to generate checksums for updater's metadata files */ + cb_info.func = md_ck_cb; + + /* Activate private property to generate checksums for updater's metadata file */ + H5Pset(fapl, H5F_ACS_GENERATE_MD_CK_CB_NAME, &cb_info); + + /* Use file creation or file open for testing */ + if(file_create) { + if((fid = H5Fcreate(FILENAME4, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + TEST_ERROR; + } else { + fid = H5Fcreate(FILENAME4, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + H5Fclose(fid); + + fid = H5Fopen(FILENAME4, H5F_ACC_RDWR, fapl); + } + + /* Close the file */ + if (H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + if (H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(fcpl) < 0) + FAIL_STACK_ERROR; + + /* Verify contents of checksum file and updater files */ + if(verify_ud_chk(config.md_file_path, config.updater_file_path) < 0) + TEST_ERROR; + + /* It's important to clean up the chechsum and updater files. */ + clean_chk_ud_files(config.md_file_path, config.updater_file_path); + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(fcpl); + H5Fclose(fid); + } + H5E_END_TRY; + + /* It's important to clean up the chechsum and updater files. */ + clean_chk_ud_files(config.md_file_path, config.updater_file_path); + + return 1; + +} /* test_updater_generate_md_checksums() */ + + +/*------------------------------------------------------------------------- * Function: main() * * Purpose: Main function for VFD SWMR tests. @@ -3481,9 +4445,15 @@ main(void) PUTS_ERROR("Can't get VFD-dependent fapl") } + /* Add nfs/updater testing in this routine */ nerrors += test_fapl(); if (use_file_locking) { + nerrors += test_updater_flags(); + nerrors += test_updater_flags_same_file_opens(); + nerrors += test_updater_generate_md_checksums(TRUE); + nerrors += test_updater_generate_md_checksums(FALSE); + nerrors += test_shadow_index_lookup(); nerrors += test_file_fapl(); diff --git a/test/vfd_swmr_addrem_writer.c b/test/vfd_swmr_addrem_writer.c index f115d2e..a2982fd 100644 --- a/test/vfd_swmr_addrem_writer.c +++ b/test/vfd_swmr_addrem_writer.c @@ -94,8 +94,9 @@ open_skeleton(const char *filename, unsigned verbose) if ((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_attrdset_writer.c b/test/vfd_swmr_attrdset_writer.c index f445321..a722f44 100644 --- a/test/vfd_swmr_attrdset_writer.c +++ b/test/vfd_swmr_attrdset_writer.c @@ -1979,8 +1979,9 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, true, 128, "./attrdset-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, TRUE, 128, "./attrdset-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 77c7b26..928f7c7 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -2470,9 +2470,9 @@ main(int argc, char **argv) continue; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, s.writer, s.flush_raw_data, 128, - "./bigset-shadow-%zu", i); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, s.writer, TRUE, FALSE, s.flush_raw_data, 128, "./bigset-shadow-%zu", NULL, i); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, s.page_buf_size, &config)) < 0) { diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c index cfe93aa..90abeed 100644 --- a/test/vfd_swmr_common.c +++ b/test/vfd_swmr_common.c @@ -345,10 +345,10 @@ await_signal(hid_t fid) /* Revised support routines that can be used for all VFD SWMR integration tests */ -/* Initialize fields in config with the input parameters */ void init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, hbool_t writer, - hbool_t flush_raw_data, uint32_t md_pages_reserved, const char *md_file_fmtstr, ...) + hbool_t maintain_metadata_file, hbool_t generate_updater_files, hbool_t flush_raw_data, + uint32_t md_pages_reserved, const char *md_file_fmtstr, const char *updater_file_path, ...) { va_list ap; @@ -360,13 +360,20 @@ init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t config->tick_len = tick_len; config->max_lag = max_lag; config->writer = writer; + config->maintain_metadata_file = maintain_metadata_file; + config->generate_updater_files = generate_updater_files; config->flush_raw_data = flush_raw_data; config->md_pages_reserved = md_pages_reserved; - HDva_start(ap, md_file_fmtstr); + HDva_start(ap, updater_file_path); + evsnprintf(config->md_file_path, sizeof(config->md_file_path), md_file_fmtstr, ap); + HDva_end(ap); + if(config->generate_updater_files && updater_file_path != NULL) + HDstrcpy(config->updater_file_path, updater_file_path); + } /* init_vfd_swmr_config() */ /* Initialize the log file path in config, this function should be called after init_vfd_swmr_config. */ diff --git a/test/vfd_swmr_common.h b/test/vfd_swmr_common.h index f5981a5..42569be 100644 --- a/test/vfd_swmr_common.h +++ b/test/vfd_swmr_common.h @@ -73,9 +73,11 @@ H5TEST_DLL void await_signal(hid_t); H5TEST_DLL hid_t vfd_swmr_create_fapl(bool use_latest_format, bool use_vfd_swmr, bool only_meta_pages, size_t page_buf_size, H5F_vfd_swmr_config_t *config); -H5TEST_DLL void init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, - hbool_t writer, hbool_t flush_raw_data, uint32_t md_pages_reserved, - const char *md_file_fmtstr, ...) H5_ATTR_FORMAT(printf, 7, 8); +H5TEST_DLL void +init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, hbool_t writer, + hbool_t maintain_metadata_file, hbool_t generate_updater_files, hbool_t flush_raw_data, + uint32_t md_pages_reserved, const char *md_file_fmtstr, + const char *updater_file_path, ...) H5_ATTR_FORMAT(printf, 9, 11); H5TEST_DLL void init_vfd_swmr_log(H5F_vfd_swmr_config_t *config, const char *log_file_fmtstr, ...) H5_ATTR_FORMAT(printf, 2, 3); diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c index d264ca9..3cf43f9 100644 --- a/test/vfd_swmr_dsetchks_writer.c +++ b/test/vfd_swmr_dsetchks_writer.c @@ -2302,8 +2302,9 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, s.flush_raw_data, 128, "./dsetchks-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, s.flush_raw_data, 128, "./dsetchks-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_dsetops_writer.c b/test/vfd_swmr_dsetops_writer.c index 3704c44..d999d64 100644 --- a/test/vfd_swmr_dsetops_writer.c +++ b/test/vfd_swmr_dsetops_writer.c @@ -1888,8 +1888,9 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, s.flush_raw_data, 128, "./dsetops-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, writer, TRUE, FALSE, s.flush_raw_data, 128, "./dsetops-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config)) < 0) { diff --git a/test/vfd_swmr_generator.c b/test/vfd_swmr_generator.c index 16b1d4b..1c549ca 100644 --- a/test/vfd_swmr_generator.c +++ b/test/vfd_swmr_generator.c @@ -125,8 +125,9 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, int if ((config = HDcalloc(1, sizeof(*config))) == NULL) return -1; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 10, vfd_swmr_write, TRUE, 128, "generator-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 10, vfd_swmr_write, TRUE, FALSE, TRUE, 128, "generator-shadow", NULL); } /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ diff --git a/test/vfd_swmr_gfail_writer.c b/test/vfd_swmr_gfail_writer.c index 430ed89..2be58e2 100644 --- a/test/vfd_swmr_gfail_writer.c +++ b/test/vfd_swmr_gfail_writer.c @@ -544,8 +544,9 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, 128, "./group-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, TRUE, 128, "./group-shadow", NULL); /* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST) * as the second parameter of H5Pset_libver_bound() that is called by diff --git a/test/vfd_swmr_gperf_writer.c b/test/vfd_swmr_gperf_writer.c index 3342b40..18f3199 100644 --- a/test/vfd_swmr_gperf_writer.c +++ b/test/vfd_swmr_gperf_writer.c @@ -2786,8 +2786,9 @@ main(int argc, char **argv) return EXIT_SUCCESS; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, FALSE, 128, "./group-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, FALSE, 128, "./group-shadow", NULL); /* If the log flag is on, create the log file log-test under the current directory. */ if (s.glog == true) diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c index 5881300..af46f3d 100644 --- a/test/vfd_swmr_group_writer.c +++ b/test/vfd_swmr_group_writer.c @@ -5011,8 +5011,9 @@ main(int argc, char **argv) TEST_ERROR; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, 128, "./group-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, s.tick_len, s.max_lag, writer, TRUE, FALSE, TRUE, 128, "./group-shadow", NULL); /* If old-style option is chosen, use the earliest file format(H5F_LIBVER_EARLIEST) * as the second parameter of H5Pset_libver_bound() that is called by diff --git a/test/vfd_swmr_reader.c b/test/vfd_swmr_reader.c index 6265cae..2b960c13 100644 --- a/test/vfd_swmr_reader.c +++ b/test/vfd_swmr_reader.c @@ -319,8 +319,9 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned goto error; } - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_remove_reader.c b/test/vfd_swmr_remove_reader.c index 4389b05..18dbb62 100644 --- a/test/vfd_swmr_remove_reader.c +++ b/test/vfd_swmr_remove_reader.c @@ -303,8 +303,9 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, uns if ((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_remove_writer.c b/test/vfd_swmr_remove_writer.c index 8df8fa8..41c2300 100644 --- a/test/vfd_swmr_remove_writer.c +++ b/test/vfd_swmr_remove_writer.c @@ -86,8 +86,9 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old H5_ATTR_UNUSE if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_sparse_reader.c b/test/vfd_swmr_sparse_reader.c index 943c375..a737f70 100644 --- a/test/vfd_swmr_sparse_reader.c +++ b/test/vfd_swmr_sparse_reader.c @@ -207,8 +207,9 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, uns if ((config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, 4096, config)) < 0) { diff --git a/test/vfd_swmr_sparse_writer.c b/test/vfd_swmr_sparse_writer.c index 56d19f3..f473249 100644 --- a/test/vfd_swmr_sparse_writer.c +++ b/test/vfd_swmr_sparse_writer.c @@ -86,8 +86,9 @@ open_skeleton(const char *filename, unsigned verbose) if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_vlstr_reader.c b/test/vfd_swmr_vlstr_reader.c index fa9d7b4..2554207 100644 --- a/test/vfd_swmr_vlstr_reader.c +++ b/test/vfd_swmr_vlstr_reader.c @@ -115,8 +115,9 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, false, TRUE, 128, "./vlstr-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, false, TRUE, FALSE, TRUE, 128, "./vlstr-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(true, use_vfd_swmr, sel == TEST_OOB, 4096, &config); diff --git a/test/vfd_swmr_vlstr_writer.c b/test/vfd_swmr_vlstr_writer.c index 4f7376e..e3905e8 100644 --- a/test/vfd_swmr_vlstr_writer.c +++ b/test/vfd_swmr_vlstr_writer.c @@ -184,8 +184,9 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, true, TRUE, 128, "./vlstr-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&config, 4, 7, true, TRUE, FALSE, TRUE, 128, "./vlstr-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(true, use_vfd_swmr, sel == TEST_OOB, 4096, &config); diff --git a/test/vfd_swmr_writer.c b/test/vfd_swmr_writer.c index 4693554..0fb5fe8 100644 --- a/test/vfd_swmr_writer.c +++ b/test/vfd_swmr_writer.c @@ -88,8 +88,9 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, unsigne if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) return -1; - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, FALSE, TRUE, 128, "rw-shadow", NULL); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ if ((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, 4096, config)) < 0) diff --git a/test/vfd_swmr_zoo_writer.c b/test/vfd_swmr_zoo_writer.c index 13794d9..d40f2d9 100644 --- a/test/vfd_swmr_zoo_writer.c +++ b/test/vfd_swmr_zoo_writer.c @@ -473,8 +473,9 @@ main(int argc, char **argv) parse_command_line_options(argc, argv); - /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, writer, TRUE, 128, "./zoo-shadow"); + /* config, tick_len, max_lag, writer, maintain_metadata_file, generate_updater_files, + * flush_raw_data, md_pages_reserved, md_file_path, updater_file_path */ + init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, writer, TRUE, FALSE, TRUE, 128, "./zoo-shadow", NULL); /* ? turn off use latest format argument via 1st argument? since later on it reset to early format */ /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ |