summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5AC.c31
-rw-r--r--src/H5ACprivate.h1
-rw-r--r--src/H5Fvfd_swmr.c25
-rw-r--r--test/testvfdswmr.sh.in122
4 files changed, 177 insertions, 2 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index c913805..7e1f19b 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -2777,3 +2777,34 @@ H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *i
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_mdc_image_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5AC_set_vfd_swmr_reader
+ *
+ * Purpose: Wrapper function for H5C_set_vfd_swmr_reader().
+ *
+ * Return: SUCCEED on success, and FAIL on failure.
+ *
+ * Programmer: Vailin Choi; Dec 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5AC_set_vfd_swmr_reader(H5AC_t *cache_ptr, hbool_t vfd_swmr_reader, hsize_t page_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache_ptr);
+
+ if(cache_ptr->page_size != page_size) {
+
+ if (H5C_set_vfd_swmr_reader((H5C_t *)cache_ptr, vfd_swmr_reader, page_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set page_size for VFD SWMR reader")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5AC_set_vfd_swmr_reader() */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index f7bed0c..ff632d0 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -433,6 +433,7 @@ H5_DLL herr_t H5AC_unsettle_ring(H5F_t *f, H5AC_ring_t ring);
H5_DLL herr_t H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags,
hbool_t type_match);
H5_DLL herr_t H5AC_get_tag(const void *thing, /*OUT*/ haddr_t *tag);
+H5_DLL herr_t H5AC_set_vfd_swmr_reader(H5AC_t *cache_ptr, hbool_t vfd_swmr_reader, hsize_t page_size);
/* Virtual entry routines */
H5_DLL H5AC_proxy_entry_t *H5AC_proxy_entry_create(void);
diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c
index 43567ac..1a8f127 100644
--- a/src/H5Fvfd_swmr.c
+++ b/src/H5Fvfd_swmr.c
@@ -169,7 +169,7 @@ H5FL_DEFINE(eot_queue_entry_t);
* Return: Success: SUCCEED
* Failure: FAIL
*
- * Programmer: Vailin Choi -- 11/??/18
+ * Programmer: Vailin Choi -- 10/??/18
*
* Changes: None.
*
@@ -252,6 +252,21 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create)
HDassert(!shared->vfd_swmr_config.writer);
+ HDassert(shared->fs_page_size > 0);
+ /* This is a bug uncovered by issue #3 of the group test failures.
+ * See Kent's documentation "Designed to Fail Tests and Issues".
+ * The file opening process in H5F__new() initializes the cache copy of
+ * page_size via H5AC_create(). However, later on H5F__super_read()
+ * may change page size due to non-default setting of
+ * 'free-space manager info' in superblock extension.
+ * Fix: set the cache copy of page_size again if different from
+ * f->shared->fs_page_size.
+ */
+ if(shared->cache) {
+ if (H5AC_set_vfd_swmr_reader(shared->cache, TRUE, shared->fs_page_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set page size in cache for VFD SWMR reader");
+ }
+
shared->vfd_swmr_writer = FALSE;
shared->max_jump_ticks = 0;
@@ -1258,6 +1273,14 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api)
#if 0 /*Kent*/
HDassert(oent->length == nent->length);
#endif
+ /* This is a bug uncovered by issue #1 of the
+ * group test failures. See Kent's documentation
+ * "Designed to Fail Tests and Issues".
+ * nent->length can be <, =, > to oent->length.
+ * Fix: HDassert the 1st two cases: < and =.
+ * John will address the > case.
+ */
+ HDassert(nent->length <= oent->length);
/* the page has been altered -- evict it and
* any contained metadata cache entries.
diff --git a/test/testvfdswmr.sh.in b/test/testvfdswmr.sh.in
index d52527b..955fbb6 100644
--- a/test/testvfdswmr.sh.in
+++ b/test/testvfdswmr.sh.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/us/bin/env bash
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -75,6 +75,13 @@ DSETCHKS_FIFO_WRITER_TO_READER=fifo_dsetchks_writer_to_reader
DSETCHKS_FIFO_READER_TO_WRITER=fifo_dsetchks_reader_to_writer
###############################################################################
+## For gfail{1,2,3,4} test: definitions for fifo files to coordinate test runs
+###############################################################################
+#
+GFAIL_FIFO_WRITER_TO_READER=fifo_group_writer_to_reader
+GFAIL_FIFO_READER_TO_WRITER=fifo_group_reader_to_writer
+
+###############################################################################
## short hands and function definitions
###############################################################################
#
@@ -147,6 +154,7 @@ all_tests="${all_tests} groups groups_attrs groups_ops few_big many_small attrds
# For exhaustive run, add: os_groups_attrs, os_groups_ops, os_groups_seg, dsetops, dsetchks,independ_wr
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
all_tests="${all_tests} os_groups_attrs os_groups_ops os_groups_seg dsetops dsetchks independ_wr"
+ all_tests="${all_tests} gfail_entry_length gfail_page_size"
fi
tests=${all_tests}
@@ -1388,6 +1396,118 @@ fi
###############################################################################
+#
+# "gfail_entry_length" test
+#
+# Only for exhaustive run
+#
+# Verify that the assertion failure for old and new entry length is fixed.
+# (See issue #1 in Kent's documentation "Designed to Fail Tests and Issues".
+#
+###############################################################################
+#
+#
+if [ ${do_gfail_entry_length:-no} = yes ]; then
+ #
+ # Clean up any existing fifo files from previous runs
+ if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
+ rm -f ./$GFAIL_FIFO_WRITER_TO_READER
+ fi
+ if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
+ rm -f ./$GFAIL_FIFO_READER_TO_WRITER
+ fi
+ #
+ echo launch vfd_swmr_gfail_writer -q -m 10 -n 340000
+ catch_out_err_and_rc vfd_swmr_gfail_entry_length_writer \
+ ../vfd_swmr_gfail_writer -q -m 10 -n 340000 &
+ pid_writer=$!
+
+ echo launch vfd_swmr_gfail_reader -m 10 -n 340000
+ catch_out_err_and_rc vfd_swmr_gfail_entry_length_reader \
+ ../vfd_swmr_gfail_reader -m 10 -n 340000 &
+ 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_gfail_entry_length_reader.rc) -ne 0 ]; then
+ echo reader had error
+ nerrors=$((nerrors + 1))
+ fi
+
+ # Collect exit code of the writer
+ if [ $(cat vfd_swmr_gfail_entry_length_writer.rc) -ne 0 ]; then
+ echo writer had error
+ nerrors=$((nerrors + 1))
+ fi
+
+ # Clean up output files
+ rm -f vfd_swmr_gfail_entry_length_writer.{out,rc}
+ rm -f vfd_swmr_gfail_entry_length_reader.*.{out,rc}
+fi
+
+###############################################################################
+#
+# "gfail_page_size" test
+#
+# Only for exhaustive run
+#
+# Verify that the assertion failure is fixed when non-default page size is set.
+# (See issue #3 in Kent's documentation "Designed to Fail Tests and Issues".
+#
+###############################################################################
+#
+#
+if [ ${do_gfail_page_size:-no} = yes ]; then
+ #
+ # Clean up any existing fifo files from previous runs
+ if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
+ rm -f ./$GFAIL_FIFO_WRITER_TO_READER
+ fi
+ if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
+ rm -f ./$GFAIL_FIFO_READER_TO_WRITER
+ fi
+ #
+ echo launch vfd_swmr_gfail_writer -q -m 10 -B 8192 -s 8192 -n 320000
+ catch_out_err_and_rc vfd_swmr_gfail_page_size_writer \
+ ../vfd_swmr_gfail_writer -q -m 10 -B 8192 -s 8192 -n 320000 &
+ pid_writer=$!
+
+ echo launch vfd_swmr_gfail_reader -m 10 -B 8192 -s 8192 -n 320000
+ catch_out_err_and_rc vfd_swmr_gfail_page_size_reader \
+ ../vfd_swmr_gfail_reader -m 10 -B 8192 -s 8192 -n 320000 &
+ 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_gfail_page_size_reader.rc) -ne 0 ]; then
+ echo reader had error
+ nerrors=$((nerrors + 1))
+ fi
+
+ # Collect exit code of the writer
+ if [ $(cat vfd_swmr_gfail_page_size_writer.rc) -ne 0 ]; then
+ echo writer had error
+ nerrors=$((nerrors + 1))
+ fi
+
+ # Clean up output files
+ rm -f vfd_swmr_gfail_page_size_writer.{out,rc}
+ rm -f vfd_swmr_gfail_page_size_reader.*.{out,rc}
+fi
+
+###############################################################################
## Report and exit
###############################################################################
cd ..