summaryrefslogtreecommitdiffstats
path: root/test/swmr_writer.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2012-05-30 22:01:00 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2012-05-30 22:01:00 (GMT)
commit9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6 (patch)
tree006f9f714a95e349ae313fd76afdae9a45910c19 /test/swmr_writer.c
parent1f6cb6f84a0fdeec79938624ef874d4147d52d87 (diff)
downloadhdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.zip
hdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.tar.gz
hdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.tar.bz2
[svn-r22422] Purpose: Add support for SWMR with v2 b-trees
Description: Adds SWMR support to the v2 b-trees when used as a chunk index. Because each node keeps track of the total number of records reachable through each of its children, nodes must be shadowed every time a descendent record is inserted or removed. This implementation prevents this from happening, however, if the node has already been shadowed since the last time the v2 b-tree header was flushed. Also modified SWMR test to include v2 b-trees. Tested: jam, koala, ostrich (h5committest), durandal Note: There is a preexisting failure in the ph5diff (-v) test
Diffstat (limited to 'test/swmr_writer.c')
-rw-r--r--test/swmr_writer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/swmr_writer.c b/test/swmr_writer.c
index c584f60..d465d70 100644
--- a/test/swmr_writer.c
+++ b/test/swmr_writer.c
@@ -59,7 +59,8 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
{
hid_t tid; /* Datatype ID for records */
hid_t mem_sid; /* Memory dataspace ID */
- hsize_t start, count = 1; /* Hyperslab selection values */
+ hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */
+ hsize_t dim[2] = {1, 0}; /* Dataspace dimensions */
symbol_t record; /* The record to add to the dataset */
H5AC_cache_config_t mdc_config_orig; /* Original metadata cache configuration */
H5AC_cache_config_t mdc_config_cork; /* Corked metadata cache configuration */
@@ -102,7 +103,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
record.rec_id = symbol->nrecords;
/* Get the coordinate to write */
- start = symbol->nrecords;
+ start[1] = symbol->nrecords;
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
@@ -111,7 +112,8 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
/* Extend the dataset's dataspace to hold the new record */
symbol->nrecords++;
- if(H5Dset_extent(symbol->dsid, &symbol->nrecords) < 0)
+ dim[1] = symbol->nrecords;
+ if(H5Dset_extent(symbol->dsid, dim) < 0)
return(-1);
/* Get the dataset's dataspace */
@@ -119,7 +121,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f
return(-1);
/* Choose the last record in the dataset */
- if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, &start, NULL, &count, NULL) < 0)
+ if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
return(-1);
/* Write record to the dataset */
@@ -242,7 +244,7 @@ int main(int argc, const char *argv[])
/* Create randomized set of numbers */
curr_time = time(NULL);
- srandom((unsigned)curr_time);
+ srandom(15);//srandom((unsigned)curr_time);
/* Emit informational message */
if(verbose)