summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-07-27 20:41:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-07-27 20:41:57 (GMT)
commit8df0288b6d08d163b6c7ab010ba93b72ec346462 (patch)
tree8e82bfa40ba9b655afb19649ca8fbe30f2fc7bf1
parentf09aff4ee251529ed30facfc33073465f38f703d (diff)
downloadhdf5-8df0288b6d08d163b6c7ab010ba93b72ec346462.zip
hdf5-8df0288b6d08d163b6c7ab010ba93b72ec346462.tar.gz
hdf5-8df0288b6d08d163b6c7ab010ba93b72ec346462.tar.bz2
[svn-r8958] Purpose:
Bug fix Description: Always write fill values to chunks when initializing entire B-tree and any filters are defined. Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel Solaris 2.7 (arabica) Too minor to require h5committest
-rw-r--r--release_docs/RELEASE.txt4
-rw-r--r--src/H5Distore.c4
-rw-r--r--test/tmisc.c79
3 files changed, 85 insertions, 2 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 6ff1171..c843dde 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -168,6 +168,10 @@ Bug Fixes since HDF5-1.6.0 release
Library
-------
+ - Fixed bug where chunked datasets which have filters defined,
+ allocation time set to "late" and whose chunks don't align with
+ the dataspace bounds could have incorrect data stored when
+ overwriting the entire dataset on the first write. QAK - 2004/07/27
- Fixed bug in H5Sset_extent_simple where setting maximum size to
non-zero, then to zero would cause an error. JML - 2004/07/20
- Allow NULL pointer for buffer parameter to H5Dread & H5Dwrite
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 596350b..4b7bb0a 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -2413,10 +2413,12 @@ H5D_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5D_t *dset,
/* If we are filling the dataset on allocation or "if set" and
* the fill value _is_ set, _and_ we are not overwriting the new blocks,
+ * or if there are any pipeline filters defined,
* set the "should fill" flag
*/
- if(!full_overwrite && (fill_time==H5D_FILL_TIME_ALLOC ||
+ if((!full_overwrite && (fill_time==H5D_FILL_TIME_ALLOC ||
(fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)))
+ || pline.nused>0)
should_fill=1;
/* Check if fill values should be written to blocks */
diff --git a/test/tmisc.c b/test/tmisc.c
index b8e850c..b949c5b 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -234,6 +234,15 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC20_SPACE2_DIM0 8
#define MISC20_SPACE2_DIM1 4
+/* Definitions for misc. test #21 */
+#define MISC21_FILE "tmisc21.h5"
+#define MISC21_DSET_NAME "Dataset"
+#define MISC21_SPACE_RANK 2
+#define MISC21_SPACE_DIM0 7639
+#define MISC21_SPACE_DIM1 6308
+#define MISC21_CHUNK_DIM0 1024
+#define MISC21_CHUNK_DIM1 1024
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -3478,6 +3487,71 @@ test_misc20(void)
/****************************************************************
**
+** test_misc21(): Test that late allocation time is treated the same
+** as incremental allocation time, for chunked datasets
+** when overwriting entire dataset where the chunks
+** don't exactly match the dataspace.
+**
+****************************************************************/
+static void
+test_misc21(void)
+{
+ hid_t fid, sid, dcpl, dsid;
+ char *buf;
+ hsize_t dims[2]={MISC21_SPACE_DIM0,MISC21_SPACE_DIM1},
+ chunk_size[2]={MISC21_CHUNK_DIM0,MISC21_CHUNK_DIM1};
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing late allocation time w/chunks & filters\n"));
+
+ /* Allocate space for the buffer */
+ buf = (char *)HDcalloc(MISC21_SPACE_DIM0*MISC21_SPACE_DIM1,1);
+ CHECK(buf, NULL, "HDcalloc");
+
+ /* Create the file */
+ fid = H5Fcreate (MISC21_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create the DCPL */
+ dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+
+ /* Set custom DCPL properties */
+ ret = H5Pset_chunk (dcpl, MISC21_SPACE_RANK, chunk_size);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+ ret = H5Pset_deflate (dcpl, 6);
+ CHECK(ret, FAIL, "H5Pset_deflate");
+ ret = H5Pset_alloc_time (dcpl, H5D_ALLOC_TIME_LATE);
+ CHECK(ret, FAIL, "H5Pset_alloc_time");
+
+ /* Create the dataspace for the dataset */
+ sid = H5Screate_simple (MISC21_SPACE_RANK, dims, NULL);
+ CHECK(ret, FAIL, "H5Screate_simple");
+
+ /* Create the dataset */
+ dsid = H5Dcreate (fid, MISC21_DSET_NAME, H5T_NATIVE_UINT8, sid, dcpl);
+ CHECK(dsid, FAIL, "H5Dwrite");
+
+ /* Write out the whole dataset */
+ ret = H5Dwrite (dsid, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close everything */
+ ret = H5Dclose (dsid);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose (sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Pclose (dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fclose (fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ HDfree(buf);
+} /* end test_misc21() */
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -3486,7 +3560,7 @@ test_misc(void)
{
/* Output message about test being performed */
MESSAGE(5, ("Testing Miscellaneous Routines\n"));
-
+
test_misc1(); /* Test unlinking a dataset & immediately re-using name */
test_misc2(); /* Test storing a VL-derived datatype in two different files */
test_misc3(); /* Test reading from chunked dataset with non-zero fill value */
@@ -3507,6 +3581,9 @@ test_misc(void)
test_misc18(); /* Test new object header information in H5G_stat_t struct */
test_misc19(); /* Test incrementing & decrementing ref count on IDs */
test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */
+#ifdef H5_HAVE_FILTER_DEFLATE
+ test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
+#endif /* H5_HAVE_FILTER_DEFLATE */
} /* test_misc() */