From 77a223347552ceb2029c1d2677f7aec4d3cd6684 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 15 Jun 2016 13:35:25 -0500 Subject: [PATCH 01/21] [svn-r30083] Added BRANCH.txt --- BRANCH.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 BRANCH.txt diff --git a/BRANCH.txt b/BRANCH.txt new file mode 100644 index 0000000000..9efaed892e --- /dev/null +++ b/BRANCH.txt @@ -0,0 +1,8 @@ +evict_on_close + +This branch is for the development of the "evict on close" feature +which will cause the library to evict all cached information +on object close. + +Dana Robinson is in charge of the branch, which follows the trunk. +It will be deleted when the feature is merged to the trunk. From 75aa26981b4becc6926f4100707d9614e84a041c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 15 Jun 2016 13:55:59 -0500 Subject: [PATCH 02/21] [svn-r30084] First pass at the evict-on-close feature. The features is controlled via H5Pset/get_evict_on_close() and is currently enabled by default (it will be disabled by default in the final implementation). There is a bug in the code where the eviction of tagged metadata fails due to some of the metadata being dirty, resulting in error return values and test failures. --- MANIFEST | 1 + src/H5D.c | 30 +++++++++++++-- src/H5Fint.c | 16 ++++++++ src/H5Fpkg.h | 1 + src/H5Fprivate.h | 6 ++- src/H5Fquery.c | 27 ++++++++++++++ src/H5Pfapl.c | 87 +++++++++++++++++++++++++++++++++++++++++++ src/H5Ppublic.h | 2 + test/CMakeTests.cmake | 2 + test/Makefile.am | 2 +- 10 files changed, 168 insertions(+), 6 deletions(-) diff --git a/MANIFEST b/MANIFEST index e3b0195988..13596d0ee0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -900,6 +900,7 @@ ./test/enc_dec_plist.c ./test/enc_dec_plist_cross_platform.c ./test/enum.c +./test/evict_on_close.c ./test/extend.c ./test/external.c ./test/error_test.c diff --git a/src/H5D.c b/src/H5D.c index 23397ad5a0..1ba3829d6e 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -324,21 +324,43 @@ done: herr_t H5Dclose(hid_t dset_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = NULL; /* Dataset */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = dset->oloc.file; + if(1 == dset->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = dset->oloc.addr; + } /* end if */ /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref_always_close(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { + if(H5F_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + if(H5F_evict_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") + } /* end if */ done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index 80c593ba4b..5b7fdda2f7 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -954,6 +954,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_class_t *drvr; /*file driver class info */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ + hbool_t evict_on_close; /* evict on close value from plist */ H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1118,6 +1119,21 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") } /* end if */ + /* Record the evict-on-close MDC behavior. If it's the first time opening + * the file, set it to access property list value; if it's the second time + * or later, verify that the access property list value matches the value + * in shared file structure. + */ + if(H5P_get(a_plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value") + + if(shared->nrefs == 1) { + shared->evict_on_close = evict_on_close; + } else if(shared->nrefs > 1) { + if(shared->evict_on_close != evict_on_close) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file evict-on-close value doesn't match") + } /* end if */ + /* Formulate the absolute path for later search of target file for external links */ if(H5_build_extpath(name, &file->extpath) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index c5aed3ba08..8ec2a930bd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -261,6 +261,7 @@ struct H5F_file_t { /* not change thereafter. */ hid_t fcpl_id; /* File creation property list ID */ H5F_close_degree_t fc_degree; /* File close behavior degree */ + hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */ size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 34a5277146..e3b5547bda 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -279,7 +279,7 @@ #define H5F_ACTUAL_NAME(F) ((F)->actual_name) #define H5F_EXTPATH(F) ((F)->extpath) #define H5F_SHARED(F) ((F)->shared) -#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared)) +#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared) #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) #define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++) #define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--) @@ -303,6 +303,7 @@ #define H5F_SET_SOHM_NINDEXES(F, N) ((F)->shared->sohm_nindexes = (N)) #define H5F_FCPL(F) ((F)->shared->fcpl_id) #define H5F_GET_FC_DEGREE(F) ((F)->shared->fc_degree) +#define H5F_EVICT_ON_CLOSE(F) ((F)->shared->evict_on_close) #define H5F_RDCC_NSLOTS(F) ((F)->shared->rdcc_nslots) #define H5F_RDCC_NBYTES(F) ((F)->shared->rdcc_nbytes) #define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0) @@ -348,6 +349,7 @@ #define H5F_SET_SOHM_NINDEXES(F, N) (H5F_set_sohm_nindexes((F), (N))) #define H5F_FCPL(F) (H5F_get_fcpl(F)) #define H5F_GET_FC_DEGREE(F) (H5F_get_fc_degree(F)) +#define H5F_EVICT_ON_CLOSE(F) (H5F_get_evict_on_close(F)) #define H5F_RDCC_NSLOTS(F) (H5F_rdcc_nslots(F)) #define H5F_RDCC_NBYTES(F) (H5F_rdcc_nbytes(F)) #define H5F_RDCC_W0(F) (H5F_rdcc_w0(F)) @@ -463,6 +465,7 @@ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */ +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */ #define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */ @@ -660,6 +663,7 @@ H5_DLL unsigned H5F_get_sohm_nindexes(const H5F_t *f); H5_DLL herr_t H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes); H5_DLL hid_t H5F_get_fcpl(const H5F_t *f); H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f); +H5_DLL hbool_t H5F_get_evict_on_close(const H5F_t *f); H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f); H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index dd6e8e37b5..f59a9b715e 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -833,6 +833,33 @@ H5F_get_fc_degree(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->fc_degree) } /* end H5F_get_fc_degree() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_evict_on_close + * + * Purpose: Retrieve the 'file close degree' for the file. + * + * Return: Success: Flag indicating whether the evict-on-close + * property was set for the file. + * Failure: (can't happen) + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_get_evict_on_close(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->evict_on_close) +} /* end H5F_get_evict_on_close() */ + /*------------------------------------------------------------------------- * Function: H5F_store_msg_crt_idx diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a315f92ac1..c3108c53fd 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -181,6 +181,11 @@ /* Definition for object flush callback */ #define H5F_ACS_OBJECT_FLUSH_CB_SIZE sizeof(H5F_object_flush_t) #define H5F_ACS_OBJECT_FLUSH_CB_DEF {NULL, NULL} +/* Definition for evict on close property */ +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE sizeof(hbool_t) +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_DEF TRUE +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC H5P__encode_hbool_t +#define H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC H5P__decode_hbool_t #ifdef H5_HAVE_PARALLEL /* Definition of collective metadata read mode flag */ #define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) @@ -296,6 +301,7 @@ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMA static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ static const H5F_object_flush_t H5F_def_object_flush_cb_g = H5F_ACS_OBJECT_FLUSH_CB_DEF; /* Default setting for object flush callback */ +static const hbool_t H5F_def_evict_on_close_flag_g = H5F_ACS_EVICT_ON_CLOSE_FLAG_DEF; /* Default setting for evict on close property */ #ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ @@ -462,6 +468,12 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the evict on close flag */ + if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, @@ -3605,6 +3617,81 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_obj_flush_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_evict_on_close + * + * Purpose: + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", fapl_id, evict_on_close); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_evict_on_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_evict_on_close + * + * Purpose: + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", fapl_id, evict_on_close); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, evict_on_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_evict_on_close() */ + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 0318c8fbd8..b807a37142 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -353,6 +353,8 @@ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata); H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata); +H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); +H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index e42d8b1868..dacf4ba960 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -603,6 +603,7 @@ set (H5TEST_TESTS ohdr stab gheap + evict_on_close farray earray btree2 @@ -955,6 +956,7 @@ if (HDF5_TEST_VFD) ohdr stab gheap + evict_on_close pool # accum farray diff --git a/test/Makefile.am b/test/Makefile.am index 37bf539dab..a7c39f392e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,7 +42,7 @@ check_SCRIPTS = $(TEST_SCRIPT) # As an exception, long-running tests should occur earlier in the list. # This gives them more time to run when tests are executing in parallel. TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \ - farray earray btree2 fheap \ + evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ From f9312d49d52ba6e6af4549907dd73a4901db6f70 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 08:30:11 -0500 Subject: [PATCH 03/21] [svn-r30105] Datatypes and Groups now support evict-on-close. --- src/H5G.c | 32 ++++++++++++++++++++++++++++++-- src/H5T.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/H5G.c b/src/H5G.c index 9bbd43fc8e..e4313fe6f4 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -715,15 +715,29 @@ done: herr_t H5Gclose(hid_t group_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5G_t *grp = NULL; /* Group */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == H5I_object_verify(group_id,H5I_GROUP)) + if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id,H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = grp->oloc.file; + if(1 == grp->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = grp->oloc.addr; + } /* end if */ + /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. @@ -731,6 +745,20 @@ H5Gclose(hid_t group_id) if(H5I_dec_app_ref(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(file); + if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(file); + if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(file); + } /* end if */ + done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ diff --git a/src/H5T.c b/src/H5T.c index 775cfdb6c9..2fbc19383e 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1712,8 +1712,11 @@ done: herr_t H5Tclose(hid_t type_id) { - H5T_t *dt; /* Pointer to datatype to close */ - herr_t ret_value = SUCCEED; /* Return value */ + H5T_t *dt; /* Pointer to datatype to close */ + H5F_t *file = NULL; /* File */ + hbool_t evict = FALSE; /* Evict metadata on close? */ + haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", type_id); @@ -1724,10 +1727,34 @@ H5Tclose(hid_t type_id) if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + /* Check if this is the last object reference and we'll be evicting + * on close. We need to cache this info since it will be gone after the + * decrement call frees the struct. + */ + file = dt->oloc.file; + if(file && 1 == dt->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { + evict = TRUE; + tag = dt->oloc.addr; + } /* end if */ + /* When the reference count reaches zero the resources are freed */ if(H5I_dec_app_ref(type_id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") + /* Clean up metadata in the metadata cache if evicting on close */ + if(evict && H5F_SHARED(file)) { +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(file); + if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(file); + if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(file); + } /* end if */ + done: FUNC_LEAVE_API(ret_value) } /* end H5Tclose() */ From b236c2160102a5ed6dd6bce7b0fea0613424981e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 09:54:33 -0500 Subject: [PATCH 04/21] [svn-r30106] Moved datatype close code to new internal function. H5Oclose() now supports evict-on-close for datatypes. --- src/H5O.c | 8 ++++++-- src/H5T.c | 49 +++++++++++++++++++++++++++++++++++++----------- src/H5Tprivate.h | 1 + 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index d1806a1382..aa30e79e0f 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1069,14 +1069,18 @@ H5Oclose(hid_t object_id) /* Get the type of the object and close it in the correct way */ switch(H5I_get_type(object_id)) { case H5I_GROUP: - case H5I_DATATYPE: case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; - + case H5I_DATATYPE: + if(H5I_object(object_id) == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") + if(H5T_close_id(object_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + break; case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5T.c b/src/H5T.c index 2fbc19383e..dca1a30d60 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1696,21 +1696,49 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tclose + * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ herr_t H5Tclose(hid_t type_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", type_id); + + /* Call internal function */ + if(H5T_close_id(type_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Tclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_close_id + * + * Purpose: Internal function to free a datatype and all associated + * memory. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_close_id(hid_t type_id) { H5T_t *dt; /* Pointer to datatype to close */ H5F_t *file = NULL; /* File */ @@ -1718,8 +1746,7 @@ H5Tclose(hid_t type_id) haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", type_id); + FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -1756,8 +1783,8 @@ H5Tclose(hid_t type_id) } /* end if */ done: - FUNC_LEAVE_API(ret_value) -} /* end H5Tclose() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_close_id() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 17826ae3a2..45d8d768b2 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -108,6 +108,7 @@ H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); +H5_DLL herr_t H5T_close_id(hid_t type_id); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); From 35f8a064c505e46c438caae8aca01ab85974bca8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 11:15:52 -0500 Subject: [PATCH 05/21] [svn-r30107] Moved dataset flush and evict code to H5D_close from H5Dclose. --- src/H5D.c | 44 ++++++++------------------------------------ src/H5Dint.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index e389930e38..44e4baa38c 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -308,45 +308,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dclose + * Function: H5Dclose * - * Purpose: Closes access to a dataset (DATASET_ID) and releases - * resources used by it. It is illegal to subsequently use that - * same dataset ID in calls to other dataset functions. + * Purpose: Closes access to a dataset (DATASET_ID) and releases + * resources used by it. It is illegal to subsequently use that + * same dataset ID in calls to other dataset functions. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ herr_t H5Dclose(hid_t dset_id) { - H5D_t *dset = NULL; /* Dataset */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = dset->oloc.file; - if(1 == dset->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = dset->oloc.addr; - } /* end if */ - /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. @@ -354,20 +340,6 @@ H5Dclose(hid_t dset_id) if(H5I_dec_app_ref_always_close(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - done: FUNC_LEAVE_API(ret_value) } /* end H5Dclose() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 6f088af40b..b089c109db 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1775,9 +1775,9 @@ done: herr_t H5D_close(H5D_t *dataset) { - hbool_t free_failed = FALSE; - hbool_t corked; /* Whether the dataset is corked or not */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t free_failed = FALSE; /* Set if freeing sub-components failed */ + hbool_t corked; /* Whether the dataset is corked or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1792,6 +1792,7 @@ H5D_close(H5D_t *dataset) dataset->shared->fo_count--; if(dataset->shared->fo_count == 0) { + /* Flush the dataset's information. Continue to close even if it fails. */ if(H5D__flush_real(dataset, H5AC_ind_read_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") @@ -1886,12 +1887,12 @@ H5D_close(H5D_t *dataset) (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) || (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0); - /* Uncork cache entries with object address tag */ - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") - if(corked) - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + /* Uncork cache entries with object address tag */ + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + if(corked) + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") /* * Release datatype, dataspace and creation property list -- there isn't @@ -1912,6 +1913,21 @@ H5D_close(H5D_t *dataset) if(H5O_close(&(dataset->oloc)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") + /* Evict dataset metadata if evicting on close */ + if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { +// printf("tag: 0x%3llx\n", dataset->oloc.addr); +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(dataset->oloc.file); + if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(dataset->oloc.file); + if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(dataset->oloc.file); + } /* end if */ + /* * Free memory. Before freeing the memory set the file pointer to NULL. * We always check for a null file pointer in other H5D functions to be @@ -1919,8 +1935,8 @@ H5D_close(H5D_t *dataset) * above). */ dataset->oloc.file = NULL; - dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1938,16 +1954,16 @@ H5D_close(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location") } /* end else */ - /* Release the dataset's path info */ - if(H5G_name_free(&(dataset->path)) < 0) - free_failed = TRUE; + /* Release the dataset's path info */ + if(H5G_name_free(&(dataset->path)) < 0) + free_failed = TRUE; /* Free the dataset's memory structure */ dataset = H5FL_FREE(H5D_t, dataset); /* Check if anything failed in the middle... */ if(free_failed) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.") done: FUNC_LEAVE_NOAPI(ret_value) From 88c8c78763dcfc0e42906a1b07b117896f6f3dac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 22:41:48 -0500 Subject: [PATCH 06/21] [svn-r30108] Moved group flush and evict code to H5G_close from H5Gclose. --- src/H5Dint.c | 2 +- src/H5G.c | 30 +----------------------------- src/H5Gint.c | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index b089c109db..bbe16cf0d6 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1915,7 +1915,7 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { -// printf("tag: 0x%3llx\n", dataset->oloc.addr); +// printf("EVICTING DATASET (TAG: 0x%3llx)\n", dataset->oloc.addr); // printf("DUMPING CACHE - BEFORE FLUSH\n"); // H5AC_dump_cache(dataset->oloc.file); if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) diff --git a/src/H5G.c b/src/H5G.c index e4313fe6f4..1955c33b53 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -715,29 +715,15 @@ done: herr_t H5Gclose(hid_t group_id) { - H5G_t *grp = NULL; /* Group */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id,H5I_GROUP))) + if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = grp->oloc.file; - if(1 == grp->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = grp->oloc.addr; - } /* end if */ - /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. @@ -745,20 +731,6 @@ H5Gclose(hid_t group_id) if(H5I_dec_app_ref(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index f5bccc3d09..ff92eccbab 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -486,7 +486,7 @@ H5G_close(H5G_t *grp) if(0 == grp->shared->fo_count) { HDassert(grp != H5G_rootof(H5G_fileof(grp))); - /* Uncork cache entries with object address tag */ + /* Uncork cache entries with object address tag */ if(H5AC_cork(grp->oloc.file, grp->oloc.addr, H5AC__GET_CORKED, &corked) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") if(corked) @@ -500,6 +500,23 @@ H5G_close(H5G_t *grp) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + + /* Evict group metadata if evicting on close */ + if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { +// printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + } /* end if */ + + /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { /* Decrement the ref. count for this object in the top file */ From 3d13b7c6eeedda3037d2db2ea5bd30a36ebde5c0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 27 Jun 2016 16:04:52 -0500 Subject: [PATCH 07/21] [svn-r30110] Added missing evict_on_close.c file to test/. --- test/evict_on_close.c | 144 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 test/evict_on_close.c diff --git a/test/evict_on_close.c b/test/evict_on_close.c new file mode 100644 index 0000000000..bcbd0308d2 --- /dev/null +++ b/test/evict_on_close.c @@ -0,0 +1,144 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Dana Robinson + * Spring 2016 + * + * Purpose: Tests the basic operation of the evict-on-close cache + * behavior. Tests that ensure the tagging is handled correctly + * are located in cache.c. + */ + +#include "h5test.h" + +static herr_t check_evict_on_close_api(void); + + +/*------------------------------------------------------------------------- + * Function: check_evict_on_close_api() + * + * Purpose: Verify that the H5Pset/get_evict_on_close() calls behave + * correctly. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +check_evict_on_close_api(void) +{ + hid_t fapl_id = -1; + hid_t dapl_id = -1; + hbool_t evict_on_close; + herr_t status; + + TESTING("evict on close API"); + + /* Create a fapl */ + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_STACK_ERROR; + + /* Check the default */ + evict_on_close = TRUE; + if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) + FAIL_STACK_ERROR; + if(evict_on_close != FALSE) + FAIL_PUTS_ERROR("Incorrect default evict on close value."); + + /* Set the evict on close property */ + evict_on_close = TRUE; + if(H5Pset_evict_on_close(fapl_id, evict_on_close) < 0) + FAIL_STACK_ERROR; + + /* Make sure we can get it back out */ + evict_on_close = FALSE; + if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) + FAIL_STACK_ERROR; + if(evict_on_close != TRUE) + FAIL_PUTS_ERROR("Incorrect evict on close value."); + + /* close fapl */ + if(H5Pclose(fapl_id) < 0) + FAIL_STACK_ERROR; + + /**********************************************/ + /* Trying passing in a non-fapl property list */ + /**********************************************/ + + if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR; + + /* ensure using an incorrect access plist fails */ + H5E_BEGIN_TRY { + status = H5Pset_evict_on_close(dapl_id, evict_on_close); + } H5E_END_TRY; + if(status >= 0) + FAIL_PUTS_ERROR("H5Pset_evict_on_close() accepted invalid access plist."); + + /* ensure an invalid plist fails */ + H5E_BEGIN_TRY { + status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + } H5E_END_TRY; + if(status >= 0) + FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); + + /* close dapl */ + if(H5Pclose(dapl_id) < 0) + FAIL_STACK_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5_FAILED(); + return FAIL; + +} /* check_evict_on_close_api() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Return: EXIT_FAILURE/EXIT_SUCCESS + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrors = 0; + + printf("Testing evict-on-close cache behavior.\n"); + + nerrors += check_evict_on_close_api() < 0 ? 1 : 0; + + if(nerrors) { + printf("***** %u evict-on-close test%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return EXIT_FAILURE; + } + + printf("All evict-on-close tests passed.\n"); + + return EXIT_SUCCESS; +} + From c1c384878ba58193120c3da804d761542c47bd7d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 14 Sep 2016 16:50:29 -0400 Subject: [PATCH 08/21] Added missing evict on close test file line to test/CMakeLists.txt. --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 97471d1f36..19603ca5ab 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -203,6 +203,7 @@ set (H5_TESTS ohdr stab gheap + evict_on_close farray earray btree2 From 12fbb4426aee6be3de235a3818ca43ecfec4b84b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 13:04:07 -0400 Subject: [PATCH 09/21] Updated manifest. Was missing BRANCH.txt. --- MANIFEST | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST b/MANIFEST index fb454c5fdf..3ed99e7024 100644 --- a/MANIFEST +++ b/MANIFEST @@ -25,6 +25,7 @@ ./.autom4te.cfg _DO_NOT_DISTRIBUTE_ ./.h5chkright.ini _DO_NOT_DISTRIBUTE_ ./ACKNOWLEDGMENTS +./BRANCH.txt ./COPYING ./MANIFEST ./Makefile.dist From 73bd8b7c2fe0d5c8763cb2d33fe1915e465947cb Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 13:51:38 -0400 Subject: [PATCH 10/21] Fixed format_convert and fortran files (bad merge?). --- fortran/src/H5Eff.F90 | 2 +- fortran/src/H5Pff.F90 | 8 +- .../testfiles/h5fc_ext1_f.ddl | 2 +- .../testfiles/h5fc_ext1_i.ddl | 2 +- .../testfiles/h5fc_ext1_s.ddl | 2 +- .../testfiles/h5fc_ext2_if.ddl | 2 +- .../testfiles/h5fc_ext2_is.ddl | 2 +- .../testfiles/h5fc_ext2_sf.ddl | 2 +- .../testfiles/h5fc_ext3_isf.ddl | 2 +- .../h5format_convert/testfiles/h5fc_v_all.ddl | 2 +- .../h5format_convert/testfiles/h5fc_v_bt1.ddl | 2 +- .../h5format_convert/testfiles/h5fc_v_err.ddl | 2 +- .../testfiles/h5fc_v_n_1d.ddl | 2 +- .../testfiles/h5fc_v_n_all.ddl | 2 +- .../testfiles/h5fc_v_ndata_bt1.ddl | 2 +- .../testfiles/h5fc_v_non_chunked.ddl | 2 +- .../testfiles/old_h5fc_ext1_f.ddl | 2 +- .../testfiles/old_h5fc_ext1_i.ddl | 2 +- .../testfiles/old_h5fc_ext1_s.ddl | 2 +- .../testfiles/old_h5fc_ext2_if.ddl | 2 +- .../testfiles/old_h5fc_ext2_is.ddl | 2 +- .../testfiles/old_h5fc_ext2_sf.ddl | 2 +- .../testfiles/old_h5fc_ext3_isf.ddl | 2 +- tools/h5format_convert/testh5fc.sh.in | 82 ++++++++++--------- 24 files changed, 69 insertions(+), 65 deletions(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 7a0b15bfcd..d96d448c03 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -141,8 +141,8 @@ CONTAINS INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 END INTERFACE - namelen = LEN(NAME) IF (PRESENT(name)) THEN + namelen = LEN(NAME) hdferr = h5eprint_c1(name, namelen) ELSE hdferr = h5eprint_c2() diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index e052ea09cc..532ecc6dd7 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -6260,11 +6260,11 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of ! of fillvalue datatype ! (in memory) - CHARACTER, INTENT(IN), TARGET :: fillvalue ! Fillvalue + CHARACTER(LEN=1), INTENT(IN), TARGET :: fillvalue ! Fillvalue INTEGER, INTENT(OUT) :: hdferr ! Error code TYPE(C_PTR) :: f_ptr ! C address - f_ptr = C_LOC(fillvalue) + f_ptr = C_LOC(fillvalue(1:1)) hdferr = h5pset_fill_value_c(prp_id, type_id, f_ptr) END SUBROUTINE h5pset_fill_value_char @@ -6275,7 +6275,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of ! of fillvalue datatype ! (in memory) - CHARACTER, INTENT(OUT) :: fillvalue ! Fillvalue + CHARACTER(LEN=*), INTENT(OUT) :: fillvalue ! Fillvalue INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: i @@ -6286,7 +6286,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! To resolve Issue #1 outlined in the preamble of this file we ! need to pack the character string into an array. - chr_len = LEN(fillvalue) + chr_len = LEN(fillvalue(1:1)) ALLOCATE(chr(1:chr_len), STAT=hdferr) IF (hdferr .NE. 0) THEN hdferr = -1 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl +++ b/tools/h5format_convert/testfiles/h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 5e7365dd32..a1af831bf7 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index c501eb0b6a..31de12ade2 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_err.ddl b/tools/h5format_convert/testfiles/h5fc_v_err.ddl index 4a728e8d43..b671db02fb 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_err.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_err.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_ERR... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index ff5da4a6c2..fcdadd80aa 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_EA... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index d2ffbbf68c..074ce6f2b5 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Processing all datasets in the file... Going to process dataset:/DSET_CONTIGUOUS... Open the dataset diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index ba794a7b59..c75699a745 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -1,6 +1,6 @@ Process command line options It is noop... -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index aba0740593..59453897aa 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -1,5 +1,5 @@ Process command line options -Open the file tmp.h5 +Open the file outtmp.h5 Going to process dataset: /DSET_CONTIGUOUS... Open the dataset Retrieve the dataset's layout diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_f.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl index c9060823a3..d1768c8e26 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_i.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 1 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext1_s.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_if.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_is.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl index fb5192d154..dae9284dae 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl index 2fff4acf55..8ec4656fcc 100644 --- a/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl +++ b/tools/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl @@ -1,4 +1,4 @@ -HDF5 "./testfiles/tmp.h5" { +HDF5 "./testfiles/dmptmp.h5" { SUPER_BLOCK { SUPERBLOCK_VERSION 2 FREELIST_VERSION 0 diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in index 000425b1ba..0d74697baa 100644 --- a/tools/h5format_convert/testh5fc.sh.in +++ b/tools/h5format_convert/testh5fc.sh.in @@ -69,7 +69,10 @@ TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR # Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place +TMPOUTFILE=outtmp.h5 TMPFILE=tmp.h5 +TMPCHKFILE=chktmp.h5 +TMPDMPFILE=dmptmp.h5 ###################################################################### # test files @@ -170,7 +173,7 @@ CLEAN_TESTFILES_AND_TESTDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=$SRC_H5FORMCONV_TESTFILES INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -213,11 +216,11 @@ TOOLTEST_OUT() { actual_err_sav=${actual_err}-sav # Prepare the test file - $RM $TESTDIR/$TMPFILE + $RM $TESTDIR/$TMPOUTFILE TFILE=$2 if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then - $CP $TESTDIR/$2 $TESTDIR/$TMPFILE - TFILE=$TMPFILE + $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE + TFILE=$TMPOUTFILE fi # Run test. @@ -245,14 +248,15 @@ TOOLTEST_OUT() { # $1 is the test file name # --fname exists # --fname is copied to a temporary file for testing -# $2 to at most $4--options to the tool such as: +# $2 is the temporary file name +# $3 to at most $5--options to the tool such as: # -d dname # -n TOOLTEST() { - TESTING $FORMCONV $2 $3 $4 $1 - $RM $TESTDIR/$TMPFILE - $CP $TESTDIR/$1 $TESTDIR/$TMPFILE - $RUNSERIAL $FORMCONV_BIN $2 $3 $4 $TESTDIR/$TMPFILE + TESTING $FORMCONV $3 $4 $5 $1 + $RM $TESTDIR/$2 + $CP $TESTDIR/$1 $TESTDIR/$2 + $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$2 exitcode=$? if [ $exitcode -ne 0 ]; then echo "*FAILED*" @@ -272,7 +276,7 @@ CHECKING() { # $1 dataset name IDX_CHECK() { CHECKING $1 - $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPFILE $1 + $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPCHKFILE $1 ret=$? if [ $ret -eq 0 ]; then echo " PASSED" @@ -304,7 +308,7 @@ H5DUMP_CHECK() { expect="$TESTDIR/$2" actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" - $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPFILE > $actual 2>$actual_err + $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPDMPFILE > $actual 2>$actual_err cat $actual_err >> $actual # Compare output @@ -387,28 +391,28 @@ TOOLTEST_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v # h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5 # h5format_convert -d /DSET_NONE h5fc_ext_none.h5 # h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5 -TOOLTEST h5fc_ext_none.h5 -d /DSET_EA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_EA IDX_CHECK /DSET_EA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_EA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_EA IDX_CHECK /GROUP/DSET_NDATA_EA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_BT2 +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_BT2 IDX_CHECK /GROUP/DSET_BT2 # -TOOLTEST h5fc_ext_none.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NDATA_BT2 IDX_CHECK /DSET_NDATA_BT2 # -TOOLTEST h5fc_ext_none.h5 -d /DSET_FA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_FA IDX_CHECK /DSET_FA # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_FA +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_FA IDX_CHECK /GROUP/DSET_NDATA_FA # -TOOLTEST h5fc_ext_none.h5 -d /DSET_NONE +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NONE IDX_CHECK /DSET_NONE # -TOOLTEST h5fc_ext_none.h5 -d /GROUP/DSET_NDATA_NONE +TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_NONE IDX_CHECK /GROUP/DSET_NDATA_NONE # # @@ -416,16 +420,16 @@ IDX_CHECK /GROUP/DSET_NDATA_NONE # No output from tests: just check exit code # h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset) # h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset) -TOOLTEST old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -TOOLTEST h5fc_non_v3.h5 -d /DSET_CONTIGUOUS +TOOLTEST old_h5fc_ext_none.h5 $TMPFILE -d /DSET_NDATA_BT2 +TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /DSET_CONTIGUOUS # # # # No output from tests: just check exit code # h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset) # h5format_convert -n h5fc_non_v3.h5 (noop, all datasets) -TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n -TOOLTEST h5fc_non_v3.h5 -n +TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /GROUP/DSET_BT2 -n +TOOLTEST h5fc_non_v3.h5 $TMPFILE -n # # # @@ -433,7 +437,7 @@ TOOLTEST h5fc_non_v3.h5 -n # h5format_convert h5fc_non_v3.h5 # 1) convert all datasets # 2) verify indexing types -TOOLTEST h5fc_non_v3.h5 +TOOLTEST h5fc_non_v3.h5 $TMPCHKFILE IDX_CHECK /DSET_NDATA_EA IDX_CHECK /DSET_NDATA_BT2 IDX_CHECK /GROUP/DSET_BT2 @@ -445,47 +449,47 @@ IDX_CHECK /GROUP/DSET_EA # h5format_convert h5fc_edge_v3.h5 # 1) convert the chunked dataset (filter, no-filter-edge-chunk) # 2) verify the indexing type -TOOLTEST h5fc_edge_v3.h5 +TOOLTEST h5fc_edge_v3.h5 $TMPCHKFILE IDX_CHECK /DSET_EDGE # # # The following test files have messages in the superblock extension. # Verify h5dump output for correctness after conversion -TOOLTEST h5fc_ext1_i.h5 +TOOLTEST h5fc_ext1_i.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl -TOOLTEST h5fc_ext1_s.h5 +TOOLTEST h5fc_ext1_s.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl -TOOLTEST h5fc_ext1_f.h5 +TOOLTEST h5fc_ext1_f.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl # -TOOLTEST h5fc_ext2_if.h5 +TOOLTEST h5fc_ext2_if.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl -TOOLTEST h5fc_ext2_is.h5 +TOOLTEST h5fc_ext2_is.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl -TOOLTEST h5fc_ext2_sf.h5 +TOOLTEST h5fc_ext2_sf.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl # -TOOLTEST h5fc_ext3_isf.h5 +TOOLTEST h5fc_ext3_isf.h5 $TMPDMPFILE H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl # # # -TOOLTEST old_h5fc_ext1_i.h5 +TOOLTEST old_h5fc_ext1_i.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl -TOOLTEST old_h5fc_ext1_s.h5 +TOOLTEST old_h5fc_ext1_s.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl -TOOLTEST old_h5fc_ext1_f.h5 +TOOLTEST old_h5fc_ext1_f.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl # -TOOLTEST old_h5fc_ext2_if.h5 +TOOLTEST old_h5fc_ext2_if.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl -TOOLTEST old_h5fc_ext2_is.h5 +TOOLTEST old_h5fc_ext2_is.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl -TOOLTEST old_h5fc_ext2_sf.h5 +TOOLTEST old_h5fc_ext2_sf.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl # -TOOLTEST old_h5fc_ext3_isf.h5 +TOOLTEST old_h5fc_ext3_isf.h5 $TMPDMPFILE H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl # # Clean up temporary files/directories From 7f99d42583e4ba3d4e6c3e1bb09538db6b42e388 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 14:52:45 -0400 Subject: [PATCH 11/21] Reverted H5T code since datatypes will not be supported at this time. --- src/H5T.c | 90 ++++++++++-------------------------------------- src/H5Tprivate.h | 1 - 2 files changed, 18 insertions(+), 73 deletions(-) diff --git a/src/H5T.c b/src/H5T.c index cc0e782c95..b2575d56c0 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1696,96 +1696,42 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tclose + * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Tclose(hid_t type_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5T_t *dt; /* Pointer to datatype to close */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", type_id); - /* Call internal function */ - if(H5T_close_id(type_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + /* Check args */ + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_STATE_IMMUTABLE == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + + /* When the reference count reaches zero the resources are freed */ + if(H5I_dec_app_ref(type_id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: FUNC_LEAVE_API(ret_value) } /* end H5Tclose() */ - -/*------------------------------------------------------------------------- - * Function: H5T_close_id - * - * Purpose: Internal function to free a datatype and all associated - * memory. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * Summer 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5T_close_id(hid_t type_id) -{ - H5T_t *dt; /* Pointer to datatype to close */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check args */ - if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if(H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") - - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = dt->oloc.file; - if(file && 1 == dt->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = dt->oloc.addr; - } /* end if */ - - /* When the reference count reaches zero the resources are freed */ - if(H5I_dec_app_ref(type_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") - - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_close_id() */ - /*------------------------------------------------------------------------- * Function: H5Tequal diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 5fd0cf311f..7efcb41376 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -108,7 +108,6 @@ H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); -H5_DLL herr_t H5T_close_id(hid_t type_id); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); From 29b169abb3ab8fcb0c1e75693def8829433dd6a0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 15:31:07 -0400 Subject: [PATCH 12/21] Removed blank line in Fortran file (leftover from last commit) --- fortran/src/H5Eff.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index d96d448c03..2fc77f497f 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -136,7 +136,6 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name END FUNCTION h5eprint_c1 END INTERFACE - INTERFACE INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 From 2646f917adb5b2e17404260e433dc3ed7c39a602 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Sep 2016 16:18:30 -0400 Subject: [PATCH 13/21] Cleaned up feature for dissemination to LLNL: - Removed support for datatypes. - Commented out support for groups - General change clean-up - Added a list of improvements to BRANCH.txt --- BRANCH.txt | 14 ++++++++++++++ src/H5Ctag.c | 12 ++++++------ src/H5Gint.c | 18 +++++++++++------- src/H5O.c | 8 ++------ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/BRANCH.txt b/BRANCH.txt index 9efaed892e..6c4ee6c426 100644 --- a/BRANCH.txt +++ b/BRANCH.txt @@ -6,3 +6,17 @@ on object close. Dana Robinson is in charge of the branch, which follows the trunk. It will be deleted when the feature is merged to the trunk. + +Key changes: + +* New H5Pset/get_evict_on_close() functions that enable and disable + the feature (default: disabled). + +* New property: H5F_ACS_EVICT_ON_CLOSE_FLAG + +* Added match_global flag to H5AC_evict_tagged_metadata() and + H5C_evict_tagged_entries() parameter lists. + +* H5D_close() updated to evict on close, when the property is set. + +* New evict_on_close test to exercise the function. diff --git a/src/H5Ctag.c b/src/H5Ctag.c index fc01ecbfe3..e1b4df6a88 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -374,15 +374,15 @@ H5C_evict_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag, hbool_t match_gl /* Start evicting entries */ do { - /* Reset pinned/evicted tracking flags */ - ctx.pinned_entries_need_evicted = FALSE; - ctx.evicted_entries_last_pass = FALSE; + /* Reset pinned/evicted tracking flags */ + ctx.pinned_entries_need_evicted = FALSE; + ctx.evicted_entries_last_pass = FALSE; - /* Iterate through entries in the cache */ + /* Iterate through entries in the cache */ if(H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, match_global, "Iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") - /* Keep doing this until we have stopped evicted entries */ + /* Keep doing this until we have stopped evicted entries */ } while(TRUE == ctx.evicted_entries_last_pass); /* Fail if we have finished evicting entries and pinned entries still need evicted */ diff --git a/src/H5Gint.c b/src/H5Gint.c index ff92eccbab..4b340155bb 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -501,20 +501,24 @@ H5G_close(H5G_t *grp) if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") +#ifdef DER + /* XXX - NOT IMPLEMENTED */ /* Evict group metadata if evicting on close */ if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { -// printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(grp->oloc.file); + /* I've left in the cache dump code for now - DER */ + printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); + printf("DUMPING CACHE - BEFORE FLUSH\n"); + H5AC_dump_cache(grp->oloc.file); if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(grp->oloc.file); + printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); + H5AC_dump_cache(grp->oloc.file); if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(grp->oloc.file); + printf("DUMPING CACHE - AFTER EVICT\n"); + H5AC_dump_cache(grp->oloc.file); } /* end if */ +#endif /* DER */ /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); diff --git a/src/H5O.c b/src/H5O.c index aa30e79e0f..d1806a1382 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1069,18 +1069,14 @@ H5Oclose(hid_t object_id) /* Get the type of the object and close it in the correct way */ switch(H5I_get_type(object_id)) { case H5I_GROUP: + case H5I_DATATYPE: case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; - case H5I_DATATYPE: - if(H5I_object(object_id) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") - if(H5T_close_id(object_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") - break; + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: From 430ff33b5c6e5e020afae7f150b8442c223353ca Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 23 Sep 2016 01:18:11 -0400 Subject: [PATCH 14/21] Added "Purpose:" information to the API call comments for the new functions. --- src/H5Pfapl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index d96bd540ec..88010615f2 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3621,7 +3621,13 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close * - * Purpose: + * Purpose: Sets the evict_on_close property value. + * + * When this property is set, closing an HDF5 object will + * cause the object's metadata cache entries to be flushed + * and evicted from the cache. + * + * Currently only implemented for datasets. * * Return: SUCCEED/FAIL * @@ -3659,7 +3665,13 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_evict_on_close * - * Purpose: + * Purpose: Gets the evict_on_close property value. + * + * When this property is set, closing an HDF5 object will + * cause the object's metadata cache entries to be flushed + * and evicted from the cache. + * + * Currently only implemented for datasets. * * Return: SUCCEED/FAIL * From 36fd53f70f3a13d5437def00377fc002bc75c116 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 24 Sep 2016 02:54:00 -0400 Subject: [PATCH 15/21] Fixed typo --- test/h5test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/h5test.c b/test/h5test.c index aea5dc7e25..591266b221 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -196,7 +196,7 @@ h5_clean_files(const char *base_name[], hid_t fapl) * * Purpose Clean up temporary test files. * - * When a test calls h5_fixname() get a VFD-dependent + * When a test calls h5_fixname() to get a VFD-dependent * test file name, this function can be used to clean it up. * * Return: void From 2638cbbbffcaf52bf8f97133257c680fa5b14bd8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 24 Sep 2016 02:54:27 -0400 Subject: [PATCH 16/21] Added the beginnings of a file generator to the test. --- test/evict_on_close.c | 202 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 186 insertions(+), 16 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index bcbd0308d2..bc47cef4f7 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -24,7 +24,128 @@ #include "h5test.h" +const char *FILENAMES[] = { + "evict-on-close", /* 0 */ + NULL +}; +#define FILENAME_BUF_SIZE 1024 + +//#define DSET_NAME_COMPACT "compact" +//#define DSET_NAME_CONTIGUOUS "contiguous" +#define DSET_NAME_V1_BTREE "v1_btree" +//#define DSET_NAME_V2_BTREE "v2_btree" +//#define DSET_NAME_EARRAY "earray" +//#define DSET_NAME_FARRAY "farray" +//#define DSET_NAME_SINGLE "single" + static herr_t check_evict_on_close_api(void); +static herr_t generate_eoc_test_file(hid_t fapl_id); + + +/*------------------------------------------------------------------------- + * Function: generate_eoc_test_file() + * + * Purpose: Generate the evict-on-close test file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +generate_eoc_test_file(hid_t fapl_id) +{ + char filename[FILENAME_BUF_SIZE]; /* decorated file name */ + hid_t fid = -1; /* file ID */ + hid_t fapl_copy_id = -1; /* ID of copied fapl */ + hid_t sid = -1; /* dataspace ID */ + hid_t dcpl_id = -1; /* dataset creation plist */ + hid_t did = -1; /* dataset ID */ + int rank; /* # of array dimensions */ + hsize_t current_dims[2]; /* current dataset size */ + hsize_t maximum_dims[2]; /* maximum dataset size */ + hsize_t chunk_dims[2]; /* chunk dimensions */ + int *data = NULL; /* buffer for fake data */ + int n; /* # of data elements */ + + TESTING("generating evict-on-close test file"); + + /* Get a VFD-specific filename */ + h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)); + + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /***********************************************************/ + /* Generate datasets and ensure that the scheme is correct */ + /***********************************************************/ + + /* Create the data buffer */ + if(NULL == (data = (int *)HDcalloc(1024, sizeof(int)))) + TEST_ERROR; + + /********************/ + /* Version 1 B-tree */ + /********************/ + + /* Create dataspace */ + n = 100; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + + /* Close everything else */ + if(H5Fclose(fid) < 0) + TEST_ERROR; + HDfree(data); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl_id); + H5Pclose(fapl_copy_id); + } H5E_END_TRY; + + HDfree(data); + + H5_FAILED(); + return FAIL; + +} /* end generate_eoc_test_file() */ /*------------------------------------------------------------------------- @@ -52,37 +173,37 @@ check_evict_on_close_api(void) /* Create a fapl */ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Check the default */ evict_on_close = TRUE; if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if(evict_on_close != FALSE) FAIL_PUTS_ERROR("Incorrect default evict on close value."); /* Set the evict on close property */ evict_on_close = TRUE; if(H5Pset_evict_on_close(fapl_id, evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Make sure we can get it back out */ evict_on_close = FALSE; if(H5Pget_evict_on_close(fapl_id, &evict_on_close) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if(evict_on_close != TRUE) FAIL_PUTS_ERROR("Incorrect evict on close value."); /* close fapl */ if(H5Pclose(fapl_id) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /**********************************************/ /* Trying passing in a non-fapl property list */ /**********************************************/ if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* ensure using an incorrect access plist fails */ H5E_BEGIN_TRY { @@ -100,7 +221,7 @@ check_evict_on_close_api(void) /* close dapl */ if(H5Pclose(dapl_id) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); return SUCCEED; @@ -125,20 +246,69 @@ error: int main(void) { - unsigned nerrors = 0; + hid_t fapl_id = -1; + unsigned nerrors = 0; - printf("Testing evict-on-close cache behavior.\n"); + HDprintf("Testing evict-on-close cache behavior.\n"); + /* Initialize */ + h5_reset(); + + /* Test H5P call to set up EoC (does not require VFD-specific fapl) */ nerrors += check_evict_on_close_api() < 0 ? 1 : 0; - if(nerrors) { - printf("***** %u evict-on-close test%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; - } + /* Set up VFD-specific fapl */ + if((fapl_id = h5_fileaccess()) < 0) { + nerrors++; + PUTS_ERROR("Unable to get VFD-specific fapl\n"); + } /* end if */ - printf("All evict-on-close tests passed.\n"); + /* Set evict-on-close property */ + if(H5Pset_evict_on_close(fapl_id, TRUE) < 0) { + nerrors++; + PUTS_ERROR("Unable to set evict-on-close property\n"); + } /* end if */ + + /* Generate the test file */ + if(generate_eoc_test_file(fapl_id) < 0) { + nerrors++; + PUTS_ERROR("Unable to generate test file\n"); + } /* end if */ + + /*************************/ + /* Test EoC for datasets */ + /*************************/ + +#ifdef NOTYET + nerrors += check_v1_btree_chunk_index(fapl_id); +#endif + + /* Clean up files and close the VFD-specific fapl */ + //h5_delete_all_test_files(FILENAMES, fapl_id); + if(H5Pclose(fapl_id) < 0) { + nerrors++; + PUTS_ERROR("Unable to close VFD-specific fapl\n"); + } /* end if */ + + + if(nerrors) + goto error; + + HDprintf("All evict-on-close tests passed.\n"); return EXIT_SUCCESS; -} + +error: + + HDprintf("***** %u evict-on-close test%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + + h5_delete_all_test_files(FILENAMES, fapl_id); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; + + return EXIT_FAILURE; + +} /* end main() */ From ce11185fbb8489b94758ca810652760ce98180bc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 29 Sep 2016 13:26:32 -0400 Subject: [PATCH 17/21] Fleshed out evict on close test that inspects cache. --- test/evict_on_close.c | 222 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 196 insertions(+), 26 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index bc47cef4f7..562c1679f9 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -22,7 +22,23 @@ * are located in cache.c. */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_TESTING +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_TESTING +#define H5I_FRIEND /*suppress error about including H5Ipkg */ +#define H5I_TESTING + + #include "h5test.h" +#include "H5Cpkg.h" +#include "H5Dpkg.h" +#include "H5Fpkg.h" +#include "H5Ipkg.h" + +/* Uncomment to manually inspect cache states */ +#define EOC_MANUAL_INSPECTION const char *FILENAMES[] = { "evict-on-close", /* 0 */ @@ -32,14 +48,60 @@ const char *FILENAMES[] = { //#define DSET_NAME_COMPACT "compact" //#define DSET_NAME_CONTIGUOUS "contiguous" -#define DSET_NAME_V1_BTREE "v1_btree" +#define DSET_NAME_V1_BTREE_NAME "v1_btree" //#define DSET_NAME_V2_BTREE "v2_btree" //#define DSET_NAME_EARRAY "earray" //#define DSET_NAME_FARRAY "farray" //#define DSET_NAME_SINGLE "single" + +#define DSET_NAME_V1_BTREE_NELEMENTS 1024 + +static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); -static herr_t generate_eoc_test_file(hid_t fapl_id); +static hid_t generate_eoc_test_file(hid_t fapl_id); +static herr_t check_v1_btree_chunk_index(hid_t fid); + + +/*------------------------------------------------------------------------- + * Function: verify_tag_not_in_cache() + * + * Purpose: Ensure that metadata cache entries with a given tag are not + * present in the cache. + * + * Return: TRUE/FALSE + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static hbool_t +verify_tag_not_in_cache(H5F_t *f, haddr_t tag) +{ + H5C_t *cache_ptr = NULL; /* cache pointer */ + int i = 0; /* iterator */ + H5C_cache_entry_t *entry_ptr = NULL; /* entry pointer */ + + cache_ptr = f->shared->cache; + + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + entry_ptr = cache_ptr->index[i]; + + while(entry_ptr != NULL) { + + if(tag == entry_ptr->tag) + return TRUE; + else + entry_ptr = entry_ptr->ht_next; + + } /* end while */ + } /* end for */ + + return FALSE; + +} /* end verify_tag_not_in_cache() */ /*------------------------------------------------------------------------- @@ -47,18 +109,19 @@ static herr_t generate_eoc_test_file(hid_t fapl_id); * * Purpose: Generate the evict-on-close test file. * - * Return: SUCCEED/FAIL + * Return: Success: The file ID of the created file + * Failure: -1 * * Programmer: Dana Robinson * Fall 2016 * *------------------------------------------------------------------------- */ -static herr_t +static hid_t generate_eoc_test_file(hid_t fapl_id) { char filename[FILENAME_BUF_SIZE]; /* decorated file name */ - hid_t fid = -1; /* file ID */ + hid_t fid = -1; /* file ID (returned) */ hid_t fapl_copy_id = -1; /* ID of copied fapl */ hid_t sid = -1; /* dataspace ID */ hid_t dcpl_id = -1; /* dataset creation plist */ @@ -84,7 +147,7 @@ generate_eoc_test_file(hid_t fapl_id) /***********************************************************/ /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(1024, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) TEST_ERROR; /********************/ @@ -92,7 +155,7 @@ generate_eoc_test_file(hid_t fapl_id) /********************/ /* Create dataspace */ - n = 100; + n = DSET_NAME_V1_BTREE_NELEMENTS; rank = 1; current_dims[0] = (hsize_t)n; maximum_dims[0] = H5S_UNLIMITED; @@ -107,7 +170,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write a bunch of fake data */ @@ -123,13 +186,11 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; - /* Close everything else */ - if(H5Fclose(fid) < 0) - TEST_ERROR; + /* Close/free everything else */ HDfree(data); PASSED(); - return SUCCEED; + return fid; error: H5E_BEGIN_TRY { @@ -143,10 +204,113 @@ error: HDfree(data); H5_FAILED(); - return FAIL; + return -1; } /* end generate_eoc_test_file() */ + +/*------------------------------------------------------------------------- + * Function: check_v1_btree_chunk_index() + * + * Purpose: Verify that datasets using version 1 B-trees are evicted + * correctly. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +check_v1_btree_chunk_index(hid_t fid) +{ + H5F_t *file_ptr = NULL; /* ptr to internal file struct */ + hid_t did = -1; /* dataset ID */ + H5D_t *dset_ptr = NULL; /* ptr to internal dset struct */ + haddr_t tag; /* MD cache tag for dataset */ + int *data = NULL; /* buffer for fake data */ + int32_t before, during, after; /* cache sizes */ + + TESTING("evict on close with version 1 B-trees"); + + /* Get a pointer to the file struct */ + if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + TEST_ERROR; + + /* Create the data buffer */ + if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + TEST_ERROR; + + /* Record the number of cache entries */ + before = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE BEFORE DATASET OPEN:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); +#endif + + /* Open dataset and get the metadata tag */ + if((did = H5Dopen2(fid, DSET_NAME_V1_BTREE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + TEST_ERROR; + tag = dset_ptr->oloc.addr; + + /* Read data from the dataset so the cache gets populated with chunk indices */ + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Record the number of cache entries */ + during = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER DATA READ (WHILE OPEN):\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("TAG: %#X\n", tag); + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); +#endif + + /* Close the dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + + /* Record the number of cache entries */ + after = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER DATASET CLOSE:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); +#endif + + /* Ensure that the cache does not contain data items with the tag */ + if(TRUE == verify_tag_not_in_cache(file_ptr, tag)) + TEST_ERROR; + + /* Compare the number of cache entries */ + if(before != after || before == during) + TEST_ERROR; + + HDfree(data); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(did); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; + +} /* check_v1_btree_chunk_index() */ + /*------------------------------------------------------------------------- * Function: check_evict_on_close_api() @@ -246,8 +410,9 @@ error: int main(void) { - hid_t fapl_id = -1; - unsigned nerrors = 0; + hid_t fapl_id = -1; /* VFD-specific fapl */ + hid_t fid = -1; /* file ID */ + unsigned nerrors = 0; /* number of test errors */ HDprintf("Testing evict-on-close cache behavior.\n"); @@ -269,28 +434,32 @@ main(void) PUTS_ERROR("Unable to set evict-on-close property\n"); } /* end if */ - /* Generate the test file */ - if(generate_eoc_test_file(fapl_id) < 0) { - nerrors++; - PUTS_ERROR("Unable to generate test file\n"); - } /* end if */ - /*************************/ /* Test EoC for datasets */ /*************************/ -#ifdef NOTYET - nerrors += check_v1_btree_chunk_index(fapl_id); -#endif + /* Generate the test file */ + if((fid = generate_eoc_test_file(fapl_id)) < 0) { + nerrors++; + PUTS_ERROR("Unable to generate test file\n"); + } /* end if */ + + /* Run tests with a variety of dataset configurations */ + nerrors += check_v1_btree_chunk_index(fid) < 0 ? 1 : 0; + + /* Close the test file */ + if(H5Fclose(fid) < 0) { + nerrors++; + PUTS_ERROR("Unable to close the test file.\n"); + } /* end if */ /* Clean up files and close the VFD-specific fapl */ //h5_delete_all_test_files(FILENAMES, fapl_id); if(H5Pclose(fapl_id) < 0) { nerrors++; - PUTS_ERROR("Unable to close VFD-specific fapl\n"); + PUTS_ERROR("Unable to close VFD-specific fapl.\n"); } /* end if */ - if(nerrors) goto error; @@ -305,6 +474,7 @@ error: h5_delete_all_test_files(FILENAMES, fapl_id); H5E_BEGIN_TRY { + H5Fclose(fid); H5Pclose(fapl_id); } H5E_END_TRY; From a2fe6f7db93bb1e83cc030df0e4181119900c9e5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 03:24:44 -0400 Subject: [PATCH 18/21] Added code to create the test file for all chunk index and layout types. --- src/H5Dpkg.h | 1 + src/H5Dtest.c | 41 ++++++ test/evict_on_close.c | 306 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 334 insertions(+), 14 deletions(-) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 05f49d18d7..2190f8c3ab 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -770,6 +770,7 @@ H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info, H5_DLL herr_t H5D__layout_version_test(hid_t did, unsigned *version); H5_DLL herr_t H5D__layout_contig_size_test(hid_t did, hsize_t *size); H5_DLL herr_t H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type); +H5_DLL herr_t H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type); H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused); #endif /* H5D_TESTING */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index c3b0b19e53..56f14f7d84 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -141,6 +141,47 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__layout_contig_size_test() */ + +/*-------------------------------------------------------------------------- + NAME + H5D__layout_type_test + PURPOSE + Determine the storage layout type for a dataset + USAGE + herr_t H5D__layout_type_test(did, layout_type) + hid_t did; IN: Dataset to query + H5D_layout_t *layout_type; OUT: Pointer to location to place layout info + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Checks the layout type for a dataset. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type) +{ + H5D_t *dset; /* Pointer to dataset to query */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_PACKAGE + + HDassert(layout_type); + + /* Check args */ + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + if(layout_type) + *layout_type = dset->shared->layout.type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__layout_type_test() */ + /*-------------------------------------------------------------------------- NAME diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 562c1679f9..b09c1bf17c 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -46,16 +46,17 @@ const char *FILENAMES[] = { }; #define FILENAME_BUF_SIZE 1024 -//#define DSET_NAME_COMPACT "compact" -//#define DSET_NAME_CONTIGUOUS "contiguous" -#define DSET_NAME_V1_BTREE_NAME "v1_btree" -//#define DSET_NAME_V2_BTREE "v2_btree" -//#define DSET_NAME_EARRAY "earray" -//#define DSET_NAME_FARRAY "farray" -//#define DSET_NAME_SINGLE "single" +/* Dataset names */ +#define DSET_COMPACT_NAME "compact" +#define DSET_CONTIGUOUS_NAME "contiguous" +#define DSET_BTREE_NAME "v1_btree" +#define DSET_EARRAY_NAME "earray" +#define DSET_BT2_NAME "v2_btree" +#define DSET_FARRAY_NAME "farray" +#define DSET_SINGLE_NAME "single" - -#define DSET_NAME_V1_BTREE_NELEMENTS 1024 +/* All datasets store 1000 elements */ +#define NELEMENTS 1024 static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); @@ -130,6 +131,8 @@ generate_eoc_test_file(hid_t fapl_id) hsize_t current_dims[2]; /* current dataset size */ hsize_t maximum_dims[2]; /* maximum dataset size */ hsize_t chunk_dims[2]; /* chunk dimensions */ + H5D_chunk_index_t idx_type; /* dataset chunk index type */ + H5D_layout_t layout_type; /* dataset layout type */ int *data = NULL; /* buffer for fake data */ int n; /* # of data elements */ @@ -147,15 +150,19 @@ generate_eoc_test_file(hid_t fapl_id) /***********************************************************/ /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) TEST_ERROR; + /****************************************************/ + /* Old file format data structures (v1 B-tree only) */ + /****************************************************/ + /********************/ /* Version 1 B-tree */ /********************/ /* Create dataspace */ - n = DSET_NAME_V1_BTREE_NELEMENTS; + n = NELEMENTS; rank = 1; current_dims[0] = (hsize_t)n; maximum_dims[0] = H5S_UNLIMITED; @@ -170,9 +177,15 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; /* Create dataset */ - if((did = H5Dcreate(fid, DSET_NAME_V1_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate(fid, DSET_BTREE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using version 1 B-tree as the chunk index"); + /* Write a bunch of fake data */ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; @@ -185,8 +198,273 @@ generate_eoc_test_file(hid_t fapl_id) if(H5Pclose(dcpl_id) < 0) TEST_ERROR; + /***********************************/ + /* New file format data structures */ + /***********************************/ + + /* Close the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR; + + /* Copy the fapl and set the latest file format */ + if((fapl_copy_id = H5Pcopy(fapl_id)) < 0) + TEST_ERROR; + if(H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Reopen the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0) + TEST_ERROR; + + /********************/ + /* Extensible Array */ + /********************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_EARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_EARRAY) + FAIL_PUTS_ERROR("should be using extensible array as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /********************/ + /* Version 2 B-Tree */ + /********************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 2; + current_dims[0] = (hsize_t)2; + current_dims[1] = (hsize_t)(n/2); + maximum_dims[0] = H5S_UNLIMITED; + maximum_dims[1] = H5S_UNLIMITED; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + chunk_dims[1] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_BT2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_BT2) + FAIL_PUTS_ERROR("should be using version 2 B-tree as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /***************/ + /* Fixed Array */ + /***************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = 1; + chunk_dims[1] = 1; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_FARRAY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using fixed array as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /****************/ + /* Single Chunk */ + /****************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up chunking */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + chunk_dims[0] = (hsize_t)n; + chunk_dims[1] = (hsize_t)n; + if(H5Pset_chunk(dcpl_id, rank, chunk_dims) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_SINGLE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) + TEST_ERROR; + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("should be using single chunk as the chunk index"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /**************/ + /* Contiguous */ + /**************/ + + /* Create dataspace */ + n = NELEMENTS; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_CONTIGUOUS_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct layout scheme */ + if(H5D__layout_type_test(did, &layout_type) < 0) + TEST_ERROR; + if(layout_type != H5D_CONTIGUOUS) + FAIL_PUTS_ERROR("should be using contiguous layout"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + + /***********/ + /* Compact */ + /***********/ + + /* Create dataspace */ + n = 1; + rank = 1; + current_dims[0] = (hsize_t)n; + maximum_dims[0] = (hsize_t)n; + if((sid = H5Screate_simple(rank, current_dims, maximum_dims)) < 0) + TEST_ERROR; + + /* Create dcpl and set up compact layout */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if(H5Pset_layout(dcpl_id, H5D_COMPACT) < 0) + TEST_ERROR; + + /* Create dataset */ + if((did = H5Dcreate(fid, DSET_COMPACT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Ensure we're using the correct layout scheme */ + if(H5D__layout_type_test(did, &layout_type) < 0) + TEST_ERROR; + if(layout_type != H5D_COMPACT) + FAIL_PUTS_ERROR("should be using compact layout"); + + /* Write a bunch of fake data */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + TEST_ERROR; + + /* Close IDs for this dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR; + if(H5Sclose(sid) < 0) + TEST_ERROR; + if(H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /********/ + /* DONE */ + /********/ /* Close/free everything else */ + if(H5Pclose(fapl_copy_id) < 0) + TEST_ERROR; + HDfree(data); PASSED(); @@ -239,7 +517,7 @@ check_v1_btree_chunk_index(hid_t fid) TEST_ERROR; /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(DSET_NAME_V1_BTREE_NELEMENTS, sizeof(int)))) + if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) TEST_ERROR; /* Record the number of cache entries */ @@ -253,7 +531,7 @@ check_v1_btree_chunk_index(hid_t fid) #endif /* Open dataset and get the metadata tag */ - if((did = H5Dopen2(fid, DSET_NAME_V1_BTREE_NAME, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, DSET_BTREE_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) TEST_ERROR; From 31b033e214762dc2beced02af37d47b668126105 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 04:26:39 -0400 Subject: [PATCH 19/21] Added full implementation of EoC cache test. --- test/evict_on_close.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/evict_on_close.c b/test/evict_on_close.c index b09c1bf17c..0657b1bf29 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -38,7 +38,7 @@ #include "H5Ipkg.h" /* Uncomment to manually inspect cache states */ -#define EOC_MANUAL_INSPECTION +/* #define EOC_MANUAL_INSPECTION */ const char *FILENAMES[] = { "evict-on-close", /* 0 */ @@ -61,7 +61,7 @@ const char *FILENAMES[] = { static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); static hid_t generate_eoc_test_file(hid_t fapl_id); -static herr_t check_v1_btree_chunk_index(hid_t fid); +static herr_t check_configuration(hid_t fid, const char *dset_name); /*------------------------------------------------------------------------- @@ -488,10 +488,10 @@ error: /*------------------------------------------------------------------------- - * Function: check_v1_btree_chunk_index() + * Function: check_configuration() * - * Purpose: Verify that datasets using version 1 B-trees are evicted - * correctly. + * Purpose: Verify that the evict-on-close feature works for a given + * dataset layout and/or chunk index. * * Return: SUCCEED/FAIL * @@ -501,7 +501,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -check_v1_btree_chunk_index(hid_t fid) +check_configuration(hid_t fid, const char *dset_name) { H5F_t *file_ptr = NULL; /* ptr to internal file struct */ hid_t did = -1; /* dataset ID */ @@ -510,7 +510,7 @@ check_v1_btree_chunk_index(hid_t fid) int *data = NULL; /* buffer for fake data */ int32_t before, during, after; /* cache sizes */ - TESTING("evict on close with version 1 B-trees"); + /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) @@ -531,13 +531,15 @@ check_v1_btree_chunk_index(hid_t fid) #endif /* Open dataset and get the metadata tag */ - if((did = H5Dopen2(fid, DSET_BTREE_NAME, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0) TEST_ERROR; if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) TEST_ERROR; tag = dset_ptr->oloc.addr; - /* Read data from the dataset so the cache gets populated with chunk indices */ + /* Read data from the dataset so the cache gets populated with chunk + * and the like. + */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; @@ -587,7 +589,7 @@ error: H5_FAILED(); return FAIL; -} /* check_v1_btree_chunk_index() */ +} /* check_configuration() */ /*------------------------------------------------------------------------- @@ -722,8 +724,23 @@ main(void) PUTS_ERROR("Unable to generate test file\n"); } /* end if */ - /* Run tests with a variety of dataset configurations */ - nerrors += check_v1_btree_chunk_index(fid) < 0 ? 1 : 0; + /* Run tests with a variety of dataset configurations + * PASSED() and H5_FAILED() are handled in check_configuration() + */ + TESTING("evict on close with version 1 B-tree chunk index"); + nerrors += check_configuration(fid, DSET_BTREE_NAME) < 0 ? 1 : 0; + TESTING("evict on close with extensible array chunk index"); + nerrors += check_configuration(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0; + TESTING("evict on close with version 2 B-tree chunk index"); + nerrors += check_configuration(fid, DSET_BT2_NAME) < 0 ? 1 : 0; + TESTING("evict on close with fixed array chunk index"); + nerrors += check_configuration(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0; + TESTING("evict on close with \'single chunk\' chunk index"); + nerrors += check_configuration(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0; + TESTING("evict on close with contiguous layout"); + nerrors += check_configuration(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0; + TESTING("evict on close with compact layout"); + nerrors += check_configuration(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0; /* Close the test file */ if(H5Fclose(fid) < 0) { @@ -732,7 +749,7 @@ main(void) } /* end if */ /* Clean up files and close the VFD-specific fapl */ - //h5_delete_all_test_files(FILENAMES, fapl_id); + h5_delete_all_test_files(FILENAMES, fapl_id); if(H5Pclose(fapl_id) < 0) { nerrors++; PUTS_ERROR("Unable to close VFD-specific fapl.\n"); From 5088217e4256aa2ba5b7590b7de91aeae415a1ce Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 05:04:11 -0400 Subject: [PATCH 20/21] - Removed non-implemented code from H5Gint.c - Removed commented-out debug code from H5Dint.c - Added blank lines to eliminate delta in a fortran file. --- fortran/src/H5Eff.F90 | 2 ++ src/H5Dint.c | 8 -------- src/H5Gint.c | 19 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 2fc77f497f..4198321e3b 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -136,10 +136,12 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name END FUNCTION h5eprint_c1 END INTERFACE + INTERFACE INTEGER FUNCTION h5eprint_c2() BIND(C,NAME='h5eprint_c2') END FUNCTION h5eprint_c2 END INTERFACE + IF (PRESENT(name)) THEN namelen = LEN(NAME) hdferr = h5eprint_c1(name, namelen) diff --git a/src/H5Dint.c b/src/H5Dint.c index 5ae3bd3f83..7f90f1609f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1920,17 +1920,10 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { -// printf("EVICTING DATASET (TAG: 0x%3llx)\n", dataset->oloc.addr); -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(dataset->oloc.file); if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(dataset->oloc.file); if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(dataset->oloc.file); } /* end if */ /* @@ -2672,7 +2665,6 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT /* Read in the point (with the custom VL memory allocator) */ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gint.c b/src/H5Gint.c index 4b340155bb..a0e06f37dd 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -501,25 +501,6 @@ H5G_close(H5G_t *grp) if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") -#ifdef DER - /* XXX - NOT IMPLEMENTED */ - /* Evict group metadata if evicting on close */ - if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { - /* I've left in the cache dump code for now - DER */ - printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); - printf("DUMPING CACHE - BEFORE FLUSH\n"); - H5AC_dump_cache(grp->oloc.file); - if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); - H5AC_dump_cache(grp->oloc.file); - if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") - printf("DUMPING CACHE - AFTER EVICT\n"); - H5AC_dump_cache(grp->oloc.file); - } /* end if */ -#endif /* DER */ - /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { From cbc260e636e258cc55d9fb8fdafd3bff0877ac23 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 30 Sep 2016 13:06:12 -0400 Subject: [PATCH 21/21] - Removed BRANCH.txt and MANIFEST entry - Fixed a missing line in H5Dint.c --- BRANCH.txt | 22 ---------------------- MANIFEST | 1 - src/H5Dint.c | 1 + 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 BRANCH.txt diff --git a/BRANCH.txt b/BRANCH.txt deleted file mode 100644 index 6c4ee6c426..0000000000 --- a/BRANCH.txt +++ /dev/null @@ -1,22 +0,0 @@ -evict_on_close - -This branch is for the development of the "evict on close" feature -which will cause the library to evict all cached information -on object close. - -Dana Robinson is in charge of the branch, which follows the trunk. -It will be deleted when the feature is merged to the trunk. - -Key changes: - -* New H5Pset/get_evict_on_close() functions that enable and disable - the feature (default: disabled). - -* New property: H5F_ACS_EVICT_ON_CLOSE_FLAG - -* Added match_global flag to H5AC_evict_tagged_metadata() and - H5C_evict_tagged_entries() parameter lists. - -* H5D_close() updated to evict on close, when the property is set. - -* New evict_on_close test to exercise the function. diff --git a/MANIFEST b/MANIFEST index 3ed99e7024..fb454c5fdf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -25,7 +25,6 @@ ./.autom4te.cfg _DO_NOT_DISTRIBUTE_ ./.h5chkright.ini _DO_NOT_DISTRIBUTE_ ./ACKNOWLEDGMENTS -./BRANCH.txt ./COPYING ./MANIFEST ./Makefile.dist diff --git a/src/H5Dint.c b/src/H5Dint.c index 7f90f1609f..59fe3e9ab8 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2665,6 +2665,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT /* Read in the point (with the custom VL memory allocator) */ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value)