Skip to content

Commit

Permalink
Merge pull request #35 from vchoi-hdfgroup/feature/vfd_swmr
Browse files Browse the repository at this point in the history
Feature/vfd swmr
  • Loading branch information
vchoi-hdfgroup authored Aug 10, 2021
2 parents 0212f12 + 704dc8e commit 7a9af2b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/H5Fvfd_swmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "shadow-file allocation failed for index")
}

new_mdf_idx = HDmalloc(new_mdf_idx_len * sizeof(new_mdf_idx[0]));
new_mdf_idx = H5MM_calloc(new_mdf_idx_len * sizeof(new_mdf_idx[0]));

if (new_mdf_idx == NULL) {
(void)H5MV_free(f, idx_addr, idx_size);
Expand All @@ -1774,6 +1774,11 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f)
ret_value = shared->mdf_idx = new_mdf_idx;
shared->mdf_idx_len = new_mdf_idx_len;

H5MM_xfree(f->shared->old_mdf_idx);

shared->old_mdf_idx = old_mdf_idx;
f->shared->old_mdf_idx_len = old_mdf_idx_len;

/* Postpone reclamation of the old index until max_lag ticks from now.
* It's only necessary to wait until after the new index is in place,
* so it's possible that some disused shadow storage will build up
Expand Down
34 changes: 32 additions & 2 deletions test/testvfdswmr.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ all_tests="generator expand shrink expand_shrink sparse vlstr_null vlstr_oob zoo
all_tests="${all_tests} groups groups_attrs groups_ops few_big many_small attrdset"
tests=${all_tests}

# For exhaustive run, add: os_groups_attrs, os_groups_ops, dsetops, dsetchks
# For exhaustive run, add: os_groups_attrs, os_groups_ops, os_groups_seg, dsetops, dsetchks
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
all_tests="${all_tests} os_groups_attrs os_groups_ops dsetops dsetchks"
all_tests="${all_tests} os_groups_attrs os_groups_ops os_groups_seg dsetops dsetchks"
fi

if [ $# -gt 0 ]; then
Expand Down Expand Up @@ -1007,6 +1007,36 @@ for options in ${os_grp_op_list[*]}; do
done


###############################################################################
#
# Setting for "os_groups_seg" test
#
# Only for exhaustive run
#
# Verify the segmentation fault is fixed when running with:
# --1,000,000 groups
# --as writer only
#
###############################################################################
#
#
GROUP_seg_n=1000000 # Number of groups when segmentation fault occurs
if [ ${do_os_groups_seg:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group operations with old-style group: $GROUP_seg_n groups ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -N -G -n $GROUP_seg_n -a $GROUP_seg_n

# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi

# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}

###############################################################################
#
# Setting for bigset (few_big and many_small) tests
Expand Down

0 comments on commit 7a9af2b

Please sign in to comment.