summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2010-02-16 17:18:38 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2010-02-16 17:18:38 (GMT)
commit7c82bbf030c2fbd226addc94db35fda253d83ca3 (patch)
tree761e19f98d2b21a11e660272bb07127d2b89baaa /src/H5Gnode.c
parent5156b8a043f744799e0dc77a7dfa0690502a3397 (diff)
downloadhdf5-7c82bbf030c2fbd226addc94db35fda253d83ca3.zip
hdf5-7c82bbf030c2fbd226addc94db35fda253d83ca3.tar.gz
hdf5-7c82bbf030c2fbd226addc94db35fda253d83ca3.tar.bz2
[svn-r18262] Purpose: Fix bug in b-tree code
Description: In certain cases, removal of an object in a v1 b-tree would cause the leftmost key in the right neighbor to be overwritten. While this did not pose a problem for group b-trees, with chunked datasets it would overwrite the offset value of the neighbor's leftmost child, causing corruption. Reworked the code to differentiate between b-trees whose children are fundamentally associated with their left key and those who are associated with their right key. Tested: jam, linew, amani (h5committest)
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 18125df..4bd8a29 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -95,6 +95,7 @@ H5B_class_t H5B_SNODE[1] = {{
H5G_node_cmp3, /*cmp3 */
H5G_node_found, /*found */
H5G_node_insert, /*insert */
+ H5B_RIGHT, /*critical key */
TRUE, /*follow min branch? */
TRUE, /*follow max branch? */
H5G_node_remove, /*remove */
@@ -860,14 +861,11 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Remove the entry from the symbol table node */
if(1 == sn->nsyms) {
/*
- * We are about to remove the only symbol in this node. Copy the left
- * key to the right key and mark the right key as dirty. Free this
+ * We are about to remove the only symbol in this node. Free this
* node and indicate that the pointer to this node in the B-tree
* should be removed also.
*/
HDassert(0 == idx);
- *rt_key = *lt_key;
- *rt_key_changed = TRUE;
sn->nsyms = 0;
sn_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
ret_value = H5B_INS_REMOVE;
@@ -925,13 +923,10 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
} /* end for */
/*
- * We are about to remove all the symbols in this node. Copy the left
- * key to the right key and mark the right key as dirty. Free this
+ * We are about to remove all the symbols in this node. Free this
* node and indicate that the pointer to this node in the B-tree
* should be removed also.
*/
- *rt_key = *lt_key;
- *rt_key_changed = TRUE;
sn->nsyms = 0;
sn_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
ret_value = H5B_INS_REMOVE;