From 15a8348003deaebaa6405f0ab223944bffa2d1d1 Mon Sep 17 00:00:00 2001 From: John Mainzer Date: Mon, 14 Jul 2008 06:38:42 -0500 Subject: [svn-r15348] Checking in a collection of bug fixes and added test code -- specifically: 1) Fix for failure to detect journaling in progress on HDF5 files which were not closed correctly. Also associated test code. Note that this required addition of code to test for journaling in progress and enable journaling at the end of H5F_flush(). In passing, I was able to get rid of the wacky code that queued journaling setup at cache creation time. 2) Test code for startup and shutdown of journaling on an open file. 3) Updates to start checking journal output against architype files instead of just generating architypes at test time. Note that per Quincey's request, I have checked in gziped versions of the architype files. At some point, we will have to add code to automatically unzip these files, but for the time being you will have to go to test/testfiles and "gunzip *.gz". The journal tests will still pass if you don't, but you will get a warning about missing test files. 4) Fixed bug in journal entry logging code that allowed a comment to appear in the journal file before the journal file header. (Mike M,: Please review my fix to verify that I haven't clobbered anything.) 5) Additional test code. Note that more test code would be a good idea, but this set of bug fixes should be enough to get us through the basic demo -- at least as far as the metadata cache is concerned. Tested serial on Phoenix, and parallel on Kagiso. Also, tested serial on Linew just prior to some last minute minor edits. --- src/H5AC2.c | 657 ++++- src/H5AC2private.h | 18 + src/H5C2.c | 51 +- src/H5C2journal.c | 477 ++-- src/H5C2pkg.h | 41 - src/H5C2private.h | 22 +- src/H5F.c | 38 +- test/cache2_common.c | 7 +- test/cache2_journal.c | 3263 ++++++++++++++++++++++--- test/cache_api.c | 441 +++- test/testfiles/cache2_journal_sc00_000.jnl.gz | Bin 0 -> 218 bytes test/testfiles/cache2_journal_sc00_001.jnl.gz | Bin 0 -> 250 bytes test/testfiles/cache2_journal_sc00_002.jnl.gz | Bin 0 -> 249 bytes test/testfiles/cache2_journal_sc00_003.jnl.gz | Bin 0 -> 284 bytes test/testfiles/cache2_journal_sc00_004.jnl.gz | Bin 0 -> 317 bytes test/testfiles/cache2_journal_sc00_005.jnl.gz | Bin 0 -> 374 bytes test/testfiles/cache2_journal_sc00_006.jnl.gz | Bin 0 -> 392 bytes test/testfiles/cache2_journal_sc00_007.jnl.gz | Bin 0 -> 646 bytes test/testfiles/cache2_journal_sc00_008.jnl.gz | Bin 0 -> 1026 bytes test/testfiles/cache2_journal_sc00_009.jnl.gz | Bin 0 -> 1431 bytes test/testfiles/cache2_journal_sc00_010.jnl.gz | Bin 0 -> 1823 bytes test/testfiles/cache2_journal_sc00_011.jnl.gz | Bin 0 -> 345 bytes test/testfiles/cache2_journal_sc00_012.jnl.gz | Bin 0 -> 417 bytes test/testfiles/cache2_journal_sc00_013.jnl.gz | Bin 0 -> 533 bytes test/testfiles/cache2_journal_sc00_014.jnl.gz | Bin 0 -> 780 bytes test/testfiles/cache2_journal_sc00_015.jnl.gz | Bin 0 -> 223 bytes test/testfiles/cache2_journal_sc00_016.jnl.gz | Bin 0 -> 241 bytes test/testfiles/cache2_journal_sc00_017.jnl.gz | Bin 0 -> 217 bytes test/testfiles/cache2_journal_sc00_018.jnl.gz | Bin 0 -> 218 bytes test/testfiles/cache2_journal_sc01_000.jnl.gz | Bin 0 -> 26904 bytes test/testfiles/cache2_journal_sc01_001.jnl.gz | Bin 0 -> 24906 bytes 31 files changed, 4203 insertions(+), 812 deletions(-) create mode 100755 test/testfiles/cache2_journal_sc00_000.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_001.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_002.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_003.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_004.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_005.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_006.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_007.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_008.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_009.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_010.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_011.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_012.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_013.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_014.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_015.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_016.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_017.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc00_018.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc01_000.jnl.gz create mode 100755 test/testfiles/cache2_journal_sc01_001.jnl.gz diff --git a/src/H5AC2.c b/src/H5AC2.c index 11dae29..a7481f0 100644 --- a/src/H5AC2.c +++ b/src/H5AC2.c @@ -201,6 +201,13 @@ static herr_t H5AC2_log_renamed_entry(H5F_t * f, haddr_t new_addr); #endif /* H5_HAVE_PARALLEL */ +static herr_t H5AC2_set_non_journaling_cache_config(H5F_t * f, + hid_t dxpl_id, + H5AC2_cache_config_t *config_ptr); + +static herr_t H5AC2_validate_journaling_config( + H5AC2_cache_config_t * config_ptr); + /*------------------------------------------------------------------------- * Function: H5AC2_init @@ -485,6 +492,11 @@ H5AC2_term_interface(void) * list changes in H5C2_create(). * JRM - 3/26/08 * + * Updated code for the removal of the f, dxpl_id, and + * journal_recovered parameters for H5C2_create(). + * + * JRM 7/10/08 + * *------------------------------------------------------------------------- */ @@ -622,23 +634,18 @@ H5AC2_create(H5F_t * f, if ( aux_ptr->mpi_rank == 0 ) { - f->shared->cache2 = H5C2_create(f, - dxpl_id, - H5AC2__DEFAULT_MAX_CACHE_SIZE, + f->shared->cache2 = H5C2_create(H5AC2__DEFAULT_MAX_CACHE_SIZE, H5AC2__DEFAULT_MIN_CLEAN_SIZE, (H5AC2_NTYPES - 1), (const char **)H5AC2_entry_type_names, H5AC2_check_if_write_permitted, TRUE, H5AC2_log_flushed_entry, - (void *)aux_ptr, - config_ptr->journal_recovered); + (void *)aux_ptr); } else { - f->shared->cache2 = H5C2_create(f, - dxpl_id, - H5AC2__DEFAULT_MAX_CACHE_SIZE, + f->shared->cache2 = H5C2_create(H5AC2__DEFAULT_MAX_CACHE_SIZE, H5AC2__DEFAULT_MIN_CLEAN_SIZE, (H5AC2_NTYPES - 1), (const char **)H5AC2_entry_type_names, @@ -649,23 +656,19 @@ H5AC2_create(H5F_t * f, #else /* JRM */ NULL, #endif /* JRM */ - (void *)aux_ptr, - config_ptr->journal_recovered); + (void *)aux_ptr); } } else { - f->shared->cache2 = H5C2_create(f, - dxpl_id, - H5AC2__DEFAULT_MAX_CACHE_SIZE, + f->shared->cache2 = H5C2_create(H5AC2__DEFAULT_MAX_CACHE_SIZE, H5AC2__DEFAULT_MIN_CLEAN_SIZE, (H5AC2_NTYPES - 1), (const char **)H5AC2_entry_type_names, H5AC2_check_if_write_permitted, TRUE, NULL, - NULL, - config_ptr->journal_recovered); + NULL); } } else { #endif /* H5_HAVE_PARALLEL */ @@ -674,17 +677,14 @@ H5AC2_create(H5F_t * f, * -- JRM */ - f->shared->cache2 = H5C2_create(f, - dxpl_id, - H5AC2__DEFAULT_MAX_CACHE_SIZE, + f->shared->cache2 = H5C2_create(H5AC2__DEFAULT_MAX_CACHE_SIZE, H5AC2__DEFAULT_MIN_CLEAN_SIZE, (H5AC2_NTYPES - 1), (const char **)H5AC2_entry_type_names, H5AC2_check_if_write_permitted, TRUE, NULL, - NULL, - config_ptr->journal_recovered); + NULL); #ifdef H5_HAVE_PARALLEL } #endif /* H5_HAVE_PARALLEL */ @@ -707,9 +707,9 @@ H5AC2_create(H5F_t * f, } #endif /* H5_HAVE_PARALLEL */ - result = H5AC2_set_cache_auto_resize_config(f, - dxpl_id, - config_ptr); + result = H5AC2_set_non_journaling_cache_config(f, + dxpl_id, + config_ptr); if ( result != SUCCEED ) { @@ -997,6 +997,90 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC2_check_for_journaling() + * + * Purpose: Check the newly opened file for ongoing journaling. + * Fail if it exists and the journal recovered flag is + * not set. + * + * This function is just a wrapper for + * H5C2_check_for_journaling(). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 7/4/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_check_for_journaling(H5F_t * f, + hid_t dxpl_id, + H5C2_t * cache_ptr, + hbool_t journal_recovered) +{ + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ +#if H5AC2__TRACE_FILE_ENABLED + char trace[256] = ""; + FILE * trace_file_ptr = NULL; +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + FUNC_ENTER_NOAPI(H5AC2_check_for_journaling, FAIL) + + HDassert( f ); + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); + +#if H5AC2__TRACE_FILE_ENABLED + /* For the end transaction call, only the journal_recovered + * parameter is really needed. Write the return value to catch + * occult errors. + */ + if ( ( cache_ptr != NULL ) && + ( H5C2_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) && + ( trace_file_ptr != NULL ) ) { + + sprintf(trace, "H5AC2_check_for_journaling %d ", + (int)journal_recovered); + } +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + /* test to see if there is a metadata journal that must be recovered + * before we can access the file. Do this at the end of file open, + * as the data we need for the check is not available at cache creation + * time. + */ + + result = H5C2_check_for_journaling(f, dxpl_id, cache_ptr, + journal_recovered); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, \ + "H5C2_check_for_journaling() reports failure.") + } + +done: + +#if H5AC2__TRACE_FILE_ENABLED + if ( trace_file_ptr != NULL ) { + + HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); + } +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC2_end_transaction() */ + + +/*------------------------------------------------------------------------- * Function: H5AC2_end_transaction() * * Purpose: Mark the end of a transaction. @@ -2079,7 +2163,7 @@ done: */ herr_t H5AC2_pin_protected_entry(H5F_t * f, - void * thing) + void * thing) { herr_t result; herr_t ret_value = SUCCEED; /* Return value */ @@ -3211,8 +3295,6 @@ H5AC2_set_cache_auto_resize_config(H5F_t * f, H5AC2_t * cache_ptr; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ - hbool_t mdj_enabled = FALSE; - H5C2_auto_size_ctl_t internal_config; #if H5AC2__TRACE_FILE_ENABLED H5AC2_cache_config_t trace_config = H5AC2__DEFAULT_CACHE_CONFIG; FILE * trace_file_ptr = NULL; @@ -3261,6 +3343,305 @@ H5AC2_set_cache_auto_resize_config(H5F_t * f, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration"); } + + result = H5AC2_set_non_journaling_cache_config(f, dxpl_id, config_ptr); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC2_set_non_journaling_cache_config() failed.") + } + + + result = H5AC2_set_cache_journaling_config(f, dxpl_id, config_ptr, FALSE); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC2_set_cache_journaling_config() failed.") + } + +done: + +#if H5AC2__TRACE_FILE_ENABLED + /* For the set cache auto resize config call, only the contents + * of the config is necessary in the trace file. Write the return + * value to catch occult errors. + */ + if ( ( cache_ptr != NULL ) && + ( H5C2_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) && + ( trace_file_ptr != NULL ) ) { + + HDfprintf(trace_file_ptr, + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %f %f %d %d %d %d %f %d %d \"%s\" %d %d %d %d %d %d\n", + "H5AC2_set_cache_auto_resize_config", + trace_config.version, + (int)(trace_config.rpt_fcn_enabled), + (int)(trace_config.open_trace_file), + (int)(trace_config.close_trace_file), + trace_config.trace_file_name, + (int)(trace_config.evictions_enabled), + (int)(trace_config.set_initial_size), + (int)(trace_config.initial_size), + trace_config.min_clean_fraction, + (int)(trace_config.max_size), + (int)(trace_config.min_size), + trace_config.epoch_length, + (int)(trace_config.incr_mode), + trace_config.lower_hr_threshold, + trace_config.increment, + (int)(trace_config.apply_max_increment), + (int)(trace_config.max_increment), + (int)(trace_config.flash_incr_mode), + trace_config.flash_multiple, + trace_config.flash_threshold, + (int)(trace_config.decr_mode), + trace_config.upper_hr_threshold, + trace_config.decrement, + (int)(trace_config.apply_max_decrement), + (int)(trace_config.max_decrement), + trace_config.epochs_before_eviction, + (int)(trace_config.apply_empty_reserve), + trace_config.empty_reserve, + trace_config.dirty_bytes_threshold, + (int)(config_ptr->enable_journaling), + config_ptr->journal_file_path, + (int)(config_ptr->journal_recovered), + (int)(config_ptr->jbrb_buf_size), + config_ptr->jbrb_num_bufs, + (int)(config_ptr->jbrb_use_aio), + (int)(config_ptr->jbrb_human_readable), + (int)ret_value); + } +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC2_set_cache_auto_resize_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC2_set_cache_journaling_config + * + * Purpose: Handle changes in journaling configuration. + * + * This code used to reside in + * H5AC2_set_cache_auto_resize_config(), but it has been + * split out, as on startup, we need to be able to run + * it separately from the rest of the cache configuration + * code. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 7/6/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_set_cache_journaling_config(H5F_t * f, + hid_t dxpl_id, + H5AC2_cache_config_t *config_ptr, +#if H5AC2__TRACE_FILE_ENABLED + hbool_t show_trace) +#else /* H5AC2__TRACE_FILE_ENABLED */ + hbool_t UNUSED show_trace) +#endif /* H5AC2__TRACE_FILE_ENABLED */ +{ + /* const char * fcn_name = "H5AC2_set_cache_journaling_config"; */ + H5AC2_t * cache_ptr; + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ + hbool_t mdj_enabled = FALSE; +#if H5AC2__TRACE_FILE_ENABLED + H5AC2_cache_config_t trace_config = H5AC2__DEFAULT_CACHE_CONFIG; + FILE * trace_file_ptr = NULL; +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + FUNC_ENTER_NOAPI(H5AC2_set_cache_journaling_config, FAIL) + + HDassert( f ); + HDassert( f->shared ); + HDassert( f->shared->cache2 ); + + cache_ptr = (H5AC2_t *)f->shared->cache2; + +#if H5AC2__TRACE_FILE_ENABLED + /* Make note of the new configuration. + */ + if ( ( show_trace ) && ( config_ptr != NULL ) ) { + + trace_config = *config_ptr; + + } +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + if ( ( cache_ptr == NULL ) +#ifdef H5_HAVE_PARALLEL + || + ( ( cache_ptr->aux_ptr != NULL ) + && + ( + ((H5AC2_aux_t *)(cache_ptr->aux_ptr))->magic + != + H5AC2__H5AC2_AUX_T_MAGIC + ) + ) +#endif /* H5_HAVE_PARALLEL */ + ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") + } + + result = H5AC2_validate_journaling_config(config_ptr); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "Bad journaling configuration"); + } + + result = H5C2_get_journal_config((H5C2_t *)cache_ptr, &mdj_enabled, + NULL, NULL, NULL, NULL, NULL, NULL); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C2_get_journal_config() failed.") + } + + if ( config_ptr->enable_journaling != mdj_enabled ) { + + /* we have work to do -- start or stop journaling as requested */ + + if ( config_ptr->enable_journaling ) { + + result = H5C2_begin_journaling(f, + dxpl_id, + cache_ptr, + &(config_ptr->journal_file_path[0]), + config_ptr->jbrb_buf_size, + config_ptr->jbrb_num_bufs, + config_ptr->jbrb_use_aio, + config_ptr->jbrb_human_readable); + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_begin_journaling() failed.") + } + } else { + + result = H5C2_end_journaling(f, dxpl_id, cache_ptr); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_end_journaling() failed.") + } + } + } + +done: + +#if H5AC2__TRACE_FILE_ENABLED + /* For the set cache journaling config call, only the fields + * of the config that pretain to journaling are necessary in + * the trace file. Write the return value to catch occult errors. + */ + if ( ( show_trace ) && + ( cache_ptr != NULL ) && + ( H5C2_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) && + ( trace_file_ptr != NULL ) ) { + + HDfprintf(trace_file_ptr, + "%s %d %d \"%s\" %d %d %d %d %d %d\n", + "H5AC2_set_cache_journaling_config", + trace_config.version, + (int)(config_ptr->enable_journaling), + config_ptr->journal_file_path, + (int)(config_ptr->journal_recovered), + (int)(config_ptr->jbrb_buf_size), + config_ptr->jbrb_num_bufs, + (int)(config_ptr->jbrb_use_aio), + (int)(config_ptr->jbrb_human_readable), + (int)ret_value); + } +#endif /* H5AC2__TRACE_FILE_ENABLED */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC2_set_cache_journaling_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC2_set_non_journaling_cache_config + * + * Purpose: Handle all non-journaling related configuration switches + * in an instance of H5AC2_cache_config_t. + * + * This function is needed, as journaling cannot be set + * at cache creation time. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 7/7/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_set_non_journaling_cache_config(H5F_t * f, + hid_t UNUSED dxpl_id, + H5AC2_cache_config_t *config_ptr) +{ + /* const char * fcn_name = "H5AC2_set_non_journaling_cache_config"; */ + H5AC2_t * cache_ptr; + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ + H5C2_auto_size_ctl_t internal_config; + + FUNC_ENTER_NOAPI(H5AC2_set_non_journaling_cache_config, FAIL) + + HDassert( f ); + HDassert( f->shared ); + HDassert( f->shared->cache2 ); + + cache_ptr = (H5AC2_t *)f->shared->cache2; + + if ( ( cache_ptr == NULL ) +#ifdef H5_HAVE_PARALLEL + || + ( ( cache_ptr->aux_ptr != NULL ) + && + ( + ((H5AC2_aux_t *)(cache_ptr->aux_ptr))->magic + != + H5AC2__H5AC2_AUX_T_MAGIC + ) + ) +#endif /* H5_HAVE_PARALLEL */ + ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") + } + + result = H5AC2_validate_config(config_ptr); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration"); + } + if ( config_ptr->open_trace_file ) { FILE * file_ptr = NULL; @@ -3341,47 +3722,6 @@ H5AC2_set_cache_auto_resize_config(H5F_t * f, "H5C2_set_evictions_enabled() failed.") } - result = H5C2_get_journal_config((H5C2_t *)cache_ptr, &mdj_enabled, - NULL, NULL, NULL, NULL, NULL, NULL); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C2_get_journal_config() failed.") - } - - if ( config_ptr->enable_journaling != mdj_enabled ) { - - /* we have work to do -- start or stop journaling as requested */ - - if ( config_ptr->enable_journaling ) { - - result = H5C2_begin_journaling(f, - dxpl_id, - cache_ptr, - &(config_ptr->journal_file_path[0]), - config_ptr->jbrb_buf_size, - config_ptr->jbrb_num_bufs, - config_ptr->jbrb_use_aio, - config_ptr->jbrb_human_readable); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_begin_journaling() failed.") - } - } else { - - result = H5C2_end_journaling(f, dxpl_id, cache_ptr); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_end_journaling() failed.") - } - } - } - - #ifdef H5_HAVE_PARALLEL if ( cache_ptr->aux_ptr != NULL ) { @@ -3392,61 +3732,9 @@ H5AC2_set_cache_auto_resize_config(H5F_t * f, done: -#if H5AC2__TRACE_FILE_ENABLED - /* For the set cache auto resize config call, only the contents - * of the config is necessary in the trace file. Write the return - * value to catch occult errors. - */ - if ( ( cache_ptr != NULL ) && - ( H5C2_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %f %f %d %d %d %d %f %d %d \"%s\" %d %d %d %d %d %d\n", - "H5AC2_set_cache_auto_resize_config", - trace_config.version, - (int)(trace_config.rpt_fcn_enabled), - (int)(trace_config.open_trace_file), - (int)(trace_config.close_trace_file), - trace_config.trace_file_name, - (int)(trace_config.evictions_enabled), - (int)(trace_config.set_initial_size), - (int)(trace_config.initial_size), - trace_config.min_clean_fraction, - (int)(trace_config.max_size), - (int)(trace_config.min_size), - trace_config.epoch_length, - (int)(trace_config.incr_mode), - trace_config.lower_hr_threshold, - trace_config.increment, - (int)(trace_config.apply_max_increment), - (int)(trace_config.max_increment), - (int)(trace_config.flash_incr_mode), - trace_config.flash_multiple, - trace_config.flash_threshold, - (int)(trace_config.decr_mode), - trace_config.upper_hr_threshold, - trace_config.decrement, - (int)(trace_config.apply_max_decrement), - (int)(trace_config.max_decrement), - trace_config.epochs_before_eviction, - (int)(trace_config.apply_empty_reserve), - trace_config.empty_reserve, - trace_config.dirty_bytes_threshold, - (int)(config_ptr->enable_journaling), - config_ptr->journal_file_path, - (int)(config_ptr->journal_recovered), - (int)(config_ptr->jbrb_buf_size), - config_ptr->jbrb_num_bufs, - (int)(config_ptr->jbrb_use_aio), - (int)(config_ptr->jbrb_human_readable), - (int)ret_value); - } -#endif /* H5AC2__TRACE_FILE_ENABLED */ - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC2_set_cache_auto_resize_config() */ +} /* H5AC2_set_non_journaling_cache_config() */ /*------------------------------------------------------------------------- @@ -3587,6 +3875,13 @@ H5AC2_validate_config(H5AC2_cache_config_t * config_ptr) "H5AC2_ext_config_2_int_config() failed.") } + result = H5AC2_validate_journaling_config(config_ptr); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error(s) in new config.") + } + result = H5C2_validate_resize_config(&internal_config, H5C2_RESIZE_CFG__VALIDATE_ALL); @@ -5190,5 +5485,127 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC2_receive_and_apply_clean_list() */ + #endif /* H5_HAVE_PARALLEL */ + +/*------------------------------------------------------------------------- + * Function: H5AC2_validate_journaling_config() + * + * Purpose: Run a sanity check on the contents of the journaling + * related fields of the supplied instance of + * H5AC2_cache_config_t. + * + * Do nothing and return SUCCEED if no errors are detected, + * and flag an error and return FAIL otherwise. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 7/6/08 + * + * Modifications: + * + * - None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_validate_journaling_config(H5AC2_cache_config_t * config_ptr) + +{ + herr_t ret_value = SUCCEED; /* Return value */ + int name_len; + + FUNC_ENTER_NOAPI(H5AC2_validate_journaling_config, FAIL) + + if ( config_ptr == NULL ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") + } + + if ( config_ptr->version != H5AC2__CURR_CACHE_CONFIG_VERSION ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") + } + + if ( ( config_ptr->enable_journaling != TRUE ) && + ( config_ptr->enable_journaling != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->enable_journaling must be either TRUE or FALSE.") + } + + if ( ( config_ptr->journal_recovered != TRUE ) && + ( config_ptr->journal_recovered != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_recovered must be either TRUE or FALSE.") + } + + if ( ( config_ptr->enable_journaling ) && + ( config_ptr->journal_recovered ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_recovered must be either TRUE or FALSE.") + } + + /* don't bother to test journal_file_path unless enable_journaling is TRUE */ + if ( config_ptr->enable_journaling ) { + + /* Can't really test the journal_file_path field without trying to + * open the file, so we will content ourselves with a couple of + * sanity checks on the length of the file name. + */ + name_len = HDstrlen(config_ptr->journal_file_path); + + if ( name_len <= 0 ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_file_path is empty.") + + } else if ( name_len > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_file_path too long.") + } + } + + if ( ( config_ptr->jbrb_buf_size < H5AC2__MIN_JBRB_BUF_SIZE ) || + ( config_ptr->jbrb_buf_size > H5AC2__MAX_JBRB_BUF_SIZE ) ) { +#if 1 /* JRM */ + HDfprintf(stdout, "config_ptr->jbrb_buf_size = %d.\n", + (int)(config_ptr->jbrb_buf_size)); +#endif /* JRM */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_buf_size out of range.") + } + + if ( ( config_ptr->jbrb_num_bufs < H5AC2__MIN_JBRB_NUM_BUFS ) || + ( config_ptr->jbrb_num_bufs > H5AC2__MAX_JBRB_NUM_BUFS ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_num_bufs out of range.") + } + + if ( ( config_ptr->jbrb_use_aio != FALSE ) && + ( config_ptr->jbrb_use_aio != TRUE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_use_aio must be either TRUE or FALSE.") + } + + if ( ( config_ptr->jbrb_human_readable != FALSE ) && + ( config_ptr->jbrb_human_readable != TRUE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_human_readable must be either TRUE or FALSE.") + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC2_validate_journaling_config() */ + diff --git a/src/H5AC2private.h b/src/H5AC2private.h index b17b09e..6a46339 100644 --- a/src/H5AC2private.h +++ b/src/H5AC2private.h @@ -182,6 +182,15 @@ extern hid_t H5AC2_dxpl_id; extern hid_t H5AC2_ind_dxpl_id; +/* Cache config field limit #defines */ + +#define H5AC2__MIN_JBRB_BUF_SIZE H5C2__MIN_JBRB_BUF_SIZE +#define H5AC2__MAX_JBRB_BUF_SIZE H5C2__MAX_JBRB_BUF_SIZE + +#define H5AC2__MIN_JBRB_NUM_BUFS H5C2__MIN_JBRB_NUM_BUFS +#define H5AC2__MAX_JBRB_NUM_BUFS H5C2__MAX_JBRB_NUM_BUFS + + /* Default cache configuration. */ #define H5AC2__DEFAULT_CACHE_CONFIG \ @@ -262,6 +271,10 @@ extern hid_t H5AC2_ind_dxpl_id; /* external function declarations: */ H5_DLL herr_t H5AC2_init(void); +H5_DLL herr_t H5AC2_check_for_journaling(H5F_t * f, + hid_t dxpl_id, + H5C2_t * cache_ptr, + hbool_t journal_recovered); H5_DLL herr_t H5AC2_create(H5F_t *f, hid_t dxpl_id, H5AC2_cache_config_t *config_ptr); @@ -331,6 +344,11 @@ H5_DLL herr_t H5AC2_set_cache_auto_resize_config(H5F_t * f, hid_t dxpl_id, H5AC2_cache_config_t *config_ptr); +H5_DLL herr_t H5AC2_set_cache_journaling_config(H5F_t * f, + hid_t dxpl_id, + H5AC2_cache_config_t *config_ptr, + hbool_t show_trace); + H5_DLL herr_t H5AC2_validate_config(H5AC2_cache_config_t * config_ptr); H5_DLL herr_t H5AC2_close_trace_file(H5AC2_t * cache_ptr); diff --git a/src/H5C2.c b/src/H5C2.c index bf571e8..f261e08 100644 --- a/src/H5C2.c +++ b/src/H5C2.c @@ -434,21 +434,23 @@ done: * journaling in progress, and fail if it does unless * the journal_recovered parameter is TRUE. * + * JRM -- 7/10/08 + * Removed the f, dxpl_id, and journal_recovered parameters, + * as checking for journaling in progress is no longer handled + * in H5C2_create(). + * *------------------------------------------------------------------------- */ H5C2_t * -H5C2_create(H5F_t * f, - hid_t dxpl_id, - size_t max_cache_size, +H5C2_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, const char * (* type_name_table_ptr), H5C2_write_permitted_func_t check_write_permitted, hbool_t write_permitted, H5C2_log_flush_func_t log_flush, - void * aux_ptr, - hbool_t journal_recovered) + void * aux_ptr) { int i; H5C2_t * cache_ptr = NULL; @@ -648,16 +650,6 @@ H5C2_create(H5F_t * f, cache_ptr->jwipl_head_ptr = NULL; cache_ptr->jwipl_tail_ptr = NULL; - cache_ptr->mdj_startup_pending = FALSE; - cache_ptr->mdj_startup_f = NULL; - cache_ptr->mdj_startup_dxpl_id = -1; - cache_ptr->mdj_startup_jrnl_file_name = NULL; - cache_ptr->mdj_startup_buf_size = 0; - cache_ptr->mdj_startup_num_bufs = 0; - cache_ptr->mdj_startup_use_aio = FALSE; - cache_ptr->mdj_startup_human_readable = FALSE; - - if ( H5C2_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { /* this should be impossible... */ @@ -671,19 +663,17 @@ H5C2_create(H5F_t * f, cache_ptr->skip_dxpl_id_checks = FALSE; cache_ptr->prefix[0] = '\0'; /* empty string */ - /* test to see if there is a metadata journal that must be recovered - * before we can access the file. Do this now after the cache is - * initialized, as the code for this test assumes a functional - * cache. + /* We used to check for journaling here, but the super block hasn't + * been read in yet at cache creation time -- thus the check for + * journaling has been moved to H5AC2_check_for_journaling(), which + * is simply a * wrapper for H5C2_check_for_journaling(). + * + * H5AC2_check_for_journaling() is called at the end of H5Fopen() -- + * at which point the superblock has been read. + * + * Note that H5Fopen() is called by both H5Fcreate() and H5Fopen(). */ - if ( H5C2_check_for_journaling(f, dxpl_id, cache_ptr, journal_recovered) - != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, \ - "H5C2_check_for_journaling() reports failure.") - } - /* Set return value */ ret_value = cache_ptr; @@ -947,6 +937,15 @@ H5C2_dest(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); + if ( cache_ptr->mdj_enabled ) { + + if ( H5C2_end_journaling(f, dxpl_id, cache_ptr) != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "H5C2_end_journaling() failed.") + } + } + if ( H5C2_flush_cache(f, dxpl_id, H5C2__FLUSH_INVALIDATE_FLAG) < 0 ) { diff --git a/src/H5C2journal.c b/src/H5C2journal.c index b12e8e0..8470add 100644 --- a/src/H5C2journal.c +++ b/src/H5C2journal.c @@ -47,6 +47,18 @@ #include "H5C2pkg.h" /* Cache */ #include "H5Pprivate.h" /* Property lists */ +/**************************************************************************/ +/***************************** global variables ***************************/ +/**************************************************************************/ + +/* In the test code, it is sometimes useful to skip the check for journaling + * in progress on open. The check_for_journaling global is used to support + * this. Note that we can't tuck this variable into H5C2_t, as the test + * takes place before H5Fopen() returns. + */ + +hbool_t H5C2__check_for_journaling = TRUE; + /**************************************************************************/ /************************* journaling code proper *************************/ @@ -84,6 +96,7 @@ H5C2_begin_journaling(H5F_t * f, HDfprintf(stdout, "%s entering.\n", FUNC); #endif /* JRM */ HDassert( f != NULL ); + HDassert( f->name != NULL ); HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); HDassert( cache_ptr->mdj_enabled == FALSE ); @@ -114,78 +127,44 @@ H5C2_begin_journaling(H5F_t * f, HDfprintf(stdout, "%s Finished initial sanity checks.\n", FUNC); #endif /* JRM */ - if ( f->name == NULL ) { - #if 0 /* JRM */ - HDfprintf(stdout, "%s Queueing startup.\n", FUNC); + HDfprintf(stdout, "%s calling H5C2_jb__init().\n", FUNC); #endif /* JRM */ - if ( cache_ptr->mdj_startup_pending ) { - - HDfprintf(stdout, - "%s: metadata journaling startup already pending.\n", - FUNC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "metadata journaling startup already pending.") - } - - result = H5C2_queue_begin_journaling(f, dxpl_id, cache_ptr, - journal_file_name_ptr, buf_size, - num_bufs, use_aio, human_readable); - - if ( result < 0 ) { - - HDfprintf(stdout, "%s: H5C2_queue_begin_journaling() failed.\n", - FUNC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_queue_begin_journaling() failed.") - } - -#if 0 /* JRM */ - HDfprintf(stdout, "%s Queueing startup -- done.\n", FUNC); -#endif /* JRM */ - } else { + result = H5C2_jb__init(&(cache_ptr->mdj_jbrb), + f->name, + journal_file_name_ptr, + buf_size, + num_bufs, + use_aio, + human_readable); + if ( result != SUCCEED ) { #if 0 /* JRM */ - HDfprintf(stdout, "%s calling H5C2_jb__init().\n", FUNC); -#endif /* JRM */ - - result = H5C2_jb__init(&(cache_ptr->mdj_jbrb), - f->name, - journal_file_name_ptr, - buf_size, - num_bufs, - use_aio, - human_readable); - - if ( result != SUCCEED ) { - - HDfprintf(stdout, "%s: H5C2_jb__init() failed.\n", FUNC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_jb__init() failed.") - } + HDfprintf(stdout, "%s: H5C2_jb__init() failed.\n", FUNC); +#endif /* JRM */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_jb__init() failed.") + } #if 0 /* JRM */ HDfprintf(stdout, "%s calling H5C2_mark_journaling_in_progress().\n", FUNC); #endif /* JRM */ - result = H5C2_mark_journaling_in_progress(f, - dxpl_id, - journal_file_name_ptr); - - if ( result != SUCCEED ) { + result = H5C2_mark_journaling_in_progress(f, dxpl_id, journal_file_name_ptr); - HDfprintf(stdout, - "%s: H5C2_mark_journaling_in_progress() failed.\n", FUNC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_mark_journaling_in_progress() failed.") - } - - cache_ptr->mdj_enabled = TRUE; - cache_ptr->mdj_startup_pending = FALSE; + if ( result != SUCCEED ) { +#if 0 /* JRM */ + HDfprintf(stdout, + "%s: H5C2_mark_journaling_in_progress() failed.\n", FUNC); +#endif /* JRM */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_mark_journaling_in_progress() failed.") } + cache_ptr->mdj_enabled = TRUE; + #if 0 /* JRM */ HDfprintf(stdout, "%s exiting.\n", FUNC); #endif /* JRM */ @@ -219,7 +198,6 @@ H5C2_begin_transaction(H5C2_t * cache_ptr, const char * api_call_name) { herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; FUNC_ENTER_NOAPI(H5C2_begin_transaction, FAIL) #if 0 /* JRM */ @@ -238,38 +216,6 @@ H5C2_begin_transaction(H5C2_t * cache_ptr, HDassert( api_call_name != NULL ); HDassert( HDstrlen(api_call_name) <= H5C2__MAX_API_NAME_LEN ); - if ( cache_ptr->mdj_startup_pending ) { -#if 0 /* JRM */ - HDfprintf(stdout, "%s calling H5C2_begin_journaling()...", FUNC); - fflush(stdout); -#endif /* JRM */ - result = H5C2_begin_journaling(cache_ptr->mdj_startup_f, - cache_ptr->mdj_startup_dxpl_id, - cache_ptr, - cache_ptr->mdj_startup_jrnl_file_name, - cache_ptr->mdj_startup_buf_size, - cache_ptr->mdj_startup_num_bufs, - cache_ptr->mdj_startup_use_aio, - cache_ptr->mdj_startup_human_readable); - - if ( result < 0 ) { - - HDfprintf(stdout, "%s H5C2_begin_journaling() failed.\n", FUNC); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C2_begin_journaling() failed.") - } - - if ( cache_ptr->mdj_startup_jrnl_file_name != NULL ) { - - cache_ptr->mdj_startup_jrnl_file_name = (char *) - H5MM_xfree((void *)(cache_ptr->mdj_startup_jrnl_file_name)); - } -#if 0 /* JRM */ - HDfprintf(stdout, "done.\n"); - fflush(stdout); -#endif /* JRM */ - } - if ( cache_ptr->mdj_enabled ) { if ( cache_ptr->trans_in_progress ) { @@ -333,13 +279,19 @@ H5C2_end_journaling(H5F_t * f, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C2_end_journaling, FAIL) - +#if 0 /* JRM */ + HDfprintf(stdout, "%s: entering.\n", FUNC); +#endif /* JRM */ HDassert( f != NULL ); HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); if ( cache_ptr->mdj_enabled ) { +#if 0 /* JRM */ + HDfprintf(stdout, "%s: taking down journaling.\n", FUNC); +#endif /* JRM */ + HDassert( cache_ptr->mdj_enabled ); HDassert( cache_ptr->trans_in_progress == FALSE ); HDassert( cache_ptr->tl_len == 0 ); @@ -378,6 +330,10 @@ H5C2_end_journaling(H5F_t * f, done: +#if 0 /* JRM */ + HDfprintf(stdout, "%s: entering.\n", FUNC); +#endif /* JRM */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_end_journaling() */ @@ -626,44 +582,6 @@ H5C2_get_journal_config(H5C2_t * cache_ptr, *jbrb_human_readable_ptr = (cache_ptr->mdj_jbrb).human_readable; } - - } else if ( cache_ptr->mdj_startup_pending ) { - - *journaling_enabled_ptr = TRUE; - - if ( startup_pending_ptr != NULL ) { - - *startup_pending_ptr = TRUE; - } - - if ( journal_file_path_ptr != NULL ) { - - HDsnprintf(journal_file_path_ptr, - H5AC2__MAX_JOURNAL_FILE_NAME_LEN, - "%s", - cache_ptr->mdj_startup_jrnl_file_name); - } - - if ( jbrb_buf_size_ptr != NULL ) { - - *jbrb_buf_size_ptr = cache_ptr->mdj_startup_buf_size; - } - - if ( jbrb_num_bufs_ptr != NULL ) { - - *jbrb_num_bufs_ptr = cache_ptr->mdj_startup_num_bufs; - } - - if ( jbrb_use_aio_ptr != NULL ) { - - *jbrb_use_aio_ptr = cache_ptr->mdj_startup_use_aio; - } - - if ( jbrb_human_readable_ptr ) { - - *jbrb_human_readable_ptr = cache_ptr->mdj_startup_human_readable; - } - } else { *journaling_enabled_ptr = FALSE; @@ -796,7 +714,7 @@ H5C2_journal_pre_flush(H5C2_t * cache_ptr) HDassert( cache_ptr->mdj_enabled ); if ( cache_ptr->trans_in_progress ) { - HDassert(0); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Transaction in progress during flush?!?!?.") } @@ -1058,7 +976,7 @@ H5C2_journal_transaction(H5F_t * f, if ( ( ! resized ) && ( ! renamed ) ) { if(HADDR_UNDEF==(eoa = H5FDget_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, \ + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, \ "file get eoa request failed") result = H5C2_jb__journal_entry(&(cache_ptr->mdj_jbrb), @@ -1105,93 +1023,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5C2_queue_begin_journaling() - * - * Purpose: Verify that the HDF5 file name is not available. - * - * Then make note of the information needed to begin - * journaling once the file is fully open. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 5/1/08 - * - *------------------------------------------------------------------------- - */ - -herr_t -H5C2_queue_begin_journaling(H5F_t * f, - hid_t dxpl_id, - H5C2_t * cache_ptr, - char * journal_file_name_ptr, - size_t buf_size, - int num_bufs, - hbool_t use_aio, - hbool_t human_readable) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C2_queue_begin_journaling, FAIL) - - HDassert( f != NULL ); - HDassert( cache_ptr != NULL ); - HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); - HDassert( cache_ptr->mdj_enabled == FALSE ); - HDassert( cache_ptr->mdj_startup_pending == FALSE ); - HDassert( cache_ptr->trans_in_progress == FALSE ); - HDassert( cache_ptr->trans_num == 0 ); - HDassert( cache_ptr->last_trans_on_disk == 0 ); - HDassert( cache_ptr->tl_len == 0 ); - HDassert( cache_ptr->tl_size == 0 ); - HDassert( cache_ptr->tl_head_ptr == NULL ); - HDassert( cache_ptr->tl_tail_ptr == NULL ); - HDassert( cache_ptr->jwipl_len == 0 ); - HDassert( cache_ptr->jwipl_size == 0 ); - HDassert( cache_ptr->jwipl_head_ptr == NULL ); - HDassert( cache_ptr->jwipl_tail_ptr == NULL ); - HDassert( buf_size > 0 ); - HDassert( num_bufs > 0 ); - HDassert( journal_file_name_ptr != NULL ); - - if ( cache_ptr->mdj_enabled ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "metadata journaling already enabled on entry.") - } - - cache_ptr->mdj_startup_jrnl_file_name = - (char *)H5MM_malloc(strlen(journal_file_name_ptr) + 1); - - if ( cache_ptr->mdj_startup_jrnl_file_name == NULL ) { - - if ( cache_ptr->mdj_startup_jrnl_file_name == NULL ) { - - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ - "memory allocation failed for jrnl file name buffer.") - } - } - - HDstrcpy(cache_ptr->mdj_startup_jrnl_file_name, journal_file_name_ptr); - - cache_ptr->mdj_startup_f = f; - cache_ptr->mdj_startup_dxpl_id = dxpl_id; - cache_ptr->mdj_startup_buf_size = buf_size; - cache_ptr->mdj_startup_num_bufs = num_bufs; - cache_ptr->mdj_startup_use_aio = use_aio; - cache_ptr->mdj_startup_human_readable = human_readable; - - cache_ptr->mdj_startup_pending = TRUE; - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C2_queue_begin_journaling() */ - - -/*------------------------------------------------------------------------- * Function: H5C2_update_for_new_last_trans_on_disk() * * Purpose: Update the journal write in progress list for a change in @@ -1335,6 +1166,10 @@ H5C2_check_for_journaling(H5F_t * f, FUNC_ENTER_NOAPI(H5C2_check_for_journaling, FAIL) +#if 0 /* JRM */ + HDfprintf(stdout, "%s: entering.\n", FUNC); +#endif /* JRM */ + HDassert( f ); HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); @@ -1343,50 +1178,69 @@ H5C2_check_for_journaling(H5F_t * f, HDassert( cache_ptr->mdj_conf_block_ptr == NULL ); HDassert( cache_ptr->mdj_file_name_ptr == NULL ); - result = H5C2_get_journaling_in_progress(f, dxpl_id, cache_ptr); + if ( H5C2__check_for_journaling ) { - if ( result != SUCCEED ) { + result = H5C2_get_journaling_in_progress(f, dxpl_id, cache_ptr); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_get_journaling_in_progress() failed.") - } + if ( result != SUCCEED ) { - if ( cache_ptr->mdj_file_name_ptr != NULL ) /* journaling was in progress */ - { - if ( journal_recovered ) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_get_journaling_in_progress() failed.") + } - /* delete the metadata journaling config block and the - * superblock extenstion refering to it. - */ + if ( cache_ptr->mdj_file_name_ptr != NULL ) /* journaling was in */ + /* progress */ + { +#if 0 /* JRM */ + HDfprintf(stdout, "%s: journaling was in progress.\n", FUNC); +#endif /* JRM */ - result = H5C2_unmark_journaling_in_progress(f, dxpl_id, cache_ptr); + if ( journal_recovered ) { - if ( result != SUCCEED ) { + /* delete the metadata journaling config block and the + * superblock extenstion refering to it. + */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_unmark_journaling_in_progress() failed.") - } - } else { + result = H5C2_unmark_journaling_in_progress(f, dxpl_id, cache_ptr); - /* we have to play some games here to set up an error message that - * contains the journal file path. In essence, what follows is a - * somewhat modified version of the HGOTO_ERROR() macro. - */ - (void)H5Epush2(H5E_DEFAULT, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, - H5E_CACHE, H5E_CANTJOURNAL, "%s%s%s%s%s%s", - l0, l1, l2, l3, cache_ptr->mdj_file_name_ptr, l4); - (void)H5E_dump_api_stack((int)H5_IS_API(FUNC)); - HGOTO_DONE(FAIL) + if ( result != SUCCEED ) { - } + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_unmark_journaling_in_progress() failed.") + } + } else { + + /* we have to play some games here to set up an error message + * that contains the journal file path. In essence, what + * follows is a somewhat modified version of the HGOTO_ERROR() + * macro. + */ + (void)H5Epush2(H5E_DEFAULT, __FILE__, FUNC, __LINE__, + H5E_ERR_CLS_g, H5E_CACHE, H5E_CANTJOURNAL, + "%s%s%s%s%s%s", l0, l1, l2, l3, + cache_ptr->mdj_file_name_ptr, l4); + (void)H5E_dump_api_stack((int)H5_IS_API(FUNC)); + HGOTO_DONE(FAIL) + + } + } } +#if 0 /* JRM */ + HDfprintf(stdout, "%s: done.\n", FUNC); +#endif /* JRM */ + done: +#if 0 /* JRM */ + HDfprintf(stdout, "%s: exiting.\n", FUNC); +#endif /* JRM */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_check_for_journaling() */ + /*------------------------------------------------------------------------- * Function: H5C2_create_journal_config_block() * @@ -1585,6 +1439,7 @@ H5C2_discard_journal_config_block(const H5F_t * f, H5MM_xfree(cache_ptr->mdj_conf_block_ptr); /* if we get this far, go ahead and null out the fields in *cache_ptr */ + cache_ptr->mdj_conf_block_addr = HADDR_UNDEF; cache_ptr->mdj_conf_block_len = 0; cache_ptr->mdj_conf_block_ptr = NULL; @@ -1639,6 +1494,10 @@ H5C2_get_journaling_in_progress(const H5F_t * f, FUNC_ENTER_NOAPI(H5C2_get_journaling_in_progress, FAIL) +#if 0 /* JRM */ + HDfprintf(stdout, "%s: entering.\n", FUNC); +#endif /* JRM */ + HDassert( f ); HDassert( f->shared != NULL ); HDassert( cache_ptr ); @@ -1648,6 +1507,11 @@ H5C2_get_journaling_in_progress(const H5F_t * f, HDassert( cache_ptr->mdj_conf_block_ptr == NULL ); HDassert( cache_ptr->mdj_file_name_ptr == NULL ); +#if 0 /* JRM */ + HDfprintf(stdout, "%s: f->shared->mdc_jrnl_enabled = %d.\n", FUNC, + (int)(f->shared->mdc_jrnl_enabled)); +#endif /* JRM */ + if ( f->shared->mdc_jrnl_enabled == TRUE ) { cache_ptr->mdj_conf_block_addr = f->shared->mdc_jrnl_block_loc; @@ -1665,8 +1529,16 @@ H5C2_get_journaling_in_progress(const H5F_t * f, } } +#if 0 /* JRM */ + HDfprintf(stdout, "%s: done.\n"); +#endif /* JRM */ + done: +#if 0 /* JRM */ + HDfprintf(stdout, "%s: exiting.\n"); +#endif /* JRM */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_get_journaling_in_progress() */ @@ -1733,6 +1605,10 @@ H5C2_load_journal_config_block(const H5F_t * f, if ( H5F_block_read(f, H5FD_MEM_MDJCONFIG, block_addr, (size_t)block_len, dxpl_id, block_ptr) < 0 ) { +#if 0 /* JRM */ + HDfprintf(stdout, "%s: block_addr = %lld, block_len = %lld.\n", + FUNC, (long long)block_addr, (long long)block_len); +#endif /* JRM */ HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ "Can't read metadata journaling configuration block.") } @@ -1791,10 +1667,10 @@ H5C2_load_journal_config_block(const H5F_t * f, * configuration block successfully. Record the data in the cache * structure. */ - cache_ptr->mdj_file_name_ptr = jfn_ptr; + cache_ptr->mdj_file_name_ptr = jfn_ptr; cache_ptr->mdj_conf_block_addr = block_addr; - cache_ptr->mdj_conf_block_len = block_len; - cache_ptr->mdj_conf_block_ptr = block_ptr; + cache_ptr->mdj_conf_block_len = block_len; + cache_ptr->mdj_conf_block_ptr = block_ptr; done: @@ -1835,7 +1711,9 @@ H5C2_mark_journaling_in_progress(H5F_t * f, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C2_mark_journaling_in_progress, FAIL) - +#if 0 /* JRM */ + HDfprintf(stdout, "%s: Entering.\n", FUNC); +#endif /* JRM */ HDassert( f != NULL ); HDassert( f->shared != NULL ); HDassert( ! f->shared->mdc_jrnl_enabled ); @@ -1849,10 +1727,7 @@ H5C2_mark_journaling_in_progress(H5F_t * f, HDassert( cache_ptr->mdj_conf_block_ptr == NULL ); HDassert( cache_ptr->mdj_file_name_ptr == NULL ); HDassert( journal_file_name_ptr != NULL ); -#if 0 - /* Unfortunately, the flags may not be set yet -- thus we can't - * check for this error. - */ + /* Can't journal a read only file, so verify that we are * opened read/write and fail if we are not. */ @@ -1861,8 +1736,11 @@ H5C2_mark_journaling_in_progress(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ "File is opened read only.") } -#endif + /* first, create a metadata journaling configuration block */ +#if 0 /* JRM */ + HDfprintf(stdout, "%s: creating mdj config block.\n", FUNC); +#endif /* JRM */ result = H5C2_create_journal_config_block(f, dxpl_id, journal_file_name_ptr); @@ -1886,35 +1764,39 @@ H5C2_mark_journaling_in_progress(H5F_t * f, f->shared->mdc_jrnl_block_loc = cache_ptr->mdj_conf_block_addr; f->shared->mdc_jrnl_block_len = cache_ptr->mdj_conf_block_len; +#if 0 /* JRM */ + HDfprintf(stdout, "%s: writing superblock extension.\n", FUNC); +#endif /* JRM */ + if ( H5F_super_write_mdj_msg(f, dxpl_id) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ "H5F_super_write_mdj_msg() failed.") } +#if 0 /* JRM */ + HDfprintf(stdout, "%s: finished writing superblock extension.\n", FUNC); +#endif /* JRM */ + /* Finally, flush the file to ensure that changes made it to disk. */ - /* Quincey: Two issues here: - * - * First, there is the simple matter of using H5Fflush(). - * Given the curent plans for implementing beging/end - * transaction, we have the problem of a flush triggering - * a transaction here -- not what we want. We could get - * around this by calling H5F_flush(), but presently that - * function is local to H5F.c - * - * Second, there is the matter of the scope parameter: - * At present, I am passing H5F_SCOPE_GLOBAL here -- is - * this appropriate? I guess this comes down to how we - * are going to handle journaling in the case of multiple - * files -- a point we haven't discussed. We should do so. - */ +#if 0 /* JRM */ + HDfprintf(stdout, "%s: calling H5F_flush().\n", FUNC); +#endif /* JRM */ - if ( H5Fflush(f->file_id, H5F_SCOPE_GLOBAL) < 0 ) { + if ( H5F_flush(f, dxpl_id, H5F_SCOPE_GLOBAL, H5F_FLUSH_NONE) < 0 ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5Fflush() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5F_flush() failed.") } +#if 0 /* JRM */ + HDfprintf(stdout, "%s: H5F_flush() returns.\n", FUNC); +#endif /* JRM */ + +#if 0 /* JRM */ + HDfprintf(stdout, "%s: Exiting.\n", FUNC); +#endif /* JRM */ + done: FUNC_LEAVE_NOAPI(ret_value) @@ -1960,7 +1842,10 @@ H5C2_unmark_journaling_in_progress(H5F_t * f, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C2_unmark_journaling_in_progress, FAIL) - +#if 0 /* JRM */ + HDfprintf(stdout, "%s: entering.\n", FUNC); + HDfflush(stdout); +#endif /* JRM */ HDassert( f != NULL ); HDassert( f->shared != NULL ); HDassert( f->shared->mdc_jrnl_enabled ); @@ -2032,13 +1917,28 @@ H5C2_unmark_journaling_in_progress(H5F_t * f, * files -- a point we haven't discussed. We should do so. */ +#if 0 /* JRM */ + HDfprintf(stdout, "%s: calling H5F_flush().\n", FUNC); + HDfflush(stdout); +#endif /* JRM */ + if ( H5F_flush(f, dxpl_id, H5F_SCOPE_GLOBAL, H5F_FLUSH_NONE) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5F_flush() failed.") } +#if 0 /* JRM */ + HDfprintf(stdout, "%s: done.\n", FUNC); + HDfflush(stdout); +#endif /* JRM */ + done: +#if 0 /* JRM */ + HDfprintf(stdout, "%s: exiting.\n", FUNC); + HDfflush(stdout); +#endif /* JRM */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_unmark_journaling_in_progress() */ @@ -3111,6 +3011,37 @@ H5C2_jb__comment(H5C2_jbrb_t * struct_ptr, HDassert(struct_ptr); HDassert(comment_ptr); HDassert(struct_ptr->magic == H5C2__H5C2_JBRB_T_MAGIC); + HDassert(struct_ptr->hdf5_file_name); + + /* Verify that header message is present in journal file or ring buffer. + * If not, write it. + */ + if ( struct_ptr->header_present == FALSE ) { + + char buf[150]; + time_t current_date; + + /* Get the current date */ + current_date = time(NULL); + + HDsnprintf(buf, + (size_t)150, + "0 ver_num %ld target_file_name %s creation_date %10.10s human_readable %d\n", + struct_ptr->jvers, + struct_ptr->hdf5_file_name, + ctime(¤t_date), + struct_ptr->human_readable); + + if ( H5C2_jb__write_to_buffer(struct_ptr, HDstrlen(buf), buf, + FALSE, struct_ptr->cur_trans) < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ + "H5C2_jb__write_to_buffer() failed.\n") + } /* end if */ + + struct_ptr->header_present = 1; + struct_ptr->journal_is_empty = 0; + } /* end if */ temp_len = HDstrlen(comment_ptr) + 11; if ( ( temp = H5MM_malloc(HDstrlen(comment_ptr) + 11) ) == NULL ) { diff --git a/src/H5C2pkg.h b/src/H5C2pkg.h index 588b7ab..9c26409 100644 --- a/src/H5C2pkg.h +++ b/src/H5C2pkg.h @@ -805,38 +805,6 @@ struct H5C2_jbrb_t * mdj_jbrb: Instance of H5C2_jbrb_t used to manage logging of journal * entries to the journal file. * - * If journaling is requested at file creation time, we must make note of - * the request, and delay implementing it until receipt of the first - * begin transaction message. This is necessary as the file structure will - * not have been fully initialized at the point the request is received. - * - * The following fields support this facility. - * - * mdj_startup_pending: Boolean flag used to indicate that we must - * do setup for journaling on the next begin transaction - * call. - * - * mdj_startup_f: Pointer to the instance of H5F_t used in the metadata - * journaling startup. - * - * mdj_startup_dxpl_id: dxpl_id used in the metadata journaling startup. - * - * mdj_startup_jrnl_file_name: Pointer to a string containing the name of - * the journal file. - * - * mdj_startup_buf_size: Size of the buffers used in the metadata journal - * buffer ring buffer. - * - * mdj_startup_num_bufs: Number of buffers in the metadata journal buffer - * ring buffer. - * - * mdj_startup_use_aio: use_aio parameter used when setting up metadata - * journaling. - * - * mdj_startup_human_readable: human_readable parameter used when setting - * up metadata journaling. - * - * * While a transaction is in progress, we must maintain a list of the * entries that have been modified during the transaction so we can * generate the appropriate journal entries. The following fields are @@ -1239,15 +1207,6 @@ struct H5C2_t H5C2_cache_entry_t * jwipl_head_ptr; H5C2_cache_entry_t * jwipl_tail_ptr; - hbool_t mdj_startup_pending; - H5F_t * mdj_startup_f; - hid_t mdj_startup_dxpl_id; - char * mdj_startup_jrnl_file_name; - size_t mdj_startup_buf_size; - int mdj_startup_num_bufs; - hbool_t mdj_startup_use_aio; - hbool_t mdj_startup_human_readable; - #if H5C2_COLLECT_CACHE_STATS /* stats fields */ diff --git a/src/H5C2private.h b/src/H5C2private.h index d397548..a1cc12f 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -1179,6 +1179,12 @@ typedef struct H5C2_cache_entry_t #define H5C2__DEF_AR_EPOCH_LENGTH 50000 #define H5C2__MAX_AR_EPOCH_LENGTH 1000000 +#define H5C2__MIN_JBRB_BUF_SIZE ((size_t)(1)) +#define H5C2__MAX_JBRB_BUF_SIZE ((size_t)(2 * 1024 * 1024)) + +#define H5C2__MIN_JBRB_NUM_BUFS 1 +#define H5C2__MAX_JBRB_NUM_BUFS 100 + enum H5C2_resize_status { in_spec2, @@ -1314,17 +1320,14 @@ typedef struct H5C2_auto_size_ctl_t #define H5C2__READ_ONLY_FLAG 0x0400 #define H5C2__CHECK_SIZE_FLAG 0x0800 -H5_DLL H5C2_t * H5C2_create(H5F_t * f, - hid_t dxpl_id, - size_t max_cache_size, +H5_DLL H5C2_t * H5C2_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, const char * (* type_name_table_ptr), H5C2_write_permitted_func_t check_write_permitted, hbool_t write_permitted, H5C2_log_flush_func_t log_flush, - void * aux_ptr, - hbool_t journal_recovered); + void * aux_ptr); H5_DLL void H5C2_def_auto_resize_rpt_fcn(H5C2_t * cache_ptr, int32_t version, @@ -1502,15 +1505,6 @@ H5_DLL herr_t H5C2_journal_pre_flush(H5C2_t * cache_ptr); H5_DLL herr_t H5C2_journal_transaction(H5F_t * f, H5C2_t * cache_ptr); -H5_DLL herr_t H5C2_queue_begin_journaling(H5F_t * f, - hid_t dxpl_id, - H5C2_t * cache_ptr, - char * journal_file_name_ptr, - size_t buf_size, - int num_bufs, - hbool_t use_aio, - hbool_t human_readable); - H5_DLL herr_t H5C2_update_for_new_last_trans_on_disk(H5C2_t * cache_ptr, uint64_t new_last_trans_on_disk); diff --git a/src/H5F.c b/src/H5F.c index 695bb98..3d26afe 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1188,8 +1188,17 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) * multiple Boolean flags. * * Vailin Choi, 2008-04-02 - * To formulate path for later searching of target file for external link - * via H5_build_extpath(). + * To formulate path for later searching of target file for + * external link via H5_build_extpath(). + * + * John Mainzer, 2008-07-07 + * Added calls to H5AC2_check_for_journaling() and + * H5AC2_set_cache_journaling_config() at the end of + * H5F_open(). For now at least, both of these operations + * must be done juct before H5F_open() returns, as the + * required information is not available when the metadata + * cache is created. + * *------------------------------------------------------------------------- */ H5F_t * @@ -1389,7 +1398,27 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d /* formulate the absolute path for later search of target file for external link */ if (H5_build_extpath(name, &file->extpath) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") - + + { + H5AC2_cache_config_t * config_ptr = NULL; + + config_ptr = ((H5AC2_cache_config_t *)&(file->shared->mdc_initCacheCfg)); + + if ( H5AC2_check_for_journaling(file, dxpl_id, file->shared->cache2, + config_ptr->journal_recovered) < 0 ) { + + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, \ + "H5AC2_check_for_journaling() reports failure.") + } + + if ( H5AC2_set_cache_journaling_config(file, dxpl_id, + config_ptr, TRUE) < 0 ) { + + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, \ + "H5AC2_set_cache_journaling_config() failed.") + } + } + /* Success */ ret_value = file; @@ -1744,9 +1773,11 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) nerrors++; /* Flush any cached dataset storage raw data */ + if(H5D_flush(f, dxpl_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") + /* flush (and invalidate, if requested) the entire metadata cache */ H5AC_flags = 0; if((flags & H5F_FLUSH_INVALIDATE) != 0 ) @@ -1770,6 +1801,7 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) } /* end if */ /* Write the superblock to disk */ + if(H5F_super_write(f, dxpl_id) != SUCCEED) HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file") diff --git a/test/cache2_common.c b/test/cache2_common.c index 10e9656..ef8b396 100644 --- a/test/cache2_common.c +++ b/test/cache2_common.c @@ -2794,17 +2794,14 @@ setup_cache2(size_t max_cache_size, file_ptr->shared->cache2 = NULL; - cache_ptr = H5C2_create(file_ptr, - H5P_DATASET_XFER_DEFAULT, - max_cache_size, + cache_ptr = H5C2_create(max_cache_size, min_clean_size, (NUMBER_OF_ENTRY_TYPES - 1), (const char **)entry_type_names2, check_write_permitted2, TRUE, NULL, - NULL, - FALSE); + NULL); file_ptr->shared->cache2 = cache_ptr; } diff --git a/test/cache2_journal.c b/test/cache2_journal.c index 3960516..5bcafc9 100644 --- a/test/cache2_journal.c +++ b/test/cache2_journal.c @@ -14,7 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: John Mainzer - * 11/10/05 + * 3/08 * * This file contains tests for the metadata journaling * features implemented in H5C2.c and friends. @@ -62,6 +62,8 @@ static void end_trans(H5F_t * file_ptr, uint64_t trans_num, const char * trans_name); +static hbool_t file_exists(const char * file_path_ptr); + static void flush_journal(H5C2_t * cache_ptr); static void jrnl_col_major_scan_backward2(H5F_t * file_ptr, @@ -123,12 +125,16 @@ static void jrnl_row_major_scan_forward2(H5F_t * file_ptr, int dirty_unprotects, uint64_t trans_num); #endif /* JRM */ -static void open_exiting_file_for_journaling(const char * hdf_file_name, - const char * journal_file_name, - hid_t * file_id_ptr, - H5F_t ** file_ptr_ptr, - H5C2_t ** cache_ptr_ptr, - hbool_t use_core_driver_if_avail); +static void open_existing_file_for_journaling(const char * hdf_file_name, + const char * journal_file_name, + hid_t * file_id_ptr, + H5F_t ** file_ptr_ptr, + H5C2_t ** cache_ptr_ptr); + +static void open_existing_file_without_journaling(const char * hdf_file_name, + hid_t * file_id_ptr, + H5F_t ** file_ptr_ptr, + H5C2_t ** cache_ptr_ptr); static void setup_cache_for_journaling(const char * hdf_file_name, const char * journal_file_name, @@ -166,6 +172,18 @@ static void write_noflush_verify(H5C2_jbrb_t * struct_ptr, static void check_mdj_config_block_IO(void); +static void check_mdj_file_marking(void); + +static void verify_mdj_file_marking_after_open(void); + +static void verify_mdj_file_marking_on_create(void); + +static void verify_mdj_file_marking_on_open(void); + +static void verify_mdj_file_unmarking_on_file_close(void); + +static void verify_mdj_file_unmarking_on_journaling_shutdown(void); + static void test_mdj_conf_blk_read_write_discard(H5F_t * file_ptr, const char * jrnl_file_path); @@ -513,6 +531,85 @@ end_trans(H5F_t * file_ptr, /*------------------------------------------------------------------------- + * Function: file_exists() + * + * Purpose: If pass2 is true on entry, stat the target file, and + * return TRUE if it exists, and FALSE if it does not. + * + * If any errors are detected in this process, set pass2 + * to FALSE and set failure_mssg2 to point to an appropriate + * error message. + * + * Do nothing and return FALSE if pass2 is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 5//08 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static hbool_t +file_exists(const char * file_path_ptr) +{ + const char * fcn_name = "file_exists()"; + hbool_t ret_val = FALSE; /* will set to TRUE if necessary */ + hbool_t verbose = FALSE; + h5_stat_t buf; + + if ( pass2 ) { + + if ( file_path_ptr == NULL ) { + + failure_mssg2 = "file_path_ptr NULL on entry?!?", + pass2 = FALSE; + } + } + + if ( pass2 ) { + + if ( HDstat(file_path_ptr, &buf) == 0 ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: HDstat(%s) succeeded.\n", fcn_name, + file_path_ptr); + } + + ret_val = TRUE; + + } else if ( errno == ENOENT ) { + + if ( verbose ) { + + HDfprintf(stdout, "%s: HDstat(%s) failed with ENOENT\n", + fcn_name, file_path_ptr); + } + + } else { + + if ( verbose ) { + + HDfprintf(stdout, + "%s: HDstat() failed with unexpected errno = %d.\n", + fcn_name, errno); + } + + failure_mssg2 = "HDstat() returned unexpected value."; + pass2 = FALSE; + + } + } + + return(ret_val); + +} /* file_exists() */ + + +/*------------------------------------------------------------------------- * Function: flush_journal() * * Purpose: If pass2 is true on entry, attempt to flush the journal. @@ -1581,14 +1678,13 @@ jrnl_row_major_scan_forward2(H5F_t * file_ptr, */ static void -open_exiting_file_for_journaling(const char * hdf_file_name, - const char * journal_file_name, - hid_t * file_id_ptr, - H5F_t ** file_ptr_ptr, - H5C2_t ** cache_ptr_ptr, - hbool_t use_core_driver_if_avail) +open_existing_file_for_journaling(const char * hdf_file_name, + const char * journal_file_name, + hid_t * file_id_ptr, + H5F_t ** file_ptr_ptr, + H5C2_t ** cache_ptr_ptr) { - const char * fcn_name = "open_exiting_file_for_journaling()"; + const char * fcn_name = "open_existing_file_for_journaling()"; hbool_t show_progress = FALSE; hbool_t verbose = FALSE; int cp = 0; @@ -1608,7 +1704,7 @@ open_exiting_file_for_journaling(const char * hdf_file_name, ( cache_ptr_ptr == NULL ) ) { failure_mssg2 = - "Bad param(s) on entry to open_exiting_file_for_journaling().\n"; + "Bad param(s) on entry to open_existing_file_for_journaling().\n"; pass2 = FALSE; } else if ( strlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { @@ -1785,6 +1881,168 @@ open_exiting_file_for_journaling(const char * hdf_file_name, /*------------------------------------------------------------------------- + * Function: open_existing_file_without_journaling() + * + * Purpose: If pass2 is true on entry, open the specified a HDF5 file + * with journaling disabled. Return pointers to the cache + * data structure and file data structures, and verify that + * it contains the expected data. + * + * On failure, set pass2 to FALSE, and set failure_mssg2 + * to point to an appropriate failure message. + * + * Do nothing if pass2 is FALSE on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 7/10/08 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static void +open_existing_file_without_journaling(const char * hdf_file_name, + hid_t * file_id_ptr, + H5F_t ** file_ptr_ptr, + H5C2_t ** cache_ptr_ptr) +{ + const char * fcn_name = "open_existing_file_without_journaling()"; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + int cp = 0; + hid_t fapl_id = -1; + hid_t file_id = -1; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; + + if ( pass2 ) + { + if ( ( hdf_file_name == NULL ) || + ( file_id_ptr == NULL ) || + ( file_ptr_ptr == NULL ) || + ( cache_ptr_ptr == NULL ) ) { + + failure_mssg2 = + "Bad param(s) on entry to open_existing_file_without_journaling().\n"; + pass2 = FALSE; + + } else { + + if ( verbose ) { + + HDfprintf(stdout, "%s: HDF file name = \"%s\".\n", + fcn_name, hdf_file_name); + } + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /**************************************/ + /* open the file with the fapl above. */ + /**************************************/ + + /* open the file using fapl_id */ + if ( pass2 ) { + + file_id = H5Fopen(hdf_file_name, H5F_ACC_RDWR, fapl_id); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed.\n"; + + } else { + + file_ptr = H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "Can't get file_ptr."; + + if ( verbose ) { + HDfprintf(stdout, "%s: Can't get file_ptr.\n", fcn_name); + } + } + } + } + + /* At least within the context of the cache2 test code, there should be + * no need to allocate space for test entries since we are re-opening + * the file, and any needed space allocation should have been done at + * file creation. + */ + + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get a pointer to the files internal data structure and then + * to the cache structure + */ + if ( pass2 ) { + + if ( file_ptr->shared->cache2 == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "can't get cache2 pointer(1).\n"; + + } else { + + cache_ptr = file_ptr->shared->cache2; + } + } + + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass2 ) { + + *file_id_ptr = file_id; + *file_ptr_ptr = file_ptr; + *cache_ptr_ptr = cache_ptr; + } + + if ( show_progress ) + HDfprintf(stdout, "%s: cp = %d -- exiting.\n", fcn_name, cp++); + + return; + +} /* open_existing_file_without_journaling() */ + + +/*------------------------------------------------------------------------- * Function: setup_cache_for_journaling() * * Purpose: If pass2 is true on entry, create a HDF5 file with @@ -1813,7 +2071,11 @@ setup_cache_for_journaling(const char * hdf_file_name, hid_t * file_id_ptr, H5F_t ** file_ptr_ptr, H5C2_t ** cache_ptr_ptr, +#if USE_CORE_DRIVER hbool_t use_core_driver_if_avail) +#else /* USE_CORE_DRIVER */ + hbool_t UNUSED use_core_driver_if_avail) +#endif /* USE_CORE_DRIVER */ { const char * fcn_name = "setup_cache_for_journaling()"; hbool_t show_progress = FALSE; @@ -1878,8 +2140,8 @@ setup_cache_for_journaling(const char * hdf_file_name, "Bad param(s) on entry to setup_cache_for_journaling().\n"; pass2 = FALSE; } - else if ( strlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { - + else if ( strlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) + { failure_mssg2 = "journal file name too long.\n"; pass2 = FALSE; @@ -2008,7 +2270,8 @@ setup_cache_for_journaling(const char * hdf_file_name, failure_mssg2 = "actual_base_addr > BASE_ADDR"; if ( verbose ) { - HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", fcn_name); + HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", + fcn_name); } } } @@ -2037,6 +2300,18 @@ setup_cache_for_journaling(const char * hdf_file_name, if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + /* close the fapl */ + if ( pass2 ) { + + if ( H5Pclose(fapl_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "error closing fapl.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( pass2 ) { *file_id_ptr = file_id; @@ -2080,7 +2355,7 @@ takedown_cache_after_journaling(hid_t file_id, if ( file_id >= 0 ) { - if ( H5Fclose(file_id) ) { + if ( H5Fclose(file_id) < 0 ) { if ( pass2 ) { @@ -2224,7 +2499,12 @@ verify_journal_contents(const char * journal_file_path_ptr, } else { expected_len = (size_t)(buf.st_size); - + + if ( verbose ) { + + HDfprintf(stdout, "%s: expected_len = %d.\n", + fcn_name, (int)expected_len); + } } } } @@ -2273,14 +2553,14 @@ verify_journal_contents(const char * journal_file_path_ptr, if ( pass2 ) { first_line_len = 1; - read_result = read(journal_file_fd, &ch, 1); + read_result = HDread(journal_file_fd, &ch, 1); while ( ( ch != '\n' ) && ( first_line_len < 128 ) && ( read_result == 1 ) ) { first_line_len++; - read_result = read(journal_file_fd, &ch, 1); + read_result = HDread(journal_file_fd, &ch, 1); } if ( ch != '\n' ) { @@ -2302,14 +2582,14 @@ verify_journal_contents(const char * journal_file_path_ptr, if ( pass2 ) { first_line_len = 1; - read_result = read(expected_file_fd, &ch, 1); + read_result = HDread(expected_file_fd, &ch, 1); while ( ( ch != '\n' ) && ( first_line_len < 128 ) && ( read_result == 1 ) ) { first_line_len++; - read_result = read(expected_file_fd, &ch, 1); + read_result = HDread(expected_file_fd, &ch, 1); } if ( ch != '\n' ) { @@ -2398,6 +2678,12 @@ verify_journal_contents(const char * journal_file_path_ptr, if ( HDstrcmp(journal_buf, expected_buf) != 0 ) { + if ( verbose ) { + + HDfprintf(stdout, "expected_buf = \"%s\"\n", expected_buf); + HDfprintf(stdout, "journal_buf = \"%s\"\n", journal_buf); + } + failure_mssg2 = "Unexpected journal file contents(2)."; pass2 = FALSE; } @@ -2603,7 +2889,18 @@ verify_journal_empty(const char * journal_file_path_ptr) * journaling is working. * * 4) Close the file, and verify that the journal is deleted. - * Then delete the file. + * + * 5) Re-open the file with journaling disabled. Do a + * transaction or two, and verify that the transactions + * took place, and that there is no journal file. + * + * 6) Enable journaling on the open file. Do a transaction + * or two to verify that journaling is working. + * + * 7) Disable journaling on the open file. Verify that the + * journal file has been deleted. + * + * 8) Close and delete the file. * * Return: void * @@ -2621,35 +2918,39 @@ mdj_smoke_check_00(void) const char * fcn_name = "mdj_smoke_check_00()"; const char * testfiles[] = { - "cache2_journal_sc00_000.jnl", - "cache2_journal_sc00_001.jnl", - "cache2_journal_sc00_002.jnl", - "cache2_journal_sc00_003.jnl", - "cache2_journal_sc00_004.jnl", - "cache2_journal_sc00_005.jnl", - "cache2_journal_sc00_006.jnl", - "cache2_journal_sc00_007.jnl", - "cache2_journal_sc00_008.jnl", - "cache2_journal_sc00_009.jnl", - "cache2_journal_sc00_010.jnl", - "cache2_journal_sc00_011.jnl", - "cache2_journal_sc00_012.jnl", - "cache2_journal_sc00_013.jnl", - "cache2_journal_sc00_014.jnl", - "cache2_journal_sc00_015.jnl", - "cache2_journal_sc00_016.jnl", - "cache2_journal_sc00_017.jnl", + "testfiles/cache2_journal_sc00_000.jnl", + "testfiles/cache2_journal_sc00_001.jnl", + "testfiles/cache2_journal_sc00_002.jnl", + "testfiles/cache2_journal_sc00_003.jnl", + "testfiles/cache2_journal_sc00_004.jnl", + "testfiles/cache2_journal_sc00_005.jnl", + "testfiles/cache2_journal_sc00_006.jnl", + "testfiles/cache2_journal_sc00_007.jnl", + "testfiles/cache2_journal_sc00_008.jnl", + "testfiles/cache2_journal_sc00_009.jnl", + "testfiles/cache2_journal_sc00_010.jnl", + "testfiles/cache2_journal_sc00_011.jnl", + "testfiles/cache2_journal_sc00_012.jnl", + "testfiles/cache2_journal_sc00_013.jnl", + "testfiles/cache2_journal_sc00_014.jnl", + "testfiles/cache2_journal_sc00_015.jnl", + "testfiles/cache2_journal_sc00_016.jnl", + "testfiles/cache2_journal_sc00_017.jnl", + "testfiles/cache2_journal_sc00_018.jnl", NULL }; char filename[512]; char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t testfile_missing = FALSE; hbool_t show_progress = FALSE; hbool_t verbose = FALSE; - hbool_t update_architypes = TRUE; + hbool_t update_architypes = FALSE; + herr_t result; int cp = 0; hid_t file_id = -1; H5F_t * file_ptr = NULL; H5C2_t * cache_ptr = NULL; + H5AC2_cache_config_t mdj_config; TESTING("mdj smoke check 00 -- general coverage"); @@ -2734,8 +3035,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[0]); } + + if ( file_exists(testfiles[0]) ) { + + verify_journal_contents(journal_filename, testfiles[0]); - verify_journal_contents(journal_filename, testfiles[0]); + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -2807,8 +3115,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[1]); } + + if ( file_exists(testfiles[1]) ) { + + verify_journal_contents(journal_filename, testfiles[1]); - verify_journal_contents(journal_filename, testfiles[1]); + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -2848,8 +3163,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[2]); } + + if ( file_exists(testfiles[2]) ) { + + verify_journal_contents(journal_filename, testfiles[2]); - verify_journal_contents(journal_filename, testfiles[2]); + } else { + + testfile_missing = TRUE; + } @@ -2879,10 +3201,17 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[3]); } + + if ( file_exists(testfiles[3]) ) { - verify_journal_contents(journal_filename, testfiles[3]); + verify_journal_contents(journal_filename, testfiles[3]); - if ( show_progress ) + } else { + + testfile_missing = TRUE; + } + + if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -2920,8 +3249,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[4]); } + + if ( file_exists(testfiles[4]) ) { + + verify_journal_contents(journal_filename, testfiles[4]); - verify_journal_contents(journal_filename, testfiles[4]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -2966,8 +3302,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[5]); } + + if ( file_exists(testfiles[5]) ) { + + verify_journal_contents(journal_filename, testfiles[5]); - verify_journal_contents(journal_filename, testfiles[5]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -2998,8 +3341,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[6]); } + + if ( file_exists(testfiles[6]) ) { + + verify_journal_contents(journal_filename, testfiles[6]); - verify_journal_contents(journal_filename, testfiles[6]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3042,8 +3392,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[7]); } + + if ( file_exists(testfiles[7]) ) { + + verify_journal_contents(journal_filename, testfiles[7]); - verify_journal_contents(journal_filename, testfiles[7]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3098,8 +3455,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[8]); } + + if ( file_exists(testfiles[8]) ) { + + verify_journal_contents(journal_filename, testfiles[8]); - verify_journal_contents(journal_filename, testfiles[8]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3157,8 +3521,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[9]); } + + if ( file_exists(testfiles[9]) ) { + + verify_journal_contents(journal_filename, testfiles[9]); - verify_journal_contents(journal_filename, testfiles[9]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3220,8 +3591,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[10]); } + + if ( file_exists(testfiles[10]) ) { + + verify_journal_contents(journal_filename, testfiles[10]); - verify_journal_contents(journal_filename, testfiles[10]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3268,8 +3646,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[11]); } + + if ( file_exists(testfiles[11]) ) { + + verify_journal_contents(journal_filename, testfiles[11]); - verify_journal_contents(journal_filename, testfiles[11]); + } else { + + testfile_missing = TRUE; + } /* g-2) Now setup flush operations on some entries to dirty, resize, @@ -3362,8 +3747,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[12]); } + + if ( file_exists(testfiles[12]) ) { + + verify_journal_contents(journal_filename, testfiles[12]); - verify_journal_contents(journal_filename, testfiles[12]); + } else { + + testfile_missing = TRUE; + } /* g-4) Now dirty (MICRO_ENTRY_TYPE, 24), which dirties @@ -3384,8 +3776,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[13]); } + + if ( file_exists(testfiles[13]) ) { + + verify_journal_contents(journal_filename, testfiles[13]); - verify_journal_contents(journal_filename, testfiles[13]); + } else { + + testfile_missing = TRUE; + } /* g-4) Now dirty (MICRO_ENTRY_TYPE, 25), which dirties @@ -3408,8 +3807,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[14]); } + + if ( file_exists(testfiles[14]) ) { + + verify_journal_contents(journal_filename, testfiles[14]); - verify_journal_contents(journal_filename, testfiles[14]); + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -3455,8 +3861,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[15]); } + + if ( file_exists(testfiles[15]) ) { + + verify_journal_contents(journal_filename, testfiles[15]); - verify_journal_contents(journal_filename, testfiles[15]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3479,8 +3892,15 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[16]); } + + if ( file_exists(testfiles[16]) ) { + + verify_journal_contents(journal_filename, testfiles[16]); - verify_journal_contents(journal_filename, testfiles[16]); + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3520,8 +3940,8 @@ mdj_smoke_check_00(void) /* c) Re-open the hdf5 file. */ - open_exiting_file_for_journaling(filename, journal_filename, &file_id, - &file_ptr, &cache_ptr, FALSE); + open_existing_file_for_journaling(filename, journal_filename, &file_id, + &file_ptr, &cache_ptr); if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3543,25 +3963,243 @@ mdj_smoke_check_00(void) copy_file(journal_filename, testfiles[17]); } + + if ( file_exists(testfiles[17]) ) { + + verify_journal_contents(journal_filename, testfiles[17]); - verify_journal_contents(journal_filename, testfiles[17]); + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + /**************************************************************/ + /* 4) Close the file, and verify that the journal is deleted. */ + /**************************************************************/ + + /* Close the hdf5 file. */ + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "temporary H5Fclose() failed.\n"; + + } else { + file_id = -1; + file_ptr = NULL; + cache_ptr = NULL; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + + /* b) Verify that the journal file has been deleted. */ + verify_journal_deleted(journal_filename); + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + + /************************************************************/ + /* 5) Re-open the file with journaling disabled. Do a */ + /* transaction or two, and verify that the transactions */ + /* took place, and that there is no journal file. */ + /************************************************************/ - /*******************************************************/ - /* 4) Close and discard the file and the journal file. */ - /*******************************************************/ + /* re-open the file without journaling enabled */ - takedown_cache_after_journaling(file_id, filename, journal_filename, FALSE); + open_existing_file_without_journaling(filename, &file_id, + &file_ptr, &cache_ptr); if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); - if ( pass2 ) { PASSED(); } else { H5_FAILED(); } + + /* do a transaction to verify that journaling is disabled. + * + * Note that we will only get a transaction number of zero if + * journaling is disabled -- thus the following begin/end trans + * calls should fail if journaling is enabled. + */ + + begin_trans(cache_ptr, verbose, (uint64_t)0, "transaction 1.6"); + + insert_entry2(file_ptr, 0, 10, FALSE, H5C2__NO_FLAGS_SET); + protect_entry2(file_ptr, 0, 0); + unprotect_entry2(file_ptr, 0, 0, TRUE, H5C2__NO_FLAGS_SET); + + end_trans(file_ptr, cache_ptr, verbose, (uint64_t)0, "transaction 1.6"); + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + if ( ( pass2 ) && ( cache_ptr->mdj_enabled ) ) { + + pass2 = FALSE; + failure_mssg2 = "journaling is enabled?!?!(1).\n"; + } + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + /* note that flush_journal() will throw an exception if journaling + * is not enabled, so we don't call it here. Instead, just call + * verify_journal_deleted() to verify that there is no journal file. + */ + + verify_journal_deleted(journal_filename); + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + + /************************************************************/ + /* 6) Enable journaling on the open file. Do a transaction */ + /* or two to verify that journaling is working. */ + /************************************************************/ + + /* now enable journaling */ + if ( pass2 ) { + + mdj_config.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + + result = H5Fget_mdc_config(file_id, (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fget_mdc_config() failed.\n"; + } + + /* set journaling config fields to taste */ + mdj_config.enable_journaling = TRUE; + + strcpy(mdj_config.journal_file_path, journal_filename); + + mdj_config.journal_recovered = FALSE; + mdj_config.jbrb_buf_size = (8 * 1024); + mdj_config.jbrb_num_bufs = 2; + mdj_config.jbrb_use_aio = FALSE; + mdj_config.jbrb_human_readable = TRUE; + } + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + if ( pass2 ) { + + result = H5Fset_mdc_config(file_id, (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fset_mdc_config() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + /* do a transaction or to to verify that journaling is working. */ + + begin_trans(cache_ptr, verbose, (uint64_t)1, "transaction 1.7"); + + insert_entry2(file_ptr, 0, 20, FALSE, H5C2__NO_FLAGS_SET); + protect_entry2(file_ptr, 0, 0); + unprotect_entry2(file_ptr, 0, 0, TRUE, H5C2__NO_FLAGS_SET); + + end_trans(file_ptr, cache_ptr, verbose, (uint64_t)1, "transaction 1.7"); + + flush_journal(cache_ptr); + + if ( update_architypes ) { + + copy_file(journal_filename, testfiles[18]); + } + + if ( file_exists(testfiles[18]) ) { + + verify_journal_contents(journal_filename, testfiles[18]); + + } else { + + testfile_missing = TRUE; + } + + flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + + /************************************************************/ + /* 7) Disable journaling on the open file. Verify that the */ + /* journal file has been deleted. */ + /************************************************************/ + + /* disable journaling */ + if ( pass2 ) { + + mdj_config.enable_journaling = FALSE; + + result = H5Fset_mdc_config(file_id, (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fset_mdc_config() failed.\n"; + } + } + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + verify_journal_deleted(journal_filename); + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + + /*********************************/ + /* 8) Close and delete the file. */ + /*********************************/ + + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fclose(file_id) failed.\n"; + + } + } + + HDremove(journal_filename); + + if ( show_progress ) + HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); + + if ( pass2 ) { + + PASSED(); + + if ( testfile_missing ) { + + puts(" WARNING: One or more missing test files."); + fflush(stdout); + } + } else { + + H5_FAILED(); + } if ( ! pass2 ) { @@ -3600,16 +4238,17 @@ mdj_smoke_check_01(void) const char * fcn_name = "mdj_smoke_check_01()"; const char * testfiles[] = { - "cache2_journal_sc01_000.jnl", - "cache2_journal_sc01_001.jnl", + "testfiles/cache2_journal_sc01_000.jnl", + "testfiles/cache2_journal_sc01_001.jnl", NULL }; char filename[512]; char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t testfile_missing = FALSE; hbool_t show_progress = FALSE; hbool_t dirty_inserts = FALSE; hbool_t verbose = FALSE; - hbool_t update_architypes = TRUE; + hbool_t update_architypes = FALSE; int dirty_unprotects = FALSE; int dirty_destroys = FALSE; hbool_t display_stats = FALSE; @@ -3713,8 +4352,15 @@ mdj_smoke_check_01(void) copy_file(journal_filename, testfiles[0]); } + + if ( file_exists(testfiles[0]) ) { - verify_journal_contents(journal_filename, testfiles[0]); + verify_journal_contents(journal_filename, testfiles[0]); + + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -3751,8 +4397,15 @@ mdj_smoke_check_01(void) copy_file(journal_filename, testfiles[1]); } + + if ( file_exists(testfiles[1]) ) { - verify_journal_contents(journal_filename, testfiles[1]); + verify_journal_contents(journal_filename, testfiles[1]); + + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -3789,8 +4442,15 @@ mdj_smoke_check_01(void) copy_file(journal_filename, testfiles[2]); } + + if ( file_exists(testfiles[2]) ) { - verify_journal_contents(journal_filename, testfiles[2]); + verify_journal_contents(journal_filename, testfiles[2]); + + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -3822,8 +4482,15 @@ mdj_smoke_check_01(void) copy_file(journal_filename, testfiles[0]); } + + if ( file_exists(testfiles[0]) ) { - verify_journal_contents(journal_filename, testfiles[0]); + verify_journal_contents(journal_filename, testfiles[0]); + + } else { + + testfile_missing = TRUE; + } flush_cache2(file_ptr, FALSE, FALSE, FALSE); /* resets transaction number */ @@ -3855,8 +4522,15 @@ mdj_smoke_check_01(void) copy_file(journal_filename, testfiles[1]); } + + if ( file_exists(testfiles[1]) ) { - verify_journal_contents(journal_filename, testfiles[1]); + verify_journal_contents(journal_filename, testfiles[1]); + + } else { + + testfile_missing = TRUE; + } if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); @@ -3876,7 +4550,19 @@ mdj_smoke_check_01(void) if ( show_progress ) HDfprintf(stdout, "%s:%d cp = %d.\n", fcn_name, pass2, cp++); - if ( pass2 ) { PASSED(); } else { H5_FAILED(); } + if ( pass2 ) { + + PASSED(); + + if ( testfile_missing ) { + + puts(" WARNING: One or more missing test files."); + fflush(stdout); + } + } else { + + H5_FAILED(); + } if ( ! pass2 ) { @@ -3989,7 +4675,8 @@ check_mdj_config_block_IO(void) /* call H5Pset_libver_bounds() on the fapl_id */ if ( pass2 ) { - if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) { + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { pass2 = FALSE; failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; @@ -4149,7 +4836,7 @@ check_mdj_config_block_IO(void) /* close the file. */ if ( pass2 ) { - if ( H5Fclose(file_id) ) { + if ( H5Fclose(file_id) < 0 ) { pass2 = FALSE; failure_mssg2 = "file close failed (1)."; @@ -4266,7 +4953,7 @@ check_mdj_config_block_IO(void) if ( pass2 ) { - if ( H5Fclose(file_id) ) { + if ( H5Fclose(file_id) < 0 ) { pass2 = FALSE; failure_mssg2 = "file close failed (5)."; @@ -4525,6 +5212,8 @@ test_mdj_conf_blk_read_write_discard(H5F_t * file_ptr, *------------------------------------------------------------------------- */ +extern hbool_t H5C2__check_for_journaling; + static void check_superblock_extensions(void) { @@ -4539,7 +5228,7 @@ check_superblock_extensions(void) hid_t dataset_id = -1; hid_t dataspace_id = -1; H5F_t * file_ptr = NULL; - hsize_t dims[2]; + hsize_t dims[2]; TESTING("superblock extensions"); @@ -4709,7 +5398,7 @@ check_superblock_extensions(void) /* close the data set, the data space, and the file */ if ( ( H5Dclose(dataset_id) < 0 ) || ( H5Sclose(dataspace_id) < 0 ) || - ( H5Fclose(file_id) ) ) { + ( H5Fclose(file_id) < 0 ) ) { pass2 = FALSE; failure_mssg2 = "data set, data space, or file close failed."; @@ -4787,7 +5476,7 @@ check_superblock_extensions(void) /* close the file again. */ if ( pass2 ) { - if ( H5Fclose(file_id) ) { + if ( H5Fclose(file_id) < 0 ) { pass2 = FALSE; failure_mssg2 = "file close failed (1)."; @@ -4802,10 +5491,14 @@ check_superblock_extensions(void) /* extension indicates that the file is being journaled. */ /*****************************************************************/ - /* open the file r/w using the default FAPL */ + /* open the file r/w using the default FAPL -- turn off journaling + * in progress check during the open. + * */ if ( pass2 ) { + H5C2__check_for_journaling = FALSE; file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + H5C2__check_for_journaling = TRUE; if ( file_id < 0 ) { @@ -4842,298 +5535,2300 @@ check_superblock_extensions(void) (long)(mdc_jrnl_block_loc)); failure_mssg2 = "unexpected mdc_jrnl_block_loc(1).\n"; - } else if ( file_ptr->shared->mdc_jrnl_block_len != - (hsize_t)mdc_jrnl_block_len ) { - - pass2 = FALSE; - failure_mssg2 = "unexpected mdc_jrnl_block_len (1).\n"; + } else if ( file_ptr->shared->mdc_jrnl_block_len != + (hsize_t)mdc_jrnl_block_len ) { + + pass2 = FALSE; + failure_mssg2 = "unexpected mdc_jrnl_block_len (1).\n"; + + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /*****************************************************************/ + /* 6) Reset the journaling information to indicate that the file */ + /* is not being journaled, and close the file again. */ + /*****************************************************************/ + + if ( pass2 ) { + + file_ptr->shared->mdc_jrnl_enabled = FALSE; + + if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5F_super_write_mdj_msg failed (2)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* close the file again. */ + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "file close failed (2)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /******************************************************************/ + /* 7) Open the file a fourth time, and verify that the superblock */ + /* extension indicates that the file is not being journaled. */ + /*******************************************************************/ + + /* open the file r/w using the default FAPL */ + if ( pass2 ) { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed (3).\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get a pointer to the files internal data structure and then + * verify that journaling is disabled. + */ + if ( pass2 ) { + + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "Can't get file_ptr (4).\n"; + + } else if ( file_ptr->shared->mdc_jrnl_enabled ) { + + pass2 = FALSE; + failure_mssg2 = "Journaling enabled on file open (2).\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /*******************************************************************/ + /* 8) Write data to the superblock, marking the file as being */ + /* journaled. Now write different data to the superbloc, that */ + /* still marks the file as being journaled. Close the file. */ + /*******************************************************************/ + + if ( pass2 ) { + + file_ptr->shared->mdc_jrnl_enabled = TRUE; + file_ptr->shared->mdc_jrnl_block_loc = mdc_jrnl_block_loc * 2; + file_ptr->shared->mdc_jrnl_block_len = mdc_jrnl_block_len * 2; + + if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5F_super_write_mdj_msg failed (3)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass2 ) { + + file_ptr->shared->mdc_jrnl_enabled = TRUE; + file_ptr->shared->mdc_jrnl_block_loc = mdc_jrnl_block_loc / 2; + file_ptr->shared->mdc_jrnl_block_len = mdc_jrnl_block_len / 2; + + if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5F_super_write_mdj_msg failed (4)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* close the file again. */ + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "file close failed (3)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /***************************************************************/ + /* 9) Re-open the file, and verify that the second write in 8 */ + /* above took. */ + /***************************************************************/ + + /* open the file r/w using the default FAPL -- turn off journaling + * in progress check during the open. + */ + if ( pass2 ) { + + H5C2__check_for_journaling = FALSE; + file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + H5C2__check_for_journaling = TRUE; + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed (4).\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get a pointer to the files internal data structure and then + * verify that journaling is enabled. + */ + if ( pass2 ) { + + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "Can't get file_ptr (5).\n"; + + } else if ( ! file_ptr->shared->mdc_jrnl_enabled ) { + + pass2 = FALSE; + failure_mssg2 = "Journaling disabled on file open (2).\n"; + + } else if ( file_ptr->shared->mdc_jrnl_block_loc != + mdc_jrnl_block_loc / 2 ) { + + pass2 = FALSE; + HDfprintf(stdout, "%s: block_loc = %ld (%ld).\n", + fcn_name, (long)(file_ptr->shared->mdc_jrnl_block_loc), + (long)(mdc_jrnl_block_loc)); + failure_mssg2 = "unexpected mdc_jrnl_block_loc(2).\n"; + + } else if ( file_ptr->shared->mdc_jrnl_block_len != + (hsize_t)mdc_jrnl_block_len / 2 ) { + + pass2 = FALSE; + failure_mssg2 = "unexpected mdc_jrnl_block_len (2).\n"; + + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /******************************************************************/ + /* 10) Write data to the superblock indicating that journaling is */ + /* not in progress. Close the file. */ + /******************************************************************/ + + if ( pass2 ) { + + file_ptr->shared->mdc_jrnl_enabled = FALSE; + + if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5F_super_write_mdj_msg failed (5)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* close the file again. */ + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "file close failed (4)."; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /*************************************************************/ + /* 11) Reopen the file, and verify that journaling is not in */ + /* progress. */ + /*************************************************************/ + + /* open the file r/w using the default FAPL */ + if ( pass2 ) { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed (5).\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + /* get a pointer to the files internal data structure and then + * verify that journaling is disabled. + */ + if ( pass2 ) { + + file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "Can't get file_ptr (6).\n"; + + } else if ( file_ptr->shared->mdc_jrnl_enabled ) { + + pass2 = FALSE; + failure_mssg2 = "Journaling enabled on file open (3).\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + + /*************************************/ + /* 12) Close the file and delete it. */ + /*************************************/ + + if ( pass2 ) { + + if ( H5Fclose(file_id) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "file close failed (5)."; + + } else if ( HDremove(filename) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "HDremove() failed.\n"; + } + } + + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + + if ( pass2 ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass2 ) { + + failures2++; + HDfprintf(stdout, "%s: failure_mssg2 = \"%s\".\n", + fcn_name, failure_mssg2); + } + +} /* check_superblock_extensions() */ + + +/*** Check metadata journaling file marking ***/ + +/*************************************************************************** + * Function: check_mdj_file_marking + * + * Purpose: Verify that HDF5 file is marked as having journaling + * in progress when journaling is enabled, and that it is + * unmarked when journaling is shut down, or when the file + * is closed normally. + * + * Do nothing if pass2 is false on entry. + * + * On failure, set pass2 to false, and failure_mssg2 to an + * appropriate error string. + * + * Return: void + * + * Programmer: John Mainzer + * 7/2/08 + * + **************************************************************************/ + +/* xyzzy */ + +static void +check_mdj_file_marking(void) +{ + const char * fcn_name = "check_mdj_file_marking():"; + + TESTING("metadata journaling file marking"); + + verify_mdj_file_marking_on_create(); + + verify_mdj_file_marking_on_open(); + + verify_mdj_file_marking_after_open(); + + verify_mdj_file_unmarking_on_file_close(); + + verify_mdj_file_unmarking_on_journaling_shutdown(); + + if ( pass2 ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass2 ) { + + failures2++; + HDfprintf(stdout, "%s: failure_mssg2 = \"%s\".\n", + fcn_name, failure_mssg2); + } + + return; + +} /* check_mdj_file_marking() */ + + +/*************************************************************************** + * Function: verify_mdj_file_marking_on_create + * + * Purpose: Verify that HDF5 file is marked as having journaling + * in progress when journaling is enabled at file creation + * time. + * + * Do this by forking a child process, creating a test file + * in the child with metadata journaling enabled, and then + * exiting from the child without closing the file. + * + * When the child exits, try to open the child's test file. + * Open should fail, as the file should be marked as journaling + * in progress. + * + * On either success or failure, clean up the test file and + * the associated journal file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/2/08 + * + **************************************************************************/ + +static void +verify_mdj_file_marking_on_create(void) +{ + const char * fcn_name = "verify_mdj_file_marking_on_create():"; + char * tag = "pre-fork:"; + char filename[512]; + char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t child = FALSE; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + int cp = 0; + int wait_status; + uint64_t trans_num; + pid_t child_id; + pid_t wait_result; + hid_t file_id = -1; + hid_t fapl_id = -1; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; + + /* setup the file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, + sizeof(filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (1).\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", fcn_name, tag, pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s filename = \"%s\".\n", fcn_name, tag,filename); + HDfflush(stdout); + } + + /* setup the journal file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, + sizeof(journal_filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (2).\n"; + } + else if ( strlen(journal_filename) >= + H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + pass2 = FALSE; + failure_mssg2 = "journal file name too long.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s journal filename = \"%s\".\n", + fcn_name, tag, journal_filename); + HDfflush(stdout); + } + + if ( pass2 ) { + + child_id = HDfork(); + + if ( child_id == -1 ) { + + pass2 = FALSE; + failure_mssg2 = "H5fork() failed."; + + } else if ( child_id == 0 ) { + + child = TRUE; + tag = "child:"; + + } else { + + child = FALSE; + tag = "parent:"; + } + } + + if ( pass2 ) { + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d fork() succeeded.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( child ) { + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d child starting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* clean out any existing journal file */ + HDremove(journal_filename); + setup_cache_for_journaling(filename, journal_filename, &file_id, + &file_ptr, &cache_ptr, FALSE); + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* run a dummy transaction to fource metadata journaling + * initialization. + */ + H5C2_begin_transaction(cache_ptr, &trans_num, "dummy"); + H5C2_end_transaction(file_ptr, cache_ptr, trans_num, "dummy"); + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( ( verbose ) && ( ! pass2 ) ) { + HDfprintf(stdout, "%s%s%d failure_mssg = \"%s\".\n", + fcn_name, tag, pass2, failure_mssg2); + HDfflush(stdout); + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d child exiting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + abort(); + + } else { + + /* wait for the child to exit */ + wait_result = HDwaitpid(child_id, &wait_status, 0); + + HDsleep(10); + + if ( wait_result != child_id ) { + + pass2 = FALSE; + failure_mssg2 = "unexpected waitpid() result."; + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: wait_result = %ld, wait_status = %d.\n", + fcn_name, tag, (int)pass2, + (long)wait_result, wait_status); + HDfflush(stdout); + } + } else { + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: cp = %d child exited as expected.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s:%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* attempt to open the file -- should fail as the child + * exited without closing the file properly, and thus + * the file should still be marked as having journaling + * in progress. + */ + + if ( pass2 ) { + + H5E_BEGIN_TRY { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + + } H5E_END_TRY; + + if ( file_id >= 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() succeeded."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* delete the HDF5 file and journal file */ +#if 1 + HDremove(filename); + HDremove(journal_filename); +#endif + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d parent done.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + } + } + } + + return; + +} /* verify_mdj_file_marking_on_create() */ + + +/*************************************************************************** + * Function: verify_mdj_file_marking_after_open + * + * Purpose: Verify that HDF5 file is marked as having journaling + * in progress when journaling is enabled on an open file. + * + * Do this by forking a child process and: + * + * 1) creating a test file in the child, + * + * 2) writing some data to it, + * + * 3) enable journaling on the open file via a call to + * H5Fset_mdc_config() + * + * 4) exiting from the child without closing the file. + * + * When the child exits, try to open the child's test file. + * Open should fail, as the file should be marked as journaling + * in progress. + * + * On either success or failure, clean up the test file and + * the associated journal file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/9/08 + * + **************************************************************************/ + +static void +verify_mdj_file_marking_after_open(void) +{ + const char * fcn_name = "verify_mdj_file_marking_after_open():"; + char * tag = "pre-fork:"; + char filename[512]; + char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t child = FALSE; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + herr_t result; + int cp = 0; + int wait_status; + pid_t child_id; + pid_t wait_result; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dataset_id = -1; + hid_t dataspace_id = -1; + hsize_t dims[2]; + H5AC2_cache_config_t mdj_config; + + /* setup the file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, + sizeof(filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (1).\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", fcn_name, tag, pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s filename = \"%s\".\n", fcn_name, tag,filename); + HDfflush(stdout); + } + + /* setup the journal file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, + sizeof(journal_filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (2).\n"; + } + else if ( strlen(journal_filename) >= + H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + pass2 = FALSE; + failure_mssg2 = "journal file name too long.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s journal filename = \"%s\".\n", + fcn_name, tag, journal_filename); + HDfflush(stdout); + } + + if ( pass2 ) { + + child_id = HDfork(); + + if ( child_id == -1 ) { + + pass2 = FALSE; + failure_mssg2 = "H5fork() failed."; + + } else if ( child_id == 0 ) { + + child = TRUE; + tag = "child:"; + + } else { + + child = FALSE; + tag = "parent:"; + } + } + + if ( pass2 ) { + + /* reset the check point */ + cp = 0; + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d fork() succeeded.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( child ) { + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d child starting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + /* open the file with a fapl indicating latest version of + * the file format. + */ + if ( pass2 ) { + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + fapl_id); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fcreate() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Screate_simple() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + /* Create the dataset. */ + dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Dcreate2() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* now enable journaling */ + if ( pass2 ) { + + mdj_config.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + + result = H5Fget_mdc_config(file_id, + (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fget_mdc_config() failed.\n"; + } + + /* set journaling config fields to taste */ + mdj_config.enable_journaling = TRUE; + + strcpy(mdj_config.journal_file_path, journal_filename); + + mdj_config.journal_recovered = FALSE; + mdj_config.jbrb_buf_size = (8 * 1024); + mdj_config.jbrb_num_bufs = 2; + mdj_config.jbrb_use_aio = FALSE; + mdj_config.jbrb_human_readable = TRUE; + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + result = H5Fset_mdc_config(file_id, + (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fset_mdc_config() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( ( verbose ) && ( ! pass2 ) ) { + HDfprintf(stdout, "%s%s%d failure_mssg = \"%s\".\n", + fcn_name, tag, pass2, failure_mssg2); + HDfflush(stdout); + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d child exiting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + abort(); + + } else { + + /* wait for the child to exit */ + wait_result = HDwaitpid(child_id, &wait_status, 0); + + HDsleep(10); + + if ( wait_result != child_id ) { + + pass2 = FALSE; + failure_mssg2 = "unexpected waitpid() result."; + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: wait_result = %ld, wait_status = %d.\n", + fcn_name, tag, (int)pass2, + (long)wait_result, wait_status); + HDfflush(stdout); + } + } else { + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: cp = %d child exited as expected.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s:%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* attempt to open the file -- should fail as the child + * exited without closing the file properly, and thus + * the file should still be marked as having journaling + * in progress. + */ + + if ( pass2 ) { + + H5E_BEGIN_TRY { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + + } H5E_END_TRY; + + if ( file_id >= 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() succeeded."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* delete the HDF5 file and journal file */ +#if 1 + HDremove(filename); + HDremove(journal_filename); +#endif + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d parent done.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + } + } + } + + return; + +} /* verify_mdj_file_marking_after_open() */ + + +/*************************************************************************** + * Function: verify_mdj_file_marking_on_open + * + * Purpose: Verify that HDF5 file is marked as having journaling + * in progress when journaling is enabled at file open + * time. + * + * Do this by forking a child process and: + * + * 1) creating a test file in the child, + * + * 2) writing some data to it, + * + * 3) closing the test file. + * + * 4) re-openting the test file with metadata journaling + * enabled, and then + * + * 5) exiting from the child without closing the file. + * + * When the child exits, try to open the child's test file. + * Open should fail, as the file should be marked as journaling + * in progress. + * + * On either success or failure, clean up the test file and + * the associated journal file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/2/08 + * + **************************************************************************/ + +static void +verify_mdj_file_marking_on_open(void) +{ + const char * fcn_name = "verify_mdj_file_marking_on_open():"; + char * tag = "pre-fork:"; + char filename[512]; + char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t child = FALSE; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + herr_t result; + int cp = 0; + int wait_status; + pid_t child_id; + pid_t wait_result; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dataset_id = -1; + hid_t dataspace_id = -1; + hsize_t dims[2]; + H5F_t * file_ptr = NULL; + H5AC2_cache_config_t mdj_config; + + /* setup the file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, + sizeof(filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (1).\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", fcn_name, tag, pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s filename = \"%s\".\n", fcn_name, tag,filename); + HDfflush(stdout); + } + + /* setup the journal file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, + sizeof(journal_filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (2).\n"; + } + else if ( strlen(journal_filename) >= + H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + pass2 = FALSE; + failure_mssg2 = "journal file name too long.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s journal filename = \"%s\".\n", + fcn_name, tag, journal_filename); + HDfflush(stdout); + } + + if ( pass2 ) { + + child_id = HDfork(); + + if ( child_id == -1 ) { + + pass2 = FALSE; + failure_mssg2 = "H5fork() failed."; + + } else if ( child_id == 0 ) { + + child = TRUE; + tag = "child:"; + + } else { + + child = FALSE; + tag = "parent:"; + } + } + + if ( pass2 ) { + + /* reset the check point */ + cp = 0; + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d fork() succeeded.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( child ) { + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d child starting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } +#if 0 /* JRM */ + /* Quincey: + * + * It looks like we may have a bug here -- + * + * In the original version of this test, I: + * + * 1) created a file using the default FAPL, + * + * 2) added a data set to the file + * + * 3) closed it, + * + * 4) tried to re-open it using a FAPL that set the + * latest format, and enabled journaling. + * + * I hit an assertion failure on step 4. + * + * I then modified the above to select the latest file + * format on file create, and the problem went away. + * + * Is this as it should be, or do we have a bug here? + * + * JRM -- 7/9/08 + */ + + if ( pass2 ) { + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fcreate() failed.\n"; + } + } +#else /* JRM */ + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + /* open the file with a fapl indicating latest version of + * the file format. + */ + if ( pass2 ) { + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + fapl_id); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fcreate() failed.\n"; + } + } +#endif /* JRM */ + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Screate_simple() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + /* Create the dataset. */ + dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Dcreate2() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + /* close the data set, the data space, and the file */ + if ( ( H5Dclose(dataset_id) < 0 ) || + ( H5Sclose(dataspace_id) < 0 ) || +#if 1 /* JRM */ + ( H5Pclose(fapl_id) < 0 ) || +#endif /* JRM */ + ( H5Fclose(file_id) < 0 ) ) { + + pass2 = FALSE; + failure_mssg2 = + "data set, data space, or file close failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + mdj_config.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + + result = H5Pget_mdc_config(fapl_id, + (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_mdc_config() failed.\n"; + } + + /* set journaling config fields to taste */ + mdj_config.enable_journaling = TRUE; + + strcpy(mdj_config.journal_file_path, journal_filename); + + mdj_config.journal_recovered = FALSE; + mdj_config.jbrb_buf_size = (8 * 1024); + mdj_config.jbrb_num_bufs = 2; + mdj_config.jbrb_use_aio = FALSE; + mdj_config.jbrb_human_readable = TRUE; + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + result = H5Pset_mdc_config(fapl_id, + (H5AC_cache_config_t *)&mdj_config); + + if ( result < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_mdc_config() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: *cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* open the file using fapl_id */ + if ( pass2 ) { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed.\n"; + + } else { + + file_ptr = H5I_object_verify(file_id, H5I_FILE); + + if ( file_ptr == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "Can't get file_ptr."; + + if ( verbose ) { + HDfprintf(stdout, "%s: Can't get file_ptr.\n", + fcn_name); + } + } + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( ( verbose ) && ( ! pass2 ) ) { + HDfprintf(stdout, "%s%s%d failure_mssg = \"%s\".\n", + fcn_name, tag, pass2, failure_mssg2); + HDfflush(stdout); + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d child exiting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + abort(); + + } else { + + /* wait for the child to exit */ + wait_result = HDwaitpid(child_id, &wait_status, 0); + + HDsleep(10); + + if ( wait_result != child_id ) { + + pass2 = FALSE; + failure_mssg2 = "unexpected waitpid() result."; + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: wait_result = %ld, wait_status = %d.\n", + fcn_name, tag, (int)pass2, + (long)wait_result, wait_status); + HDfflush(stdout); + } + } else { + + if ( show_progress ) { + + HDfprintf(stdout, + "%s%s:%d: cp = %d child exited as expected.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s:%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) { + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* attempt to open the file -- should fail as the child + * exited without closing the file properly, and thus + * the file should still be marked as having journaling + * in progress. + */ + + if ( pass2 ) { + + H5E_BEGIN_TRY { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + + } H5E_END_TRY; + + if ( file_id >= 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() succeeded."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + /* delete the HDF5 file and journal file */ +#if 1 + HDremove(filename); + HDremove(journal_filename); +#endif + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d parent done.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + } + } + } + + return; + +} /* verify_mdj_file_marking_on_open() */ + + +/*************************************************************************** + * Function: verify_mdj_file_unmarking_on_file_close + * + * Purpose: Verify that HDF5 file on which journaling is enabled is + * marked as having not haveing journaling in progress when + * the file is closed. + * + * Do this as follows: + * + * 1) create a test file with metadata journaling + * enabled, + * + * 2) perform some operation(s) that dirty metadata + * and result in journal activity. + * + * 3) close the file. + * + * 4) attempt to re-open the file -- should succeed. + * + * On either success or failure, clean up the test file and + * the associated journal file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/10/08 + * + **************************************************************************/ + +static void +verify_mdj_file_unmarking_on_file_close(void) +{ + const char * fcn_name = "verify_mdj_file_unmarking_on_file_close():"; + char filename[512]; + char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + int cp = 0; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dataset_id = -1; + hid_t dataspace_id = -1; + hsize_t dims[2]; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d cp = %d -- entering.\n", fcn_name, pass2, cp++); + HDfflush(stdout); + } + + /* setup the file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, + sizeof(filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (1).\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d cp = %d.\n", fcn_name, pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s filename = \"%s\".\n", fcn_name, filename); + HDfflush(stdout); + } + + /* setup the journal file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, + sizeof(journal_filename)) == NULL ) { + + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (2).\n"; + } + else if ( strlen(journal_filename) >= + H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + pass2 = FALSE; + failure_mssg2 = "journal file name too long.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s journal filename = \"%s\".\n", + fcn_name, journal_filename); + HDfflush(stdout); + } + + if ( pass2 ) { + + /* clean out any existing journal file */ + setup_cache_for_journaling(filename, journal_filename, &file_id, + &file_ptr, &cache_ptr, FALSE); + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* create a data set so as to force a bit of journaling */ + if ( pass2 ) { + + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Screate_simple() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( pass2 ) { + + /* Create the dataset. */ + dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + + if ( dataspace_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Dcreate2() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* now close the file... */ + + if ( pass2 ) { + + if ( ( H5Dclose(dataset_id) < 0 ) || + ( H5Sclose(dataspace_id) < 0 ) || + ( H5Fclose(file_id) < 0 ) ) { + + pass2 = FALSE; + failure_mssg2 = "dataset, dataspace, or file close failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* ... and attempt to re-open it. Should succeed */ + + /* create a file access propertly list. */ + if ( pass2 ) { + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + + if ( fapl_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { + + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: *cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* attempt to open the file -- should succeed as the close should + * shutdown journaling. + */ + + if ( pass2 ) { + + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + + if ( file_id < 0 ) { + + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* close the file and fapl */ + + if ( pass2 ) { + + if ( ( H5Pclose(fapl_id) < 0 ) || + ( H5Fclose(file_id) < 0 ) ) { + + pass2 = FALSE; + failure_mssg2 = "fapl or file close failed."; + } + } + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + /* delete the HDF5 file and journal file */ +#if 1 + HDremove(filename); + HDremove(journal_filename); +#endif + + if ( show_progress ) { + + HDfprintf(stdout, "%s%d: cp = %d.\n", fcn_name, (int)pass2, cp++); + HDfflush(stdout); + } + + return; + +} /* verify_mdj_file_unmarking_on_file_close() */ + + +/*************************************************************************** + * Function: verify_mdj_file_unmarking_on_journaling_shutdown + * + * Purpose: Verify that HDF5 file on which journaling is enabled is + * marked as having not haveing journaling in progress when + * journaling is disabled via the H5Fset_mdc_config() API + * call. + * + * Do this by: + * + * 1) forking a child process, + * + * 2) creating a test file in the child with metadata + * journaling enabled, + * + * 3) performing some operation(s) that dirty metadata + * and result in journal activity. + * + * 4) using the H5Fset_mdc_config() to disable journaling. + * + * 5) exiting from the child without closing the file. + * + * When the child exits, try to open the child's test file. + * Open should succeed, as the file should be marked as + * journaling not in progress. + * + * Note that the file will be synced out as part of the + * journaling shutdown process, so the metadata should be + * in a consistant state. Strictly speaking, this is not + * necessary for this test, for as long as the the file is + * not marked as having journaling in progress, we should + * pass. However, testing this without using the HDF5 + * library to open the file would be inconvenient -- hence + * we make use of the sync on journal shutdown to make the + * test easier to implement. + * + * On either success or failure, clean up the test file and + * the associated journal file. + * + * Return: void + * + * Programmer: John Mainzer + * 7/9/08 + * + **************************************************************************/ + +static void +verify_mdj_file_unmarking_on_journaling_shutdown(void) +{ + const char * fcn_name = + "verify_mdj_file_unmarking_on_journaling_shutdown():"; + char * tag = "pre-fork:"; + char filename[512]; + char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; + hbool_t child = FALSE; + hbool_t show_progress = FALSE; + hbool_t verbose = FALSE; + herr_t result; + int cp = 0; + int wait_status; + pid_t child_id; + pid_t wait_result; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dataset_id = -1; + hid_t dataspace_id = -1; + hsize_t dims[2]; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; + H5AC2_cache_config_t mdj_config; + + /* setup the file name */ + if ( pass2 ) { + + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, + sizeof(filename)) == NULL ) { + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (1).\n"; } } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( show_progress ) { - /*****************************************************************/ - /* 6) Reset the journaling information to indicate that the file */ - /* is not being journaled, and close the file again. */ - /*****************************************************************/ + HDfprintf(stdout, "%s%s%d cp = %d.\n", fcn_name, tag, pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s filename = \"%s\".\n", fcn_name, tag,filename); + HDfflush(stdout); + } + /* setup the journal file name */ if ( pass2 ) { - file_ptr->shared->mdc_jrnl_enabled = FALSE; + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, + sizeof(journal_filename)) == NULL ) { - if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + pass2 = FALSE; + failure_mssg2 = "h5_fixname() failed (2).\n"; + } + else if ( strlen(journal_filename) >= + H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; - failure_mssg2 = "H5F_super_write_mdj_msg failed (2)."; - } + failure_mssg2 = "journal file name too long.\n"; + } } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( show_progress ) { + + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + + if ( verbose ) { + HDfprintf(stdout, "%s%s journal filename = \"%s\".\n", + fcn_name, tag, journal_filename); + HDfflush(stdout); + } - /* close the file again. */ if ( pass2 ) { - if ( H5Fclose(file_id) ) { + child_id = HDfork(); + + if ( child_id == -1 ) { pass2 = FALSE; - failure_mssg2 = "file close failed (2)."; - } - } + failure_mssg2 = "H5fork() failed."; - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); - + } else if ( child_id == 0 ) { - /******************************************************************/ - /* 7) Open the file a fourth time, and verify that the superblock */ - /* extension indicates that the file is not being journaled. */ - /*******************************************************************/ + child = TRUE; + tag = "child:"; - /* open the file r/w using the default FAPL */ - if ( pass2 ) { + } else { - file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + child = FALSE; + tag = "parent:"; + } + } - if ( file_id < 0 ) { + if ( pass2 ) { - pass2 = FALSE; - failure_mssg2 = "H5Fopen() failed (3).\n"; - } - } + if ( show_progress ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + HDfprintf(stdout, "%s%s%d: cp = %d fork() succeeded.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - /* get a pointer to the files internal data structure and then - * verify that journaling is disabled. - */ - if ( pass2 ) { + if ( child ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + if ( show_progress ) { - if ( file_ptr == NULL ) { + HDfprintf(stdout, "%s%s%d: cp = %d child starting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - pass2 = FALSE; - failure_mssg2 = "Can't get file_ptr (4).\n"; + /* clean out any existing journal file */ + setup_cache_for_journaling(filename, journal_filename, &file_id, + &file_ptr, &cache_ptr, FALSE); - } else if ( file_ptr->shared->mdc_jrnl_enabled ) { - - pass2 = FALSE; - failure_mssg2 = "Journaling enabled on file open (2).\n"; - } - } + if ( show_progress ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + /* create a data set so as to force a bit of journaling */ + if ( pass2 ) { - /*******************************************************************/ - /* 8) Write data to the superblock, marking the file as being */ - /* journaled. Now write different data to the superbloc, that */ - /* still marks the file as being journaled. Close the file. */ - /*******************************************************************/ + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); - if ( pass2 ) { + if ( dataspace_id < 0 ) { - file_ptr->shared->mdc_jrnl_enabled = TRUE; - file_ptr->shared->mdc_jrnl_block_loc = mdc_jrnl_block_loc * 2; - file_ptr->shared->mdc_jrnl_block_len = mdc_jrnl_block_len * 2; + pass2 = FALSE; + failure_mssg2 = "H5Screate_simple() failed."; + } + } - if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + if ( show_progress ) { - pass2 = FALSE; - failure_mssg2 = "H5F_super_write_mdj_msg failed (3)."; - } - } + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( pass2 ) { - if ( pass2 ) { + /* Create the dataset. */ + dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - file_ptr->shared->mdc_jrnl_enabled = TRUE; - file_ptr->shared->mdc_jrnl_block_loc = mdc_jrnl_block_loc / 2; - file_ptr->shared->mdc_jrnl_block_len = mdc_jrnl_block_len / 2; + if ( dataspace_id < 0 ) { - if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + pass2 = FALSE; + failure_mssg2 = "H5Dcreate2() failed."; + } + } - pass2 = FALSE; - failure_mssg2 = "H5F_super_write_mdj_msg failed (4)."; - } - } + if ( show_progress ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - /* close the file again. */ - if ( pass2 ) { + /* now dis-able journaling */ + if ( pass2 ) { - if ( H5Fclose(file_id) ) { + mdj_config.version = H5C2__CURR_AUTO_SIZE_CTL_VER; - pass2 = FALSE; - failure_mssg2 = "file close failed (3)."; - } - } + result = H5Fget_mdc_config(file_id, + (H5AC_cache_config_t *)&mdj_config); - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( result < 0 ) { - - /***************************************************************/ - /* 9) Re-open the file, and verify that the second write in 8 */ - /* above took. */ - /***************************************************************/ + pass2 = FALSE; + failure_mssg2 = "H5Fget_mdc_config() failed.\n"; + } - /* open the file r/w using the default FAPL */ - if ( pass2 ) { + mdj_config.enable_journaling = FALSE; - file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + /* until we disable the old cache, we need to set + * these fields too, as until then, H5Fget_mdc_config() + * will return data from the old cache -- and fail to + * initialize the journaling fields. + */ - if ( file_id < 0 ) { + strcpy(mdj_config.journal_file_path, journal_filename); - pass2 = FALSE; - failure_mssg2 = "H5Fopen() failed (4).\n"; - } - } + mdj_config.journal_recovered = FALSE; + mdj_config.jbrb_buf_size = (8 * 1024); + mdj_config.jbrb_num_bufs = 2; + mdj_config.jbrb_use_aio = FALSE; + mdj_config.jbrb_human_readable = TRUE; + } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( show_progress ) { - /* get a pointer to the files internal data structure and then - * verify that journaling is enabled. - */ - if ( pass2 ) { + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + if ( pass2 ) { - if ( file_ptr == NULL ) { + result = H5Fset_mdc_config(file_id, + (H5AC_cache_config_t *)&mdj_config); - pass2 = FALSE; - failure_mssg2 = "Can't get file_ptr (5).\n"; + if ( result < 0 ) { - } else if ( ! file_ptr->shared->mdc_jrnl_enabled ) { - - pass2 = FALSE; - failure_mssg2 = "Journaling disabled on file open (2).\n"; + pass2 = FALSE; + failure_mssg2 = "H5Fset_mdc_config() failed.\n"; + } + } - } else if ( file_ptr->shared->mdc_jrnl_block_loc != - mdc_jrnl_block_loc / 2 ) { - - pass2 = FALSE; - HDfprintf(stdout, "%s: block_loc = %ld (%ld).\n", - fcn_name, (long)(file_ptr->shared->mdc_jrnl_block_loc), - (long)(mdc_jrnl_block_loc)); - failure_mssg2 = "unexpected mdc_jrnl_block_loc(2).\n"; + if ( show_progress ) { - } else if ( file_ptr->shared->mdc_jrnl_block_len != - (hsize_t)mdc_jrnl_block_len / 2 ) { - - pass2 = FALSE; - failure_mssg2 = "unexpected mdc_jrnl_block_len (2).\n"; + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - } - } + if ( ( verbose ) && ( ! pass2 ) ) { + HDfprintf(stdout, "%s%s%d failure_mssg = \"%s\".\n", + fcn_name, tag, pass2, failure_mssg2); + HDfflush(stdout); + } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( show_progress ) { + HDfprintf(stdout, "%s%s%d cp = %d child exiting.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - /******************************************************************/ - /* 10) Write data to the superblock indicating that journaling is */ - /* not in progress. Close the file. */ - /******************************************************************/ + abort(); - if ( pass2 ) { + } else { - file_ptr->shared->mdc_jrnl_enabled = FALSE; + /* wait for the child to exit */ + wait_result = HDwaitpid(child_id, &wait_status, 0); - if ( H5F_super_write_mdj_msg(file_ptr, -1) < 0 ) { + HDsleep(10); - pass2 = FALSE; - failure_mssg2 = "H5F_super_write_mdj_msg failed (5)."; - } - } + if ( wait_result != child_id ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + pass2 = FALSE; + failure_mssg2 = "unexpected waitpid() result."; - /* close the file again. */ - if ( pass2 ) { + if ( show_progress ) { - if ( H5Fclose(file_id) ) { + HDfprintf(stdout, + "%s%s:%d: wait_result = %ld, wait_status = %d.\n", + fcn_name, tag, (int)pass2, + (long)wait_result, wait_status); + HDfflush(stdout); + } + } else { - pass2 = FALSE; - failure_mssg2 = "file close failed (4)."; - } - } + if ( show_progress ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + HDfprintf(stdout, + "%s%s:%d: cp = %d child exited as expected.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + /* create a file access propertly list. */ + if ( pass2 ) { - /*************************************************************/ - /* 11) Reopen the file, and verify that journaling is not in */ - /* progress. */ - /*************************************************************/ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); - /* open the file r/w using the default FAPL */ - if ( pass2 ) { + if ( fapl_id < 0 ) { - file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + pass2 = FALSE; + failure_mssg2 = "H5Pcreate() failed.\n"; + } + } - if ( file_id < 0 ) { + if ( show_progress ) { + HDfprintf(stdout, "%s%s:%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - pass2 = FALSE; - failure_mssg2 = "H5Fopen() failed (5).\n"; - } - } + /* call H5Pset_libver_bounds() on the fapl_id */ + if ( pass2 ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + H5F_LIBVER_LATEST) < 0 ) { - /* get a pointer to the files internal data structure and then - * verify that journaling is disabled. - */ - if ( pass2 ) { + pass2 = FALSE; + failure_mssg2 = "H5Pset_libver_bounds() failed.\n"; + } + } - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + if ( show_progress ) { + HDfprintf(stdout, "%s%s%d cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - if ( file_ptr == NULL ) { + /* attempt to open the file -- should succeed as the child + * disabled journaling just before exiting, which should have + * had the dual effect of marking the file as not having + * journaling in progress, and syncing the file out to disk. + */ - pass2 = FALSE; - failure_mssg2 = "Can't get file_ptr (6).\n"; + file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - } else if ( file_ptr->shared->mdc_jrnl_enabled ) { - - pass2 = FALSE; - failure_mssg2 = "Journaling enabled on file open (3).\n"; - } - } + if ( file_id < 0 ) { - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + pass2 = FALSE; + failure_mssg2 = "H5Fopen() failed."; + } + if ( show_progress ) { - /*************************************/ - /* 12) Close the file and delete it. */ - /*************************************/ - - if ( pass2 ) { + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - if ( H5Fclose(file_id) ) { + /* close the file and fapl */ - pass2 = FALSE; - failure_mssg2 = "file close failed (5)."; + if ( pass2 ) { - } else if ( HDremove(filename) < 0 ) { + if ( ( H5Pclose(fapl_id) < 0 ) || + ( H5Fclose(file_id) < 0 ) ) { - pass2 = FALSE; - failure_mssg2 = "HDremove() failed.\n"; - } - } + pass2 = FALSE; + failure_mssg2 = "fapl or file close failed."; + } + } - if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); + if ( show_progress ) { - if ( pass2 ) { PASSED(); } else { H5_FAILED(); } + HDfprintf(stdout, "%s%s%d: cp = %d.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } - if ( ! pass2 ) { + /* delete the HDF5 file and journal file */ +#if 1 + HDremove(filename); + HDremove(journal_filename); +#endif + if ( show_progress ) { - failures2++; - HDfprintf(stdout, "%s: failure_mssg2 = \"%s\".\n", - fcn_name, failure_mssg2); - } + HDfprintf(stdout, "%s%s%d cp = %d parent done.\n", + fcn_name, tag, (int)pass2, cp++); + HDfflush(stdout); + } + } + } + } -} /* check_superblock_extensions() */ + return; +} /* verify_mdj_file_unmarking_on_journaling_shutdown() */ /*************************************************************************** @@ -7210,9 +9905,15 @@ main(void) check_legal_calls(); check_message_format(); check_transaction_tracking(); +#endif +#if 1 check_superblock_extensions(); - +#endif +#if 1 check_mdj_config_block_IO(); +#endif +#if 1 + check_mdj_file_marking(); #endif return(failures2); diff --git a/test/cache_api.c b/test/cache_api.c index fcc4664..c1530eb 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -232,7 +232,14 @@ check_fapl_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t scratch; H5C_auto_size_ctl_t default_auto_size_ctl; @@ -801,7 +808,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t mod_config_2 = { @@ -834,7 +848,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t mod_config_3 = { @@ -867,7 +888,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ FALSE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t mod_config_4 = { @@ -901,7 +929,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; TESTING("MDC/FILE related API calls"); @@ -1433,7 +1468,14 @@ mdc_api_call_smoke_check(int express_test) /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t mod_config_2 = { @@ -1466,7 +1508,14 @@ mdc_api_call_smoke_check(int express_test) /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; H5AC_cache_config_t mod_config_3 = { @@ -1499,7 +1548,14 @@ mdc_api_call_smoke_check(int express_test) /* int epochs_before_eviction = */ 2, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }; TESTING("MDC API smoke check"); @@ -2180,7 +2236,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 1 -- bad rpt_fcn_enabled */ @@ -2213,7 +2276,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 2 -- bad open_trace_file */ @@ -2246,7 +2316,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 3 -- bad close_trace_file */ @@ -2279,7 +2356,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 4 -- open_trace_file == TRUE and empty trace_file_name */ @@ -2312,7 +2396,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 5 -- bad set_initial_size */ @@ -2345,7 +2436,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 6 -- max_size too big */ @@ -2378,7 +2476,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 7 -- min_size too small */ @@ -2411,7 +2516,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 8 -- min_size > max_size */ @@ -2444,7 +2556,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 9 -- initial size out of range (too big) */ @@ -2477,7 +2596,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 10 -- initial_size out of range (too small) */ @@ -2510,7 +2636,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 11 -- min_clean_fraction too big */ @@ -2543,7 +2676,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 12 -- min_clean_fraction too small */ @@ -2576,7 +2716,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 13 -- epoch_length too small */ @@ -2609,7 +2756,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 14 -- epoch_length too big */ @@ -2642,7 +2796,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 15 -- invalid incr_mode */ @@ -2675,7 +2836,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 16 -- lower_hr_threshold too small */ @@ -2708,7 +2876,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 17 -- lower_hr_threshold too big */ @@ -2741,7 +2916,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 18 -- increment too small */ @@ -2774,7 +2956,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 19 -- bad apply_max_increment */ @@ -2807,7 +2996,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 20 -- invalid flash_incr_mode */ @@ -2840,7 +3036,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 21 -- flash_multiple too small */ @@ -2873,7 +3076,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 22 -- flash_multiple too big */ @@ -2906,7 +3116,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 23 -- flash_threshold too small */ @@ -2939,7 +3156,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 24 -- flash_threshold too big */ @@ -2972,7 +3196,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 25 -- bad decr_mode */ @@ -3005,7 +3236,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 26 -- upper_hr_threshold too big */ @@ -3038,7 +3276,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 27 -- decrement too small */ @@ -3071,7 +3316,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 28 -- decrement too big */ @@ -3104,7 +3356,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 29 -- epochs_before_eviction too small */ @@ -3137,7 +3396,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 0, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 30 -- epochs_before_eviction too big */ @@ -3170,7 +3436,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ H5C__MAX_EPOCH_MARKERS + 1, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 31 -- invalid apply_empty_reserve */ @@ -3203,7 +3476,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ 2, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 32 -- empty_reserve too small */ @@ -3236,7 +3516,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ -0.0000000001, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 33 -- empty_reserve too big */ @@ -3269,7 +3556,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 1.00000000001, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 34 -- upper_hr_threshold too small */ @@ -3302,7 +3596,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 35 -- upper_hr_threshold too big */ @@ -3335,7 +3636,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 36 -- upper_hr_threshold <= lower_hr_threshold */ @@ -3368,7 +3676,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 37 -- dirty_bytes_threshold too small */ @@ -3401,7 +3716,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1 + /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1, + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 38 -- dirty_bytes_threshold too big */ @@ -3434,7 +3756,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1 + /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1, + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 39 -- attempt to disable evictions when auto incr enabled */ @@ -3467,7 +3796,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE }, { /* 40 -- attempt to disable evictions when auto decr enabled */ @@ -3500,7 +3836,14 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (8 * 1024), + /* int jbrb_num_bufs = */ 2, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ TRUE } }; diff --git a/test/testfiles/cache2_journal_sc00_000.jnl.gz b/test/testfiles/cache2_journal_sc00_000.jnl.gz new file mode 100755 index 0000000..5f4311e Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_000.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_001.jnl.gz b/test/testfiles/cache2_journal_sc00_001.jnl.gz new file mode 100755 index 0000000..7f711dc Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_001.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_002.jnl.gz b/test/testfiles/cache2_journal_sc00_002.jnl.gz new file mode 100755 index 0000000..62d6929 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_002.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_003.jnl.gz b/test/testfiles/cache2_journal_sc00_003.jnl.gz new file mode 100755 index 0000000..cd60e35 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_003.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_004.jnl.gz b/test/testfiles/cache2_journal_sc00_004.jnl.gz new file mode 100755 index 0000000..ffacdc0 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_004.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_005.jnl.gz b/test/testfiles/cache2_journal_sc00_005.jnl.gz new file mode 100755 index 0000000..e777a18 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_005.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_006.jnl.gz b/test/testfiles/cache2_journal_sc00_006.jnl.gz new file mode 100755 index 0000000..bfab587 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_006.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_007.jnl.gz b/test/testfiles/cache2_journal_sc00_007.jnl.gz new file mode 100755 index 0000000..d2d8e5f Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_007.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_008.jnl.gz b/test/testfiles/cache2_journal_sc00_008.jnl.gz new file mode 100755 index 0000000..8ea7164 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_008.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_009.jnl.gz b/test/testfiles/cache2_journal_sc00_009.jnl.gz new file mode 100755 index 0000000..f345dcb Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_009.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_010.jnl.gz b/test/testfiles/cache2_journal_sc00_010.jnl.gz new file mode 100755 index 0000000..d761163 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_010.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_011.jnl.gz b/test/testfiles/cache2_journal_sc00_011.jnl.gz new file mode 100755 index 0000000..176fc0c Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_011.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_012.jnl.gz b/test/testfiles/cache2_journal_sc00_012.jnl.gz new file mode 100755 index 0000000..b8cf81a Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_012.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_013.jnl.gz b/test/testfiles/cache2_journal_sc00_013.jnl.gz new file mode 100755 index 0000000..7fb6958 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_013.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_014.jnl.gz b/test/testfiles/cache2_journal_sc00_014.jnl.gz new file mode 100755 index 0000000..6a6eb10 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_014.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_015.jnl.gz b/test/testfiles/cache2_journal_sc00_015.jnl.gz new file mode 100755 index 0000000..2af775b Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_015.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_016.jnl.gz b/test/testfiles/cache2_journal_sc00_016.jnl.gz new file mode 100755 index 0000000..2de5c38 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_016.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_017.jnl.gz b/test/testfiles/cache2_journal_sc00_017.jnl.gz new file mode 100755 index 0000000..f60aed8 Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_017.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc00_018.jnl.gz b/test/testfiles/cache2_journal_sc00_018.jnl.gz new file mode 100755 index 0000000..c6f10ee Binary files /dev/null and b/test/testfiles/cache2_journal_sc00_018.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc01_000.jnl.gz b/test/testfiles/cache2_journal_sc01_000.jnl.gz new file mode 100755 index 0000000..ce4c67e Binary files /dev/null and b/test/testfiles/cache2_journal_sc01_000.jnl.gz differ diff --git a/test/testfiles/cache2_journal_sc01_001.jnl.gz b/test/testfiles/cache2_journal_sc01_001.jnl.gz new file mode 100755 index 0000000..8fc2005 Binary files /dev/null and b/test/testfiles/cache2_journal_sc01_001.jnl.gz differ -- cgit v0.12