From 0bb13dcf92a309d7668e8cda85f248b420934f29 Mon Sep 17 00:00:00 2001 From: vchoi Date: Tue, 10 Aug 2021 14:25:06 -0500 Subject: (1) src/H5Fvfd_swmr.c --enable or disable raw data flush depending on configuration (2) vfd_swmr_dsetchks_writer.c vfd_swmr_dsetops_writer.c --modifications to test/verify when flushing of raw data is enabled/disabled --refactor coding (3) testvfdswmr.sh.in --add testing with/without flush of raw data to tests: dsetchks and dsetops (4) vfd_swmr_attrdset_writer.c --pass true for flushing raw data to the common routine init_vfd_swmr_config() --refactor coding so that it has similar format as the other two tests: dsetops and dsetchks (5) vfd_swmr_addrem_writer.c vfd_swmr_bigset_writer.c vfd_swmr_generator.c vfd_swmr_group_writer.c vfd_swmr_reader.c vfd_swmr_remove_reader.c vfd_swmr_remove_writer.c vfd_swmr_sparse_reader.c vfd_swmr_sparse_writer.c vfd_swmr_vlstr_reader.c vfd_swmr_vlstr_writer.c vfd_swmr_writer.c vfd_swmr_zoo_writer.c --pass true for flushing raw data to the common routine init_vfd_swmr_config() --- src/H5Fvfd_swmr.c | 45 +-- test/testvfdswmr.sh.in | 181 ++++++------ test/vfd_swmr_addrem_writer.c | 2 +- test/vfd_swmr_attrdset_writer.c | 357 ++++++++++++++---------- test/vfd_swmr_bigset_writer.c | 2 +- test/vfd_swmr_dsetchks_writer.c | 317 +++++++++++++++------ test/vfd_swmr_dsetops_writer.c | 600 ++++++++++++++++++++++++++-------------- test/vfd_swmr_generator.c | 2 +- test/vfd_swmr_group_writer.c | 2 +- test/vfd_swmr_reader.c | 2 +- test/vfd_swmr_remove_reader.c | 2 +- test/vfd_swmr_remove_writer.c | 2 +- test/vfd_swmr_sparse_reader.c | 2 +- test/vfd_swmr_sparse_writer.c | 2 +- test/vfd_swmr_vlstr_reader.c | 2 +- test/vfd_swmr_vlstr_writer.c | 2 +- test/vfd_swmr_writer.c | 2 +- test/vfd_swmr_zoo_writer.c | 2 +- 18 files changed, 953 insertions(+), 573 deletions(-) diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 13170af..3220443 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -768,26 +768,26 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) /* 1) If requested, flush all raw data to the HDF5 file. * - * (Not for first cut.) - */ - HDassert(!shared->vfd_swmr_config.flush_raw_data); - -#if 1 - /* Test to see if b-tree corruption seen in VFD SWMR tests - * is caused by client hiding data from the metadata cache. Do - * this by calling H5D_flush_all(), which flushes any cached - * dataset storage. Eventually, we will do this regardless - * when the above flush_raw_data flag is set. */ + if(shared->vfd_swmr_config.flush_raw_data) { + + /* Test to see if b-tree corruption seen in VFD SWMR tests + * is caused by client hiding data from the metadata cache. Do + * this by calling H5D_flush_all(), which flushes any cached + * dataset storage. Eventually, we will do this regardless + * when the above flush_raw_data flag is set. + */ - if (H5D_flush_all(f) < 0) + if (H5D_flush_all(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") - if (H5MF_free_aggrs(f) < 0) + if (H5MF_free_aggrs(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") + } + /* 2) If it exists, flush the metadata cache to the page buffer. */ if (shared->cache) { if (H5AC_prep_for_file_flush(f) < 0) @@ -806,23 +806,6 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) if (H5FD_truncate(shared->lf, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") -#endif - - /* 2) If it exists, flush the metadata cache to the page buffer. */ - if (shared->cache) { - - if (H5AC_prep_for_file_flush(f) < 0) - - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "prep for MDC flush failed") - - if (H5AC_flush(f) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush metadata cache to the page buffer") - - if (H5AC_secure_from_file_flush(f) < 0) - - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "secure from MDC flush failed") - } /* 3) If this is the first tick (i.e. tick == 1), create the * in memory version of the metadata file index. diff --git a/test/testvfdswmr.sh.in b/test/testvfdswmr.sh.in index b0ab785..1e870de 100644 --- a/test/testvfdswmr.sh.in +++ b/test/testvfdswmr.sh.in @@ -1211,51 +1211,55 @@ done ############################################################################### # # -for options in "-p -e 20 -t -q" "-g -m 5 -n 2 -s 10 -w 7 -q" "-k -m 10 -n 5 -r 5 -l 10 -q"; do - # - # - if [ ${do_dsetops:-no} = no ]; then - continue - fi - # Clean up any existing fifo files from previous runs - if [ -e ./$DSETOPS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found - rm -f ./$DSETOPS_FIFO_WRITER_TO_READER - fi - if [ -e ./$DSETOPS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found - rm -f ./$DSETOPS_FIFO_READER_TO_WRITER - fi - # - echo launch vfd_swmr_dsetops_writer dsetops, options $options ......may take some time...... - catch_out_err_and_rc vfd_swmr_dsetops_writer \ - ../vfd_swmr_dsetops_writer $options & - pid_writer=$! - - catch_out_err_and_rc vfd_swmr_dsetops_reader \ - ../vfd_swmr_dsetops_reader $options & - pid_reader=$! - - # Wait for the reader to finish before signaling the - # writer to quit: the writer holds the file open so that the - # reader will find the shadow file when it opens - # the .h5 file. - wait $pid_reader - wait $pid_writer +# Loop with flushing of raw data and then without +for flush in "" "-U"; do + # Loop with different operations + for options in "-p -e 20 -t -q" "-g -m 5 -n 2 -s 10 -w 7 -q" "-k -m 10 -n 5 -r 5 -l 10 -q"; do + # + # + if [ ${do_dsetops:-no} = no ]; then + continue + fi + # Clean up any existing fifo files from previous runs + if [ -e ./$DSETOPS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found + rm -f ./$DSETOPS_FIFO_WRITER_TO_READER + fi + if [ -e ./$DSETOPS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found + rm -f ./$DSETOPS_FIFO_READER_TO_WRITER + fi + # + echo launch vfd_swmr_dsetops_writer dsetops, options $options $flush......may take some time...... + catch_out_err_and_rc vfd_swmr_dsetops_writer \ + ../vfd_swmr_dsetops_writer $options $flush & + pid_writer=$! + + catch_out_err_and_rc vfd_swmr_dsetops_reader \ + ../vfd_swmr_dsetops_reader $options $flush & + pid_reader=$! + + # Wait for the reader to finish before signaling the + # writer to quit: the writer holds the file open so that the + # reader will find the shadow file when it opens + # the .h5 file. + wait $pid_reader + wait $pid_writer + + # Collect exit code of the reader + if [ $(cat vfd_swmr_dsetops_reader.rc) -ne 0 ]; then + echo reader had error + nerrors=$((nerrors + 1)) + fi - # Collect exit code of the reader - if [ $(cat vfd_swmr_dsetops_reader.rc) -ne 0 ]; then - echo reader had error - nerrors=$((nerrors + 1)) - fi + # Collect exit code of the writer + if [ $(cat vfd_swmr_dsetops_writer.rc) -ne 0 ]; then + echo writer had error + nerrors=$((nerrors + 1)) + fi - # Collect exit code of the writer - if [ $(cat vfd_swmr_dsetops_writer.rc) -ne 0 ]; then - echo writer had error - nerrors=$((nerrors + 1)) - fi - - # Clean up output files - rm -f vfd_swmr_dsetops_writer.{out,rc} - rm -f vfd_swmr_dsetops_reader.*.{out,rc} + # Clean up output files + rm -f vfd_swmr_dsetops_writer.{out,rc} + rm -f vfd_swmr_dsetops_reader.*.{out,rc} + done done ############################################################################### @@ -1275,51 +1279,56 @@ dsetchks_list=( "-r -m 11 -n 5 -l 7 -q" "-f -x 5 -y 2 -q" ) -for options in "${dsetchks_list[@]}"; do - # - # - if [ ${do_dsetchks:-no} = no ]; then - continue - fi - # Clean up any existing fifo files from previous runs - if [ -e ./$DSETCHKS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found - rm -f ./$DSETCHKS_FIFO_WRITER_TO_READER - fi - if [ -e ./$DSETCHKS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found - rm -f ./$DSETCHKS_FIFO_READER_TO_WRITER - fi - # - echo launch vfd_swmr_dsetchks_writer dsetchks, options $options ......may take some time...... - catch_out_err_and_rc vfd_swmr_dsetchks_writer \ - ../vfd_swmr_dsetchks_writer $options & - pid_writer=$! - - catch_out_err_and_rc vfd_swmr_dsetchks_reader \ - ../vfd_swmr_dsetchks_reader $options & - pid_reader=$! - - # Wait for the reader to finish before signaling the - # writer to quit: the writer holds the file open so that the - # reader will find the shadow file when it opens - # the .h5 file. - wait $pid_reader - wait $pid_writer - - # Collect exit code of the reader - if [ $(cat vfd_swmr_dsetchks_reader.rc) -ne 0 ]; then - echo reader had error - nerrors=$((nerrors + 1)) - fi +# +# +# Loop with flushing of raw data and then without +for flush in "" "-U"; do + for options in "${dsetchks_list[@]}"; do + # + # + if [ ${do_dsetchks:-no} = no ]; then + continue + fi + # Clean up any existing fifo files from previous runs + if [ -e ./$DSETCHKS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found + rm -f ./$DSETCHKS_FIFO_WRITER_TO_READER + fi + if [ -e ./$DSETCHKS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found + rm -f ./$DSETCHKS_FIFO_READER_TO_WRITER + fi + # + echo launch vfd_swmr_dsetchks_writer dsetchks, options $options $flush ......may take some time...... + catch_out_err_and_rc vfd_swmr_dsetchks_writer \ + ../vfd_swmr_dsetchks_writer $options $flush & + pid_writer=$! + + catch_out_err_and_rc vfd_swmr_dsetchks_reader \ + ../vfd_swmr_dsetchks_reader $options $flush & + pid_reader=$! + + # Wait for the reader to finish before signaling the + # writer to quit: the writer holds the file open so that the + # reader will find the shadow file when it opens + # the .h5 file. + wait $pid_reader + wait $pid_writer + + # Collect exit code of the reader + if [ $(cat vfd_swmr_dsetchks_reader.rc) -ne 0 ]; then + echo reader had error + nerrors=$((nerrors + 1)) + fi - # Collect exit code of the writer - if [ $(cat vfd_swmr_dsetchks_writer.rc) -ne 0 ]; then - echo writer had error - nerrors=$((nerrors + 1)) - fi + # Collect exit code of the writer + if [ $(cat vfd_swmr_dsetchks_writer.rc) -ne 0 ]; then + echo writer had error + nerrors=$((nerrors + 1)) + fi - # Clean up output files - rm -f vfd_swmr_dsetchks_writer.{out,rc} - rm -f vfd_swmr_dsetchks_reader.*.{out,rc} + # Clean up output files + rm -f vfd_swmr_dsetchks_writer.{out,rc} + rm -f vfd_swmr_dsetchks_reader.*.{out,rc} + done done ############################################################################### diff --git a/test/vfd_swmr_addrem_writer.c b/test/vfd_swmr_addrem_writer.c index 7f13cec..f115d2e 100644 --- a/test/vfd_swmr_addrem_writer.c +++ b/test/vfd_swmr_addrem_writer.c @@ -95,7 +95,7 @@ open_skeleton(const char *filename, unsigned verbose) 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); /* 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 27a23e6..630b071 100644 --- a/test/vfd_swmr_attrdset_writer.c +++ b/test/vfd_swmr_attrdset_writer.c @@ -150,12 +150,16 @@ static bool open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *ma unsigned *min_dense); static bool close_dsets(const dsets_state_t *ds); +static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, + H5F_vfd_swmr_config_t *config, np_state_t *np); static bool attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); static bool attr_action(unsigned action, const state_t *s, hid_t did, unsigned which); static bool add_attr(const state_t *s, hid_t did, unsigned int which); static bool modify_attr(const state_t *s, hid_t did, unsigned int which); static bool delete_attr(hid_t did, unsigned int which); +static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, + H5F_vfd_swmr_config_t *config, np_state_t *np); static bool verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); static bool verify_attr_action(unsigned action, hid_t did, unsigned which); @@ -223,12 +227,20 @@ state_init(state_t *s, int argc, char **argv) unsigned long tmp; int ch; const hsize_t dims = 1; - char tfile[PATH_MAX]; + char *tfile = NULL; char * end; *s = ALL_HID_INITIALIZER; - esnprintf(tfile, sizeof(tfile), "%s", argv[0]); - esnprintf(s->progname, sizeof(s->progname), "%s", basename(tfile)); + + if (H5_basename(argv[0], &tfile) < 0) { + HDprintf("H5_basename failed\n"); + TEST_ERROR; + } + + esnprintf(s->progname, sizeof(s->progname), "%s", tfile); + + if (tfile) + HDfree(tfile); while ((ch = getopt(argc, argv, "pgkvmbqSNa:d:u:c:")) != -1) { switch (ch) { @@ -340,6 +352,9 @@ state_init(state_t *s, int argc, char **argv) return true; error: + if (tfile) + HDfree(tfile); + return false; } /* state_init() */ @@ -892,16 +907,90 @@ error: } /* close_dsets() */ /* - * Attribute handling by the writer + * Writer */ /* - * Perform the "action" for each of the datasets specified on the command line. + * Perform the attribute operations specified on the command line. * ADD_ATTR : -a option * MODIFY_ATTR : -m option * DELETE_ATTR : -d option */ static bool +perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +{ + unsigned step; + bool result; + unsigned dd; + bool ret = true; + + for (step = 0; step < s->asteps; step++) { + dbgf(2, "Adding attribute %d\n", step); + + result = attr_dsets_action(ADD_ATTR, s, ds, step); + + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for addition failed\n"); + TEST_ERROR; + } + } + + if (s->mod_attr) { + + /* Need to sync up writer/reader before moving onto the next phase */ + if (s->use_np && !np_writer(true, 0, s, np, config)) { + printf("np_writer() for modification failed\n"); + TEST_ERROR; + } + + /* Start modification */ + for (step = 0; step < s->asteps; step++) { + dbgf(2, "Modifying attribute %d\n", step); + + result = attr_dsets_action(MODIFY_ATTR, s, ds, step); + + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for modification failed\n"); + TEST_ERROR; + } + } + } + + if (s->dattrs) { + + /* Need to sync up writer/reader before moving onto the next phase */ + if (s->use_np && !np_writer(true, 0, s, np, config)) { + printf("np_writer() for deletion failed\n"); + TEST_ERROR; + } + + /* Start deletion */ + for (dd = 0, step = s->asteps - 1; dd < s->dattrs; dd++, --step) { + dbgf(2, "Deleting attribute %d\n", step); + + result = attr_dsets_action(DELETE_ATTR, s, ds, step); + + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for deletion failed\n"); + TEST_ERROR; + } + } + } + + return true; + +error: + return false; + +} /* perform_dsets_operations() */ + +/* + * Perform the "action" for each of the datasets specified on the command line. + * -p: compact dataset + * -g: contiguous dataset + * -k: 5 chunked datasets with 5 indexing types + */ +static bool attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) { int nerrors = 0; @@ -1181,14 +1270,111 @@ error: */ /* - * Verify the action on each of the datasets specified: + * Verify the attribute operations specified on the command line: * ADD_ATTR : -a option * MODIFY_ATTR : -m option * DELETE_ATTR : -d option * * Also verify continuation block and compact<->dense storage if: * --[-c ] is 1 - * --not -m option + * --not appliable for -m option + */ +static bool +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +{ + unsigned step; + bool result; + unsigned dd; + + /* Start verifying addition */ + for (step = 0; step < s->asteps; step++) { + dbgf(2, "Verifying...attribute %d\n", step); + + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + decisleep(config->tick_len * s->update_interval); + + result = verify_attr_dsets_action(ADD_ATTR, s, ds, step); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } + } + + if (s->mod_attr) { + /* Need to sync up writer/reader before moving onto the next phase */ + if (!np_reader_no_verification(s, np, config)) { + printf("np_reader_no_verification() for verifying modification failed\n"); + TEST_ERROR; + } + + /* Start verifying modification */ + for (step = 0; step < s->asteps; step++) { + dbgf(2, "Verifying...modify attribute %d\n", step); + + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + decisleep(config->tick_len * s->update_interval); + + result = verify_attr_dsets_action(MODIFY_ATTR, s, ds, step); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying modification failed\n"); + TEST_ERROR; + } + } + } + + if (s->dattrs) { + + /* Need to sync up writer/reader before moving onto the next phase */ + if (!np_reader_no_verification(s, np, config)) { + printf("np_reader_no_verification() for verifying modification failed\n"); + TEST_ERROR; + } + + /* Start verifying deletion */ + for (dd = 0, step = s->asteps - 1; dd < s->dattrs; dd++, --step) { + dbgf(2, "Verifying...delete attribute %d\n", step); + + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + decisleep(config->tick_len * s->update_interval); + + result = verify_attr_dsets_action(DELETE_ATTR, s, ds, step); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying deletion failed\n"); + TEST_ERROR; + } + } + } + + return true; + +error: + + return false; +} /* verify_dsets_operations() */ + +/* + * Verify the "action" for each of the datasets specified on the command line. + * -p: compact dataset + * -g: contiguous dataset + * -k: 5 chunked datasets with 5 indexing types */ static bool verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) @@ -1317,7 +1503,8 @@ static bool verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned int which) { unsigned int read_which; - char vl_which[sizeof("attr-9999999999")]; + unsigned int tmp_val; + char tmp_vl_val[sizeof("attr-9999999999")]; char * read_vl_which = NULL; bool is_vl = false; hid_t aid = H5I_INVALID_HID; @@ -1339,14 +1526,19 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned if ((is_vl = H5Tis_variable_str(atid))) { if (action == ADD_ATTR) - HDsprintf(vl_which, "%u", which); + HDsprintf(tmp_vl_val, "%u", which); else - HDsprintf(vl_which, "%u %c", which, 'M'); + HDsprintf(tmp_vl_val, "%u %c", which, 'M'); if ((read_vl_which = HDmalloc(sizeof("9999999999"))) == NULL) { HDprintf("HDmalloc failed\n"); TEST_ERROR; } + } else { + if (action == MODIFY_ATTR) + tmp_val = which + 1; + else + tmp_val = which; } if (H5Aread(aid, atid, is_vl ? (void *)&read_vl_which : (void *)&read_which) < 0) { @@ -1365,11 +1557,14 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned } if (is_vl) { - if (!HDstrcmp(vl_which, read_vl_which)) + dbgf(2, "read_vl_which = %s, tmp_vl_val= %s\n", read_vl_which, tmp_vl_val); + if (!HDstrcmp(read_vl_which, tmp_vl_val)) ret = true; } - else - ret = (read_which == which); + else { + dbgf(2, "read_which = %u, tmp_val = %u\n", read_which, tmp_val); + ret = (read_which == tmp_val); + } if (read_vl_which) HDfree(read_vl_which); @@ -1452,9 +1647,8 @@ verify_storage_cont(unsigned action, hid_t did, unsigned int which, unsigned max /* Verify dense storage & no cont */ else if (which == max_compact) ret = verify_storage_cont_real(did, which, max_compact); - - /* For deletion */ } + /* For deletion */ else if (action == DELETE_ATTR) { /* Verify compact storage & cont */ @@ -1792,7 +1986,7 @@ main(int argc, char **argv) } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, FALSE, 128, "./attrdset-shadow"); + init_vfd_swmr_config(&config, 4, 7, writer, true, 128, "./attrdset-shadow"); /* 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) { @@ -1835,137 +2029,18 @@ main(int argc, char **argv) } if (writer) { - for (step = 0; step < s.asteps; step++) { - dbgf(2, "Adding attribute %d\n", step); - - result = attr_dsets_action(ADD_ATTR, &s, &ds, step); - - if (s.use_np && !np_writer(result, step, &s, &np, &config)) { - HDprintf("np_writer() for addition failed\n"); - TEST_ERROR; - } - } - - if (s.mod_attr) { - - /* Need to sync up writer/reader before moving onto the next phase */ - if (s.use_np && !np_writer(true, 0, &s, &np, &config)) { - HDprintf("np_writer() for modification failed\n"); - TEST_ERROR; - } - - /* Start modification */ - for (step = 0; step < s.asteps; step++) { - dbgf(2, "Modifying attribute %d\n", step); - - result = attr_dsets_action(MODIFY_ATTR, &s, &ds, step); - - if (s.use_np && !np_writer(result, step, &s, &np, &config)) { - HDprintf("np_writer() for modification failed\n"); - TEST_ERROR; - } - } + if(!perform_dsets_operations(&s, &ds, &config, &np)) { + printf("perform_dsets_operations() failed\n"); + TEST_ERROR; } - if (s.dattrs) { - - /* Need to sync up writer/reader before moving onto the next phase */ - if (s.use_np && !np_writer(true, 0, &s, &np, &config)) { - HDprintf("np_writer() for deletion failed\n"); - TEST_ERROR; - } - - /* Start deletion */ - for (dd = 0, step = s.asteps - 1; dd < s.dattrs; dd++, --step) { - dbgf(2, "Deleting attribute %d\n", step); - - result = attr_dsets_action(DELETE_ATTR, &s, &ds, step); - - if (s.use_np && !np_writer(result, step, &s, &np, &config)) { - HDprintf("np_writer() for deletion failed\n"); - TEST_ERROR; - } - } - } } else { - - /* Start verifying addition */ - for (step = 0; step < s.asteps; step++) { - dbgf(2, "Verifying...attribute %d\n", step); - - if (s.use_np && !np_confirm_verify_notify(np.fd_writer_to_reader, step, &s, &np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } - - /* Wait for a few ticks for the update to happen */ - decisleep(config.tick_len * s.update_interval); - - result = verify_attr_dsets_action(ADD_ATTR, &s, &ds, step); - - if (s.use_np && !np_reader(result, step, &s, &np)) { - HDprintf("np_reader() for verifying addition failed\n"); - TEST_ERROR; - } - } - - if (s.mod_attr) { - /* Need to sync up writer/reader before moving onto the next phase */ - if (!np_reader_no_verification(&s, &np, &config)) { - HDprintf("np_reader_no_verification() for verifying modification failed\n"); - TEST_ERROR; - } - - /* Start verifying modification */ - for (step = 0; step < s.asteps; step++) { - dbgf(2, "Verifying...modify attribute %d\n", step); - - if (s.use_np && !np_confirm_verify_notify(np.fd_writer_to_reader, step, &s, &np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } - - /* Wait for a few ticks for the update to happen */ - decisleep(config.tick_len * s.update_interval); - - result = verify_attr_dsets_action(MODIFY_ATTR, &s, &ds, step); - - if (s.use_np && !np_reader(result, step, &s, &np)) { - HDprintf("np_reader() for verifying modification failed\n"); - TEST_ERROR; - } - } + if(!verify_dsets_operations(&s, &ds, &config, &np)) { + printf("verify_dsets_operations() failed\n"); + TEST_ERROR; } - if (s.dattrs) { - - /* Need to sync up writer/reader before moving onto the next phase */ - if (!np_reader_no_verification(&s, &np, &config)) { - HDprintf("np_reader_no_verification() for verifying modification failed\n"); - TEST_ERROR; - } - - /* Start verifying deletion */ - for (dd = 0, step = s.asteps - 1; dd < s.dattrs; dd++, --step) { - dbgf(2, "Verifying...delete attribute %d\n", step); - - if (s.use_np && !np_confirm_verify_notify(np.fd_writer_to_reader, step, &s, &np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } - - /* Wait for a few ticks for the update to happen */ - decisleep(config.tick_len * s.update_interval); - - result = verify_attr_dsets_action(DELETE_ATTR, &s, &ds, step); - - if (s.use_np && !np_reader(result, step, &s, &np)) { - HDprintf("np_reader() for verifying deletion failed\n"); - TEST_ERROR; - } - } - } } if (!close_dsets(&ds)) { diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index e6fd0a8..d3a9ce8 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -1094,7 +1094,7 @@ main(int argc, char **argv) } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, s.writer, FALSE, 128, "./bigset-shadow-%zu", i); + init_vfd_swmr_config(&config, 4, 7, s.writer, TRUE, 128, "./bigset-shadow-%zu", i); /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, 4096, &config); diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c index a02a042..1496fcd 100644 --- a/test/vfd_swmr_dsetchks_writer.c +++ b/test/vfd_swmr_dsetchks_writer.c @@ -74,6 +74,7 @@ typedef struct { bool use_np; /* For -N option */ bool use_vfd_swmr; /* For -S option */ bool use_filter; /* For -o option */ + bool flush_raw_data; /* For -U option */ bool single_index; /* -s option: create a chunked dataset with single chunk index */ bool implicit_index; /* -i option: create a chunked datasets with implicit chunk index */ @@ -99,9 +100,9 @@ typedef struct { { \ .filename = "", .file = H5I_INVALID_HID, .filetype = H5T_NATIVE_UINT32, \ .update_interval = READER_WAIT_TICKS, .csteps = 1, .use_np = true, .use_vfd_swmr = true, \ - .use_filter = false, .single_index = false, .implicit_index = false, .fa_index = false, \ - .ea_index = false, .bt2_index = false, .rows = 10, .cols = 5, .gwrites = 0, .pwrites = 0, \ - .twrites = 0, .lwrites = 0, .xincrs = 0, .ydecrs = 0 \ + .use_filter = false, .flush_raw_data = true, .single_index = false, .implicit_index = false, \ + .fa_index = false, .ea_index = false, .bt2_index = false, .rows = 10, .cols = 5, .gwrites = 0, \ + .pwrites = 0, .twrites = 0, .lwrites = 0, .xincrs = 0, .ydecrs = 0 \ } /* Structure to hold info for different dataset types */ @@ -166,7 +167,7 @@ static void setup_selection(unsigned action, unsigned which, const state_t *s, c static void check_set_edge_block(const state_t *s, const dsets_state_t *ds, unsigned i, unsigned j, hsize_t *block); static void check_set_partial_block(unsigned action, const hsize_t *dims, hsize_t *block, hsize_t *start); -static bool write_dset(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, +static bool write_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, hsize_t *block); static bool write_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds); @@ -174,12 +175,12 @@ static bool dsets_extent(unsigned action, const state_t *s, const dsets_state_t static bool dset_extent_real(unsigned action, hid_t did, const hsize_t *chunk_dims); static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, - np_state_t *np); + np_state_t *np, bool fileclosed); -static bool verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); -static bool verify_read_dset(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, - hsize_t *count, hsize_t *block); -static bool verify_read_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds); +static bool verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed); +static bool verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, + hsize_t *count, hsize_t *block, bool fileclosed, bool flush_raw_data); +static bool verify_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds, bool fileclosed); static bool verify_dsets_extent(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); static bool verify_dset_extent_real(unsigned action, hid_t did, unsigned rows, unsigned cols, unsigned which); @@ -195,7 +196,7 @@ usage(const char *progname) " [-m rows] [-n cols]\n" " [-g gwrites] [-p pwrites] [-t twrites] [-l lwrites]\n" " [-x xincrs] [-y decrs]\n" - " [-u nticks] [-c csteps] [-S] [-N] [-q] [-b] [-o]\n", + " [-u nticks] [-c csteps] [-U] [-S] [-N] [-q] [-b] [-o]\n", progname); fprintf( @@ -218,6 +219,7 @@ usage(const char *progname) " (default is 4)\n" "-c csteps: `csteps` steps communication interval between reader and writer\n" " (default is 1)\n" + "-U: disable flush of raw data (default is flushing raw data)\n" "-S: do not use VFD SWMR\n" "-N: do not use named pipes for test synchronization\n" "-q: silence printouts, few messages\n" @@ -263,18 +265,22 @@ state_init(state_t *s, int argc, char **argv) { unsigned long tmp; int ch; - char tfile[PATH_MAX]; + char *tfile = NULL; char * end; - char * base; - if (H5_basename(tfile, base) < 0) + *s = ALL_HID_INITIALIZER; + + if (H5_basename(argv[0], &tfile) < 0) { + HDprintf("H5_basename failed\n"); TEST_ERROR + } - *s = ALL_HID_INITIALIZER; - esnprintf(tfile, sizeof(tfile), "%s", argv[0]); - esnprintf(s->progname, sizeof(s->progname), "%s", base); + esnprintf(s->progname, sizeof(s->progname), "%s", tfile); - while ((ch = getopt(argc, argv, "siferom:n:x:y:g:p:t:l:bqSNu:c:")) != -1) { + if (tfile) + HDfree(tfile); + + while ((ch = getopt(argc, argv, "siferom:n:x:y:g:p:t:l:bqSNUu:c:")) != -1) { switch (ch) { case 's': /* A chunked dataset with single index */ @@ -313,6 +319,10 @@ state_init(state_t *s, int argc, char **argv) s->use_vfd_swmr = false; break; + case 'U': /* Disable flush of raw data */ + s->flush_raw_data = false; + break; + case 'N': /* Disable named pipes synchronization */ s->use_np = false; break; @@ -374,8 +384,6 @@ state_init(state_t *s, int argc, char **argv) argc -= optind; argv += optind; - HDfree(base); - /* Require to specify at least -s or -i or -f or -e or -r option */ if (!s->single_index && !s->implicit_index && !s->fa_index && !s->ea_index && !s->bt2_index) { printf("Require to specify at least -s or -i or -f or -e or -r option\n"); @@ -444,6 +452,8 @@ state_init(state_t *s, int argc, char **argv) return true; error: + if (tfile) + HDfree(tfile); return false; } /* state_init() */ @@ -1010,28 +1020,28 @@ write_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, u setup_selection(action, which, s, ds, start, stride, count, block); if (s->implicit_index) { - if (!write_dset(action, ds->implicit_did, s->filetype, start, stride, count, block)) { + if (!write_chunks(action, ds->implicit_did, s->filetype, start, stride, count, block)) { printf("H5Dwrite to chunked dataset: implicit index dataset failed\n"); TEST_ERROR; } } if (s->fa_index) { - if (!write_dset(action, ds->fa_did, s->filetype, start, stride, count, block)) { + if (!write_chunks(action, ds->fa_did, s->filetype, start, stride, count, block)) { printf("H5Dwrite to chunked dataset: fa index dataset failed\n"); TEST_ERROR; } } if (s->ea_index) { - if (!write_dset(action, ds->ea_did, s->filetype, start, stride, count, block)) { + if (!write_chunks(action, ds->ea_did, s->filetype, start, stride, count, block)) { printf("H5Dwrite to chunked dataset: ea index dataset failed\n"); TEST_ERROR; } } if (s->bt2_index) { - if (!write_dset(action, ds->bt2_did, s->filetype, start, stride, count, block)) { + if (!write_chunks(action, ds->bt2_did, s->filetype, start, stride, count, block)) { printf("H5Dwrite to chunked dataset: bt2 index dataset failed\n"); TEST_ERROR; } @@ -1169,7 +1179,7 @@ check_set_partial_block(unsigned action, const hsize_t *chunk_dims, hsize_t *blo * Make the selection and then write to the dataset. */ static bool -write_dset(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, +write_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, hsize_t *block) { hid_t sid = badhid; @@ -1238,7 +1248,7 @@ error: return false; -} /* write_dset() */ +} /* write_chunks() */ /* * Increase or decrease the dimenion sizes for the specified datasets. @@ -1370,7 +1380,7 @@ write_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds) if (action == PWRITES || action == LWRITES) check_set_partial_block(action, block, block, start); - if (!write_dset(action, ds->single_did, s->filetype, start, stride, count, block)) { + if (!write_chunks(action, ds->single_did, s->filetype, start, stride, count, block)) { printf("H5Dwrite to dataset with single index dataset failed\n"); TEST_ERROR; } @@ -1403,7 +1413,7 @@ error: * --DECR_EXT: verify the decrease to dataset dimensions sizes */ static bool -verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed) { unsigned step; unsigned allowed_writes; @@ -1423,14 +1433,16 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if (!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_read_dset_single(GWRITES, s, ds); + result = verify_dset_single(GWRITES, s, ds, fileclosed); if (s->use_np && !np_reader(result, 0, s, np)) { printf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } /* Verify a single partial chunk write to dataset with single index */ @@ -1439,19 +1451,22 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->pwrites || s->lwrites) { dbgf(2, "Verify single partial chunk write to dataset with single index; only verify 1 write\n"); - if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { + if(s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if (!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_read_dset_single(PWRITES, s, ds); + result = verify_dset_single(PWRITES, s, ds, fileclosed); if (s->use_np && !np_reader(result, 0, s, np)) { printf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } + } if (!result) + TEST_ERROR; } } @@ -1471,15 +1486,18 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_chunks(GWRITES, s, ds, step); + result = verify_dsets_chunks(GWRITES, s, ds, step, fileclosed); if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for verification failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } @@ -1496,15 +1514,18 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_chunks(PWRITES, s, ds, step); + result = verify_dsets_chunks(PWRITES, s, ds, step, fileclosed); if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for verification failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } @@ -1521,15 +1542,18 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_chunks(TWRITES, s, ds, step); + result = verify_dsets_chunks(TWRITES, s, ds, step, fileclosed); if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for verification failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } @@ -1547,15 +1571,18 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_chunks(LWRITES, s, ds, step); + result = verify_dsets_chunks(LWRITES, s, ds, step, fileclosed); if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for verification failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } @@ -1569,6 +1596,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } + /* Wait for a few ticks for the update to happen */ decisleep(config->tick_len * s->update_interval); @@ -1577,7 +1605,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } @@ -1596,10 +1625,11 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co result = verify_dsets_extent(DECR_EXT, s, ds, step + 1); - if (s->use_np && !np_reader(result, step, s, np)) { + if (s->use_np && !np_reader(result, step, s, np)) { printf("np_reader() for verification failed\n"); TEST_ERROR; - } + } else if (!result) + TEST_ERROR; } } } @@ -1620,7 +1650,7 @@ error: * LWRITEs: verify `which` write that covers multiple partial chunks */ static bool -verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) +verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed) { hsize_t start[2] = {0, 0}; hsize_t stride[2] = {0, 0}; @@ -1633,29 +1663,29 @@ verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, setup_selection(action, which, s, ds, start, stride, count, block); if (s->implicit_index) { - if (!verify_read_dset(action, ds->implicit_did, s->filetype, start, stride, count, block)) { - printf("verify_read_dset() to dataset with implicit index failed\n"); + if (!verify_chunks(action, ds->implicit_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + printf("verify_chunks() to dataset with implicit index failed\n"); TEST_ERROR; } } if (s->fa_index) { - if (!verify_read_dset(action, ds->fa_did, s->filetype, start, stride, count, block)) { - printf("verify_read_dset() to dataset with fixed array index failed\n"); + if (!verify_chunks(action, ds->fa_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + printf("verify_chunks() to dataset with fixed array index failed\n"); TEST_ERROR; } } if (s->ea_index) { - if (!verify_read_dset(action, ds->ea_did, s->filetype, start, stride, count, block)) { - printf("verify_read_dset() to dataset with extensible array index failed\n"); + if (!verify_chunks(action, ds->ea_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + printf("verify_chunks() to dataset with extensible array index failed\n"); TEST_ERROR; } } if (s->bt2_index) { - if (!verify_read_dset(action, ds->bt2_did, s->filetype, start, stride, count, block)) { - printf("verify_read_dset() to dataset with bt2 index failed\n"); + if (!verify_chunks(action, ds->bt2_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + printf("verify_chunks() to dataset with bt2 index failed\n"); TEST_ERROR; } } @@ -1672,8 +1702,8 @@ error: * Verify the data read from the dataset is as expected. */ static bool -verify_read_dset(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, - hsize_t *block) +verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, + hsize_t *block, bool fileclosed, bool flush_raw_data) { hid_t mem_sid = badhid; hid_t sid = badhid; @@ -1719,17 +1749,32 @@ verify_read_dset(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t /* Verify the data read in `rbuf` is as the fill value expected */ for (i = 0; i < block[0] * block[1]; i++) { - if (action == GWRITES || action == TWRITES) { - if (rbuf[i] != FILL_FULL) { - printf("Invalid value for dataset for GWRITES/TWRITES\n"); - TEST_ERROR; + if(flush_raw_data || fileclosed) { + if (action == GWRITES || action == TWRITES) { + if (rbuf[i] != FILL_FULL) { + printf("Invalid value for dataset for GWRITES/TWRITES: %d\n", rbuf[i]); + TEST_ERROR; + } } - } - else { - HDassert(action == PWRITES || action == LWRITES); - if (rbuf[i] != FILL_PARTIAL) { - printf("Invalid value for dataset for GWRITES/TWRITES\n"); - TEST_ERROR; + else { + HDassert(action == PWRITES || action == LWRITES); + if (rbuf[i] != FILL_PARTIAL) { + printf("Invalid value for dataset for GWRITES/TWRITES: %d\n", rbuf[i]); + TEST_ERROR; + } + } + } else { /* No flush && not closing file */ + if (action == GWRITES || action == TWRITES) { + if (rbuf[i] != FILL_FULL && rbuf[i] != FILL_INIT) { + printf("Invalid value for dataset for GWRITES/TWRITES\n"); + TEST_ERROR; + } + } + else { + if (rbuf[i] != FILL_PARTIAL && rbuf[i] != FILL_INIT) { + printf("Invalid value for dataset for GWRITES/TWRITES\n"); + TEST_ERROR; + } } } } @@ -1762,7 +1807,7 @@ error: return false; -} /* verify_read_dset() */ +} /* verify_chunks() */ /* * Verify the increase or decrease of dimenion sizes for the specified datasets. @@ -1877,7 +1922,7 @@ error: * Verify that the data read from the dataset with single index is as unexpected. */ static bool -verify_read_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds) +verify_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds, bool fileclosed) { hsize_t block[2] = {s->rows, s->cols}; hsize_t count[2] = {1, 1}; @@ -1890,7 +1935,7 @@ verify_read_dset_single(unsigned action, const state_t *s, const dsets_state_t * if (action == PWRITES) check_set_partial_block(action, block, block, start); - if (!verify_read_dset(action, ds->single_did, s->filetype, start, stride, count, block)) { + if (!verify_chunks(action, ds->single_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { printf("verify_read_dset() to dataset with single index failed\n"); TEST_ERROR; } @@ -1900,7 +1945,7 @@ verify_read_dset_single(unsigned action, const state_t *s, const dsets_state_t * error: return false; -} /* verify_read_dset_single() */ +} /* verify_dset_single() */ /* * Named pipes handling @@ -2126,6 +2171,90 @@ error: } /* np_confirm_verify_notify() */ /* + * When flush of raw data is disabled, the following is done by the writer and reader: + * Writer: + * Close the file + * Notify the reader that the file is closed + * Reader: + * Confirm the message from the writer that the file is closed + * Verify the data + */ +static bool +closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +{ + HDassert(s->use_np); + + if(writer) { + if (!close_dsets(ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + dbgf(2, "Writer closes the file (flush of raw data is disabled)\n"); + if (H5Fclose(s->file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + /* Bump up the value of notify to tell the reader the file is closed */ + dbgf(2, "Writer notifies reader that the file is closed (flush of raw data is disabled)\n"); + np->notify++; + if (HDwrite(np->fd_writer_to_reader, &np->notify, sizeof(int)) < 0) { + printf("HDwrite failed\n"); + TEST_ERROR; + } + + if (!np_close(np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } + + } else { + /* Wait for a few ticks for the file to close in writer */ + decisleep(config->tick_len * s->update_interval); + + dbgf(2, "Reader checks notify value from writer (flush of raw data is disabled)\n"); + if (!np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Close the named pipes */ + if (!np_close(np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } + + /* Turn off named pipes */ + s->use_np = false; + + /* Verify the dataset again without named pipes */ + dbgf(2, "Reader verifies data after writer closes the file (flush of raw data is disabled)\n"); + if(!verify_dsets_operations(s, ds, config, np, true)) { + printf("verify_dsets_operations() failed\n"); + TEST_ERROR + } + + if (!close_dsets(ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + dbgf(2, "Reader closes the file (flush of raw data is disabled)\n"); + if (H5Fclose(s->file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + } + + return true; + +error: + return false; + +} /* closing_on_noflush() */ +/* * Main */ int @@ -2156,7 +2285,7 @@ main(int argc, char **argv) } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, FALSE, 128, "./dsetchks-shadow"); + init_vfd_swmr_config(&config, 4, 7, writer, s.flush_raw_data, 128, "./dsetchks-shadow"); /* 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) { @@ -2207,17 +2336,12 @@ main(int argc, char **argv) } else { - if (!verify_dsets_operations(&s, &ds, &config, &np)) { + if (!verify_dsets_operations(&s, &ds, &config, &np, false)) { printf("perform_dsets_operations() failed\n"); TEST_ERROR; } } - if (!close_dsets(&ds)) { - printf("close_dsets() failed\n"); - TEST_ERROR; - } - if (H5Pclose(fapl) < 0) { printf("H5Pclose failed\n"); TEST_ERROR; @@ -2228,14 +2352,31 @@ main(int argc, char **argv) TEST_ERROR; } - if (H5Fclose(s.file) < 0) { - printf("H5Fclose failed\n"); - TEST_ERROR; - } + /* When flush of raw data is disabled, special handling is performed + * via closing_on_noflush() when closing the file. + * Nothing needs to be done for -x or -y options + * (increase and decrease dataset dimension sizes). + */ + if(!s.flush_raw_data && !s.xincrs && !s.ydecrs && s.use_np) { - if (s.use_np && !np_close(&np, writer)) { - printf("np_close() failed\n"); - TEST_ERROR; + if(!closing_on_noflush(writer, &s, &ds, &config, &np)) + TEST_ERROR + } else { + + if (!close_dsets(&ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + if (H5Fclose(s.file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + if (s.use_np && !np_close(&np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } } return EXIT_SUCCESS; diff --git a/test/vfd_swmr_dsetops_writer.c b/test/vfd_swmr_dsetops_writer.c index 26f8977..9aded9b 100644 --- a/test/vfd_swmr_dsetops_writer.c +++ b/test/vfd_swmr_dsetops_writer.c @@ -46,8 +46,9 @@ typedef struct { unsigned int csteps; /* For -c option */ bool use_np; /* For -N option */ bool use_vfd_swmr; /* For -S option */ + bool flush_raw_data; /* For -U option */ bool compact; /* -p option: create compact dataset */ - bool compact_write; /* -o option: write to the whole compact dataset */ + bool compact_write; /* -t option: write to the whole compact dataset */ unsigned int compact_elmts; /* -e option: # of elments for the compact dataset */ bool contig; /* -g option: create contiguous dataset */ bool chunked; /* -k option: create chunked datasets with 5 indexing types */ @@ -57,6 +58,7 @@ typedef struct { unsigned int rwrites; /* -r option: random writes to contiguous and/or chunked datasets */ unsigned int lwrites; /* -l option: hyperslab writes to contiguous and/or chunked datasets */ unsigned int wwrites; /* -w option: modify raw data to contiguous and/or chunked datasets */ + unsigned int lastwrite; /* The last operation (-s, -r, -l or -w) performed. */ } state_t; /* Initializations for state_t */ @@ -65,8 +67,9 @@ typedef struct { { \ .filename = "", .file = H5I_INVALID_HID, .filetype = H5T_NATIVE_UINT32, \ .update_interval = READER_WAIT_TICKS, .csteps = 1, .use_np = true, .use_vfd_swmr = true, \ - .compact = false, .compact_write = false, .compact_elmts = MAX_COMPACT_ELMS, .contig = false, \ - .rows = 256, .cols = 512, .swrites = 0, .rwrites = 0, .lwrites = 0, .wwrites = 0 \ + .flush_raw_data = true, .compact = false, .compact_write = false, \ + .compact_elmts = MAX_COMPACT_ELMS, .contig = false, .rows = 10, .cols = 5, .swrites = 0, \ + .rwrites = 0, .lwrites = 0, .wwrites = 0, .lastwrite = 0 \ } /* Structure to hold info for different dataset types */ @@ -132,8 +135,7 @@ static bool open_dset_real(const state_t *s, hid_t *did, hid_t *sid, const char static bool close_dsets(const dsets_state_t *ds); static bool close_dset_real(hid_t did, hid_t sid); -static bool write_dset_contig_chunked(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, - np_state_t *np); +static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); static bool dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned step); static bool dset_setup(unsigned action, unsigned which, const state_t *s, hsize_t *start, hsize_t *stride, hsize_t *count, hsize_t *block, hid_t *mem_sid, unsigned int **buf); @@ -141,12 +143,15 @@ static bool write_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsiz hsize_t *count, hsize_t *block, unsigned int *buf); static bool write_dset_compact(const state_t *s, const dsets_state_t *ds); -static bool verify_write_dset_contig_chunked(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, - np_state_t *np); -static bool verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); -static bool verify_read_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, - hsize_t *stride, hsize_t *count, hsize_t *block, unsigned int *vbuf); -static bool verify_read_dset_compact(const state_t *s, const dsets_state_t *ds); +static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, + H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed); +static bool verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, + unsigned which, bool fileclosed); +static bool verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, + size_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, bool flush_raw_data); +static bool verify_dset_compact(const state_t *s, const dsets_state_t *ds, bool fileclosed, bool flush_raw_data); + +static bool closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); static const hid_t badhid = H5I_INVALID_HID; @@ -174,7 +179,7 @@ usage(const char *progname) " [-p] [-e elmts] [-o]\n" " [-g] [-k] [-m rows] [-n cols]\n" " [-s swrites] [-r rwrites] [-l lwrites] [-w writes]\n" - " [-u nticks] [-c csteps] [-S] [-N] [-q] [-b]\n" + " [-u nticks] [-c csteps] [-U] [-S] [-N] [-q] [-b]\n" "\n" "-p: create a dataset with compact layout\n" "-e elmts: # of for the compact dataset\n" @@ -193,6 +198,7 @@ usage(const char *progname) " (default is 4)\n" "-c csteps: `csteps` steps communication interval between reader and writer\n" " (default is 1)\n" + "-U: disable flush of raw data (default is flushing raw data)\n" "-S: do not use VFD SWMR\n" "-N: do not use named pipes for test synchronization\n" "-q: silence printouts, few messages\n" @@ -215,7 +221,7 @@ state_init(state_t *s, int argc, char **argv) { unsigned long tmp; int ch; - char * tfile; + char * tfile = NULL; char * end; *s = ALL_HID_INITIALIZER; @@ -227,7 +233,10 @@ state_init(state_t *s, int argc, char **argv) esnprintf(s->progname, sizeof(s->progname), "%s", tfile); - while ((ch = getopt(argc, argv, "pte:gkm:n:s:r:l:w:bqSNu:c:")) != -1) { + if (tfile) + HDfree(tfile); + + while ((ch = getopt(argc, argv, "pte:gkm:n:s:r:l:w:bqSNUu:c:")) != -1) { switch (ch) { case 'p': /* compact dataset */ @@ -246,6 +255,10 @@ state_init(state_t *s, int argc, char **argv) s->chunked = true; break; + case 'U': /* Disable flush of raw data */ + s->flush_raw_data = false; + break; + case 'q': verbosity = 0; break; @@ -329,6 +342,20 @@ state_init(state_t *s, int argc, char **argv) TEST_ERROR; } + /* Enable compact write (-t) without compact dataset (-p) */ + if (s->compact_write && !s->compact) { + printf("Enable compact write without compact dataset\n"); + usage(s->progname); + goto error; + } + + /* Enable sequential/random/hyperslab/raw data writes (-s/-r/-l/-w) without contiguous/chunked dataset (-g/-k) */ + if ((s->swrites || s->rwrites || s->lwrites || s->wwrites) && !(s->contig || s->chunked)) { + printf("Enable sequential/random/hypuerslab/raw data writes without contiguous/chunked dataset\n"); + usage(s->progname); + goto error; + } + /* -c cannot be zero */ if (!s->csteps) { HDprintf("communication interval cannot be zero\n"); @@ -365,6 +392,9 @@ state_init(state_t *s, int argc, char **argv) return true; error: + if (tfile) + HDfree(tfile); + return false; } /* state_init() */ @@ -818,6 +848,8 @@ error: */ /* + * Write to whole compact dataset + * * Perform writes for contiguous and chunked datasets: * --SEQ_WRITE: sequential writes * --RANDOM_WRITE: random writes @@ -825,86 +857,105 @@ error: * --MODIFY_DATA: raw data modifications */ static bool -write_dset_contig_chunked(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { unsigned step; bool result; + + /* Perform writes to the whole compact dataset */ + if (s->compact) { - HDassert(s->contig || s->chunked); - - /* Perform sequential writes for contiguous and/or chunked datasets */ - if (s->swrites) { - - for (step = 0; (step < s->swrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Sequential writes %u to dataset\n", step); + if(s->compact_write) { + dbgf(2, "Writes all to compact dataset\n"); - result = dsets_action(SEQ_WRITE, s, ds, step); + result = write_dset_compact(s, ds); - if (s->use_np && !np_writer(result, step, s, np, config)) { - HDprintf("np_writer() for sequential writes failed\n"); + if (s->use_np && !np_writer(result, 0, s, np, config)) { + printf("np_writer() for addition failed\n"); TEST_ERROR; } } } - /* Perform random writes for contiguous and/or chunked datasets */ - if (s->rwrites) { - unsigned newstep; + /* Perform writes for contiguous and/or chunked datasets */ + if (s->contig || s->chunked) { - /* Set up random seed which will be the same for both writer and reader */ - HDsrandom(RANDOM_SEED); + /* Perform sequential writes */ + if (s->swrites) { - for (step = 0; (step < s->rwrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Random writes %u to dataset\n", step); + for (step = 0; (step < s->swrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Sequential writes %u to dataset\n", step); - newstep = (unsigned int)HDrandom() % (s->rows * s->cols); - HDprintf("Random step is %u\n", newstep); - result = dsets_action(RANDOM_WRITE, s, ds, newstep); + result = dsets_action(SEQ_WRITE, s, ds, step); - if (s->use_np && !np_writer(result, step, s, np, config)) { - HDprintf("np_writer() for random writes failed\n"); - TEST_ERROR; + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for sequential writes failed\n"); + TEST_ERROR; + } } } - } - /* Perform hyperslab writes for contiguous and/or chunked datasets */ - if (s->lwrites) { - unsigned k; + /* Perform random writes */ + if (s->rwrites) { + unsigned newstep; - for (step = 0, k = 0; (step < s->lwrites && k < (s->rows * s->cols)); step++, k += s->cols) { - dbgf(2, "Hyperslab writes %u to dataset\n", step); + /* Set up random seed which will be the same for both writer and reader */ + HDsrandom(RANDOM_SEED); - result = dsets_action(HYPER_WRITE, s, ds, k); + for (step = 0; (step < s->rwrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Random writes %u to dataset\n", step); - if (s->use_np && !np_writer(result, step, s, np, config)) { - HDprintf("np_writer() for hyperslab writes failed\n"); - TEST_ERROR; + newstep = (unsigned int)HDrandom() % (s->rows * s->cols); + dbgf(2, "Random step is %u\n", newstep); + result = dsets_action(RANDOM_WRITE, s, ds, newstep); + + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for random writes failed\n"); + TEST_ERROR; + } } } - } - /* Perform raw data modifications for contiguous and/or chunked datasets */ - if (s->wwrites) { + /* Perform hyperslab writes */ + if (s->lwrites) { + unsigned k; - for (step = 0; (step < s->wwrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Modify raw data %u to dataset\n", step); + for (step = 0, k = 0; (step < s->lwrites && k < (s->rows * s->cols)); step++, k += s->cols) { + dbgf(2, "Hyperslab writes %u to dataset\n", step); - result = dsets_action(MODIFY_DATA, s, ds, step); + result = dsets_action(HYPER_WRITE, s, ds, k); - if (s->use_np && !np_writer(result, step, s, np, config)) { - HDprintf("np_writer() for modify raw data failed\n"); - TEST_ERROR; + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for hyperslab writes failed\n"); + TEST_ERROR; + } } } - } + /* Perform raw data modifications */ + if (s->wwrites) { + + for (step = 0; (step < s->wwrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Modify raw data %u to dataset\n", step); + + result = dsets_action(MODIFY_DATA, s, ds, step); + + if (s->use_np && !np_writer(result, step, s, np, config)) { + printf("np_writer() for modify raw data failed\n"); + TEST_ERROR; + } + } + } + + } + return true; error: + return false; -} /* write_dset_contig_chunked() */ +} /* perform_dsets_operations() */ /* * Perform the "action" for each of the datasets specified on the command line: @@ -1128,6 +1179,8 @@ error: */ /* + * Verify writes to the compact dataset. + * * Verify writes for contiguous and chunked datasets: * --SEQ_WRITE: sequential writes * --RANDOM_WRITE: random writes @@ -1135,109 +1188,156 @@ error: * --MODIFY_DATA: raw data modifications */ static bool -verify_write_dset_contig_chunked(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed) { unsigned step; bool result; - HDassert(s->contig || s->chunked); - - /* Start verifying sequential writes for contiguous and/or chunked datasets */ - if (s->swrites) { + /* Start verifying data written to the compact dataset */ + if (s->compact) { - for (step = 0; (step < s->swrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Verify sequential writes %u to dataset\n", step); + if(s->compact_write) { + dbgf(2, "Verify writes to compact dataset\n"); - if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_action(SEQ_WRITE, s, ds, step); + result = verify_dset_compact(s, ds, fileclosed, config->flush_raw_data); - if (s->use_np && !np_reader(result, step, s, np)) { - HDprintf("np_reader() for verifying addition failed\n"); + if (s->use_np && !np_reader(result, 0, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } else if (!result) TEST_ERROR; - } } } - /* Start verifying random writes for contiguous and/or chunked datasets */ - if (s->rwrites) { - unsigned newstep; + /* Verify writes for contiguous and/or chunked datasets */ + if (s->contig || s->chunked) { - /* Set up random seed which will be the same for both writer and reader */ - HDsrandom(RANDOM_SEED); + /* Start verifying sequential writes */ + /* When flush of raw data is disabled, only verify data for the last write operation on file close */ + if ((s->swrites && !fileclosed) || (fileclosed && s->lastwrite == SEQ_WRITE)) { - for (step = 0; (step < s->rwrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Verify random writes %u to dataset\n", step); + s->lastwrite = SEQ_WRITE; - newstep = (unsigned int)HDrandom() % (s->rows * s->cols); - HDprintf("Random step is %u\n", newstep); + for (step = 0; (step < s->swrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Verify sequential writes %u to dataset\n", step); - if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } - /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + /* Wait for a few ticks for the update to happen */ + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); - result = verify_dsets_action(RANDOM_WRITE, s, ds, newstep); + result = verify_dsets_action(SEQ_WRITE, s, ds, step, fileclosed); - if (s->use_np && !np_reader(result, step, s, np)) { - HDprintf("np_reader() for verifying addition failed\n"); - TEST_ERROR; + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } else if (!result) + TEST_ERROR; } } - } - /* Start verifying hyperslab writes for contiguous and/or chunked datasets */ - if (s->lwrites) { - unsigned k; + /* Start verifying random writes */ + /* When flush of raw data is disabled, only verify data for the last write operation on file close */ + if ((s->rwrites && !fileclosed) || (fileclosed && s->lastwrite == RANDOM_WRITE)) { + unsigned newstep; - for (step = 0, k = 0; (step < s->lwrites && k < (s->rows * s->cols)); step++, k += s->cols) { - dbgf(2, "Verify hyperslab writes %u to dataset\n", step); + s->lastwrite = RANDOM_WRITE; - if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } + /* Set up random seed which will be the same for both writer and reader */ + HDsrandom(RANDOM_SEED); - /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + for (step = 0; (step < s->rwrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Verify random writes %u to dataset\n", step); - result = verify_dsets_action(HYPER_WRITE, s, ds, k); + newstep = (unsigned int)HDrandom() % (s->rows * s->cols); + dbgf(2, "Random step is %u\n", newstep); - if (s->use_np && !np_reader(result, step, s, np)) { - HDprintf("np_reader() for verifying addition failed\n"); - TEST_ERROR; + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); + + result = verify_dsets_action(RANDOM_WRITE, s, ds, newstep, fileclosed); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } else if (!result) + TEST_ERROR; } } - } - /* Start verifying raw data modifications for contiguous and/or chunked datasets */ - if (s->wwrites) { + /* Start verifying hyperslab writes */ + /* When flush of raw data is disabled, only verify data for the last write operation on file close */ + if ((s->lwrites && !fileclosed) || (fileclosed && s->lastwrite == HYPER_WRITE)) { + unsigned k; - for (step = 0; (step < s->wwrites && step < (s->rows * s->cols)); step++) { - dbgf(2, "Verify raw data modification %u to dataset\n", step); + s->lastwrite = HYPER_WRITE; - if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; + for (step = 0, k = 0; (step < s->lwrites && k < (s->rows * s->cols)); step++, k += s->cols) { + dbgf(2, "Verify hyperslab writes %u to dataset\n", step); + + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); + + result = verify_dsets_action(HYPER_WRITE, s, ds, k, fileclosed); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } else if (!result) + TEST_ERROR; } + } - /* Wait for a few ticks for the update to happen */ - decisleep(config->tick_len * s->update_interval); + /* Start verifying raw data modifications */ + /* When flush of raw data is disabled, only verify data for the last write operation on file close */ + if ((s->wwrites && !fileclosed) || (fileclosed && s->lastwrite == MODIFY_DATA)) { - result = verify_dsets_action(MODIFY_DATA, s, ds, step); + s->lastwrite = MODIFY_DATA; - if (s->use_np && !np_reader(result, step, s, np)) { - HDprintf("np_reader() for verifying addition failed\n"); - TEST_ERROR; + for (step = 0; (step < s->wwrites && step < (s->rows * s->cols)); step++) { + dbgf(2, "Verify raw data modification %u to dataset\n", step); + + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, step, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Wait for a few ticks for the update to happen */ + if(!fileclosed) + decisleep(config->tick_len * s->update_interval); + + result = verify_dsets_action(MODIFY_DATA, s, ds, step, fileclosed); + + if (s->use_np && !np_reader(result, step, s, np)) { + printf("np_reader() for verifying addition failed\n"); + TEST_ERROR; + } else if (!result) + TEST_ERROR; } } } @@ -1247,7 +1347,7 @@ verify_write_dset_contig_chunked(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_con error: return false; -} /* verify_write_dset_contig_chunked() */ +} /* Verify_dsets_operations() */ /* * Verify the data read from each of the datasets specified on the command line @@ -1258,7 +1358,7 @@ error: * MODIFY_DATA: `which` raw data modification */ static bool -verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which) +verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed) { hsize_t start[2]; hsize_t stride[2]; @@ -1275,9 +1375,9 @@ verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, /* Verify the data read for the contiguous dataset */ if (s->contig) { - if (!verify_read_dset(ds->contig_did, s->filetype, mem_sid, ds->contig_sid, start, stride, count, - block, vbuf)) { - HDprintf("H5Dwrite to contiguous dataset failed\n"); + if (!verify_dset(ds->contig_did, s->filetype, mem_sid, ds->contig_sid, start, stride, count, + block, vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to contiguous dataset failed\n"); TEST_ERROR; } } @@ -1285,33 +1385,33 @@ verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, /* Verify the data read for the chunked datasets */ if (s->chunked) { - if (!verify_read_dset(ds->single_did, s->filetype, mem_sid, ds->single_sid, start, stride, count, - block, vbuf)) { - HDprintf("H5Dwrite to chunked dataset: single index dataset failed\n"); + if (!verify_dset(ds->single_did, s->filetype, mem_sid, ds->single_sid, start, stride, count, + block, vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to chunked dataset: single index dataset failed\n"); TEST_ERROR; } - if (!verify_read_dset(ds->implicit_did, s->filetype, mem_sid, ds->implicit_sid, start, stride, count, - block, vbuf)) { - HDprintf("H5Dwrite to chunked dataset: implicit index dataset failed\n"); + if (!verify_dset(ds->implicit_did, s->filetype, mem_sid, ds->implicit_sid, start, stride, count, + block, vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to chunked dataset: implicit index dataset failed\n"); TEST_ERROR; } - if (!verify_read_dset(ds->fa_did, s->filetype, mem_sid, ds->fa_sid, start, stride, count, block, - vbuf)) { - HDprintf("H5Dwrite to chunked dataset: fa index dataset failed\n"); + if (!verify_dset(ds->fa_did, s->filetype, mem_sid, ds->fa_sid, start, stride, count, block, + vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to chunked dataset: fa index dataset failed\n"); TEST_ERROR; } - if (!verify_read_dset(ds->ea_did, s->filetype, mem_sid, ds->ea_sid, start, stride, count, block, - vbuf)) { - HDprintf("H5Dwrite to chunked dataset: ea index dataset failed\n"); + if (!verify_dset(ds->ea_did, s->filetype, mem_sid, ds->ea_sid, start, stride, count, block, + vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to chunked dataset: ea index dataset failed\n"); TEST_ERROR; } - if (!verify_read_dset(ds->bt2_did, s->filetype, mem_sid, ds->bt2_sid, start, stride, count, block, - vbuf)) { - HDprintf("H5Dwrite to chunked dataset: bt2 index dataset failed\n"); + if (!verify_dset(ds->bt2_did, s->filetype, mem_sid, ds->bt2_sid, start, stride, count, block, + vbuf, fileclosed, s->flush_raw_data)) { + printf("verify_dset() to chunked dataset: bt2 index dataset failed\n"); TEST_ERROR; } } @@ -1329,13 +1429,14 @@ error: } /* verify_dsets_action() */ + /* * Verify the data read from the dataset is as expected. * `vbuf` contains the data expected from the read. */ static bool -verify_read_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, - hsize_t *count, hsize_t *block, unsigned int *vbuf) +verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, + hsize_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, bool flush_raw_data) { unsigned int *rbuf = NULL; unsigned i; @@ -1365,9 +1466,15 @@ verify_read_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *s } /* Verify the data read in `rbuf` is as `vbuf` */ - for (i = 0; i < count[1]; i++) - if (rbuf[i] != vbuf[i]) - TEST_ERROR; + for (i = 0; i < count[1]; i++) { + if(flush_raw_data || fileclosed) { + if (rbuf[i] != vbuf[i]) + TEST_ERROR; + } else { /* No flush && not closing file */ + if (rbuf[i] != vbuf[i] && rbuf[0] != 0) /* FILL VALUE ?? */ + TEST_ERROR; + } + } if (rbuf) HDfree(rbuf); @@ -1379,17 +1486,23 @@ error: HDfree(rbuf); return false; -} /* verify_read_dset() */ +} /* verify_dset() */ /* * Verify that the data read from the compact dataset is as unexpected. */ static bool -verify_read_dset_compact(const state_t *s, const dsets_state_t *ds) +verify_dset_compact(const state_t *s, const dsets_state_t *ds, bool fileclosed, bool flush_raw_data) { unsigned int *rbuf; unsigned i; + /* Refresh the dataset */ + if (H5Drefresh(ds->compact_did) < 0) { + printf("H5Drefresh dataset failed\n"); + TEST_ERROR; + } + if ((rbuf = HDmalloc(s->compact_elmts * sizeof(unsigned int))) == NULL) { HDprintf("HDmalloc buffer for compact dataset failed\n"); goto error; @@ -1400,11 +1513,18 @@ verify_read_dset_compact(const state_t *s, const dsets_state_t *ds) TEST_ERROR; } - for (i = 0; i < s->compact_elmts; i++) - if (rbuf[i] != (i + 1)) { - HDprintf("Invalid value for compact dataset element\n"); - TEST_ERROR; + for (i = 0; i < s->compact_elmts; i++) { + if(flush_raw_data || fileclosed) { + if (rbuf[i] != (i + 1)) { + printf("Invalid value for compact dataset element\n"); + TEST_ERROR; + } + } else { /* No flush && not closing file */ + if (rbuf[i] != (i + 1) && rbuf[0] != 0) /* FILL VALUE ?? */ + TEST_ERROR; + } + } if (rbuf) HDfree(rbuf); @@ -1416,7 +1536,7 @@ error: HDfree(rbuf); return false; -} /* verify_read_dset_compact() */ +} /* verify_dset_compact() */ /* * Named pipes handling @@ -1535,9 +1655,8 @@ np_writer(bool result, unsigned step, const state_t *s, np_state_t *np, H5F_vfd_ HDwrite(np->fd_writer_to_reader, &np->notify, sizeof(int)); goto error; } - /* The action succeeds */ } - else { + else { /* The action succeeds */ /* At communication interval, notify the reader and wait for its response */ if (step % s->csteps == 0) { /* Bump up the value of notify to tell the reader to start reading */ @@ -1642,6 +1761,91 @@ error: } /* np_confirm_verify_notify() */ /* + * When flush of raw data is disabled, the following is done by the writer and reader: + * Writer: + * Close the file + * Notify the reader that the file is closed + * Reader: + * Confirm the message from the writer that the file is closed + * Verify the data + */ +static bool +closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +{ + HDassert(s->use_np); + + if(writer) { + if (!close_dsets(ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + dbgf(2, "Writer closes the file (flush of raw data is disabled)\n"); + if (H5Fclose(s->file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + /* Bump up the value of notify to tell the reader the file is closed */ + dbgf(2, "Writer notifies reader that the file is closed (flush of raw data is disabled)\n"); + np->notify++; + if (HDwrite(np->fd_writer_to_reader, &np->notify, sizeof(int)) < 0) { + printf("HDwrite failed\n"); + TEST_ERROR; + } + + if (!np_close(np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } + + } else { + /* Wait for a few ticks for the file to close in writer ?? need to this or not? */ + decisleep(config->tick_len * s->update_interval); + + dbgf(2, "Reader checks notify value from writer (flush of raw data is disabled)\n"); + if (!np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { + printf("np_confirm_verify_notify() verify/notify not in sync failed\n"); + TEST_ERROR; + } + + /* Close the named pipes */ + if (!np_close(np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } + + /* Turn off named pipes */ + s->use_np = false; + + /* Verify the dataset again without named pipes */ + dbgf(2, "Reader verifies data after writer closes the file (flush of raw data is disabled)\n"); + if(!verify_dsets_operations(s, ds, config, np, true)) { + printf("verify_dsets_operations() failed\n"); + TEST_ERROR + } + + if (!close_dsets(ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + dbgf(2, "Reader closes the file (flush of raw data is disabled)\n"); + if (H5Fclose(s->file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + } + + return true; + +error: + return false; + +} /* closing_on_noflush() */ + +/* * Main */ int @@ -1655,7 +1859,6 @@ main(int argc, char **argv) H5F_vfd_swmr_config_t config; np_state_t np; dsets_state_t ds; - bool result; if (!state_init(&s, argc, argv)) { HDprintf("state_init() failed\n"); @@ -1674,7 +1877,7 @@ main(int argc, char **argv) } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, FALSE, 128, "./dsetops-shadow"); + init_vfd_swmr_config(&config, 4, 7, writer, s.flush_raw_data, 128, "./dsetops-shadow"); /* 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) { @@ -1718,62 +1921,19 @@ main(int argc, char **argv) if (writer) { - /* Perform writes to the whole compact dataset */ - if (s.compact && s.compact_write) { - dbgf(2, "Writes all to compact dataset\n"); - - result = write_dset_compact(&s, &ds); - - if (s.use_np && !np_writer(result, 0, &s, &np, &config)) { - HDprintf("np_writer() for addition failed\n"); - TEST_ERROR; - } - } - - if (s.contig || s.chunked) { - /* Perform writes for contiguous and/or chunked datasets */ - if (!write_dset_contig_chunked(&s, &ds, &config, &np)) { - HDprintf("write_dset_contig_chunked() failed\n"); - TEST_ERROR; - } + if(!perform_dsets_operations(&s, &ds, &config, &np)) { + printf("perform_dsets_operations() failed\n"); + TEST_ERROR; } } else { - /* Start verifying data written to the compact dataset */ - if (s.compact && s.compact_write) { - dbgf(2, "Verify writes to compact dataset\n"); - - if (s.use_np && !np_confirm_verify_notify(np.fd_writer_to_reader, 0, &s, &np)) { - HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); - TEST_ERROR; - } - /* Wait for a few ticks for the update to happen */ - decisleep(config.tick_len * s.update_interval); - - result = verify_read_dset_compact(&s, &ds); - - if (s.use_np && !np_reader(result, 0, &s, &np)) { - HDprintf("np_reader() for verifying addition failed\n"); - TEST_ERROR; - } - } - - if (s.contig || s.chunked) { - - /* Verify writes for contiguous and/or chunked datasets */ - if (!verify_write_dset_contig_chunked(&s, &ds, &config, &np)) { - HDprintf("verify_write_dset_contig_chunked() failed\n"); - TEST_ERROR; - } + if(!verify_dsets_operations(&s, &ds, &config, &np, false)) { + printf("perform_dsets_operations() failed\n"); + TEST_ERROR; } } - if (!close_dsets(&ds)) { - HDprintf("close_dsets() failed\n"); - TEST_ERROR; - } - if (H5Pclose(fapl) < 0) { HDprintf("H5Pclose failed\n"); TEST_ERROR; @@ -1784,14 +1944,26 @@ main(int argc, char **argv) TEST_ERROR; } - if (H5Fclose(s.file) < 0) { - HDprintf("H5Fclose failed\n"); - TEST_ERROR; - } + if(!s.flush_raw_data && s.use_np) { - if (s.use_np && !np_close(&np, writer)) { - HDprintf("np_close() failed\n"); - TEST_ERROR; + if(!closing_on_noflush(writer, &s, &ds, &config, &np)) + TEST_ERROR + } else { + + if (!close_dsets(&ds)) { + printf("close_dsets() failed\n"); + TEST_ERROR; + } + + if (H5Fclose(s.file) < 0) { + printf("H5Fclose failed\n"); + TEST_ERROR; + } + + if (s.use_np && !np_close(&np, writer)) { + printf("np_close() failed\n"); + TEST_ERROR; + } } return EXIT_SUCCESS; diff --git a/test/vfd_swmr_generator.c b/test/vfd_swmr_generator.c index 4b87072..16b1d4b 100644 --- a/test/vfd_swmr_generator.c +++ b/test/vfd_swmr_generator.c @@ -126,7 +126,7 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, int 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, FALSE, 128, "generator-shadow"); + init_vfd_swmr_config(config, 4, 10, vfd_swmr_write, TRUE, 128, "generator-shadow"); } /* use_latest_format, use_vfd_swmr, only_meta_page, page_buf_size, config */ diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c index c758781..55ea314 100644 --- a/test/vfd_swmr_group_writer.c +++ b/test/vfd_swmr_group_writer.c @@ -4985,7 +4985,7 @@ main(int argc, char **argv) } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(&config, 4, 7, writer, FALSE, 128, "./group-shadow"); + init_vfd_swmr_config(&config, 4, 7, writer, TRUE, 128, "./group-shadow"); /* 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 cc4d918..6265cae 100644 --- a/test/vfd_swmr_reader.c +++ b/test/vfd_swmr_reader.c @@ -320,7 +320,7 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5, FALSE, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); /* 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 b729ee4..4389b05 100644 --- a/test/vfd_swmr_remove_reader.c +++ b/test/vfd_swmr_remove_reader.c @@ -304,7 +304,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, uns 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); /* 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 b8b1303..8df8fa8 100644 --- a/test/vfd_swmr_remove_writer.c +++ b/test/vfd_swmr_remove_writer.c @@ -87,7 +87,7 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old H5_ATTR_UNUSE 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); /* 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 a39b357..943c375 100644 --- a/test/vfd_swmr_sparse_reader.c +++ b/test/vfd_swmr_sparse_reader.c @@ -208,7 +208,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, uns 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, FALSE, TRUE, 128, "./rw-shadow"); /* 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 53b6ec9..56d19f3 100644 --- a/test/vfd_swmr_sparse_writer.c +++ b/test/vfd_swmr_sparse_writer.c @@ -87,7 +87,7 @@ open_skeleton(const char *filename, unsigned verbose) 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); /* 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 5a112cd..c3ee2ed 100644 --- a/test/vfd_swmr_vlstr_reader.c +++ b/test/vfd_swmr_vlstr_reader.c @@ -116,7 +116,7 @@ main(int argc, char **argv) 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, FALSE, 128, "./vlstr-shadow"); + init_vfd_swmr_config(&config, 4, 7, false, TRUE, 128, "./vlstr-shadow"); /* 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 f338428..4f7376e 100644 --- a/test/vfd_swmr_vlstr_writer.c +++ b/test/vfd_swmr_vlstr_writer.c @@ -185,7 +185,7 @@ main(int argc, char **argv) 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, FALSE, 128, "./vlstr-shadow"); + init_vfd_swmr_config(&config, 4, 7, true, TRUE, 128, "./vlstr-shadow"); /* 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 c5b62c8..4693554 100644 --- a/test/vfd_swmr_writer.c +++ b/test/vfd_swmr_writer.c @@ -89,7 +89,7 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, unsigne 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, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, TRUE, TRUE, 128, "./rw-shadow"); /* 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 d89fd16..13794d9 100644 --- a/test/vfd_swmr_zoo_writer.c +++ b/test/vfd_swmr_zoo_writer.c @@ -474,7 +474,7 @@ 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, FALSE, 128, "./zoo-shadow"); + init_vfd_swmr_config(&vfd_swmr_config, TICK_LEN, 7, writer, TRUE, 128, "./zoo-shadow"); /* ? 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 */ -- cgit v0.12