summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5B2.c68
-rw-r--r--src/H5B2cache.c28
-rw-r--r--src/H5B2dbg.c4
-rw-r--r--src/H5B2int.c62
-rw-r--r--src/H5B2pkg.h9
-rw-r--r--src/H5B2private.h38
-rw-r--r--src/H5B2test.c44
-rw-r--r--test/btree2.c279
8 files changed, 331 insertions, 201 deletions
diff --git a/src/H5B2.c b/src/H5B2.c
index 98dca71..44dade3 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -167,8 +167,8 @@ herr_t
H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- unsigned bt2_flags = H5AC__NO_FLAGS_SET;
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
+ unsigned bt2_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
herr_t ret_value = SUCCEED;
@@ -180,7 +180,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Look up the b-tree header */
- if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -190,7 +190,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Check if the root node is allocated yet */
if(!H5F_addr_defined(bt2->root.addr)) {
/* Create root node as leaf node in B-tree */
- if(H5B2_create_leaf(f, dxpl_id, bt2->shared, &(bt2->root))<0)
+ if(H5B2_create_leaf(f, dxpl_id, bt2->shared, &(bt2->root)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
/* Mark B-tree header as dirty, since we updated the address of the root node */
@@ -200,17 +200,17 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
else if((bt2->depth==0 && bt2->root.node_nrec==shared->split_leaf_nrec) ||
(bt2->depth>0 && bt2->root.node_nrec==shared->split_int_nrec)) {
/* Split root node */
- if(H5B2_split_root(f, dxpl_id, bt2, &bt2_flags, bt2->shared)<0)
+ if(H5B2_split_root(f, dxpl_id, bt2, &bt2_flags, bt2->shared) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
/* Attempt to insert record into B-tree */
- if(bt2->depth>0) {
+ if(bt2->depth > 0) {
if(H5B2_insert_internal(f, dxpl_id, bt2->shared, bt2->depth, &bt2_flags, &bt2->root, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2_insert_leaf(f,dxpl_id,bt2->shared,&bt2->root,udata)<0)
+ if(H5B2_insert_leaf(f,dxpl_id,bt2->shared,&bt2->root, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
@@ -219,7 +219,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -312,7 +312,7 @@ done:
* the record.
*
* If 'OP' is NULL, then this routine just returns "SUCCEED" when
- * a record is found.
+ * a record is present in the B-tree.
*
* Return: Non-negative on success, negative on failure.
*
@@ -391,7 +391,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[idx];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -399,7 +399,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if ( op && (op)(H5B2_INT_NREC(internal,shared,idx), op_data) <0) {
+ if(op && (op)(H5B2_INT_NREC(internal, shared, idx), op_data) < 0) {
/* Unlock current node */
if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
@@ -408,7 +408,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -422,7 +422,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if (NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -430,7 +430,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if(cmp != 0) {
/* Unlock leaf node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Note: don't push error on stack, leave that to next higher level,
@@ -445,9 +445,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if ( op && (op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data) <0) {
+ if(op && (op)(H5B2_LEAF_NREC(leaf, shared, idx), op_data) < 0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -455,9 +455,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- }
+ } /* end block */
done:
/* Check if we need to decrement the reference count for the B-tree's shared info */
@@ -660,7 +660,7 @@ done:
*/
herr_t
H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata)
+ void *udata, H5B2_remove_t op, void *op_data)
{
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
unsigned bt2_flags = H5AC__NO_FLAGS_SET;
@@ -687,17 +687,17 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Attempt to remove record from B-tree */
- if(bt2->depth>0) {
- hbool_t depth_decreased=FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
+ if(bt2->depth > 0) {
+ hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2_remove_internal(f,dxpl_id,bt2->shared, &depth_decreased, NULL, bt2->depth,
- &(bt2->cache_info),&bt2_flags,&bt2->root,udata)<0)
+ if(H5B2_remove_internal(f, dxpl_id, bt2->shared, &depth_decreased, NULL, bt2->depth,
+ &(bt2->cache_info), &bt2_flags, &bt2->root, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
bt2->depth -= depth_decreased;
} /* end if */
else {
- if(H5B2_remove_leaf(f,dxpl_id,bt2->shared,&bt2->root,udata)<0)
+ if(H5B2_remove_leaf(f, dxpl_id, bt2->shared, &bt2->root, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -832,6 +832,15 @@ done:
*
* Purpose: Delete an entire B-tree from a file.
*
+ * The 'OP' routine is called for each record and the
+ * OP_DATA pointer, to allow caller to perform an operation as
+ * each record is removed from the B-tree.
+ *
+ * If 'OP' is NULL, the records are just removed in the process
+ * of deleting the B-tree.
+ *
+ * Note: The records are _not_ guaranteed to be visited in order.
+ *
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
@@ -841,7 +850,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr)
+H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
+ H5B2_remove_t op, void *op_data)
{
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -854,21 +864,21 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr)
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Delete all nodes in B-tree */
if(H5F_addr_defined(bt2->root.addr))
- if(H5B2_delete_node(f, dxpl_id, bt2->shared, bt2->depth, &bt2->root)<0)
+ if(H5B2_delete_node(f, dxpl_id, bt2->shared, bt2->depth, &bt2->root, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
/* Release space for B-tree node on disk */
- if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5B2_HEADER_SIZE(f))<0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5B2_HEADER_SIZE(f))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree header info")
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__DELETED_FLAG) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to delete B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 476e9d1..1e35804 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -175,7 +175,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
p = buf;
/* Magic number */
- if(HDmemcmp(p, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature")
p += H5B2_SIZEOF_MAGIC;
@@ -251,10 +251,10 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
HDassert(bt2);
if (bt2->cache_info.is_dirty) {
- H5B2_shared_t *shared; /* Shared B-tree information */
- uint8_t *buf = NULL; /* Temporary raw data buffer */
- uint8_t *p; /* Pointer into raw data buffer */
- size_t size; /* Header size on disk */
+ H5B2_shared_t *shared; /* Shared B-tree information */
+ uint8_t *buf; /* Temporary raw data buffer */
+ uint8_t *p; /* Pointer into raw data buffer */
+ size_t size; /* Header size on disk */
/* Get the pointer to the shared B-tree info */
shared = H5RC_GET_OBJ(bt2->shared);
@@ -270,7 +270,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
p = buf;
/* Magic number */
- HDmemcpy(p, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC);
+ HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
p += H5B2_SIZEOF_MAGIC;
/* Version # */
@@ -472,7 +472,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
p = shared->page;
/* Magic number */
- if(HDmemcmp(p, H5B2_LEAF_MAGIC, H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node signature")
p += H5B2_SIZEOF_MAGIC;
@@ -497,7 +497,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
native = leaf->leaf_native;
for(u = 0; u < leaf->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((shared->type->decode)(f, shared->type, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
@@ -556,7 +556,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
p = shared->page;
/* magic number */
- HDmemcpy(p, H5B2_LEAF_MAGIC, H5B2_SIZEOF_MAGIC);
+ HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
p += H5B2_SIZEOF_MAGIC;
/* version # */
@@ -569,7 +569,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
native = leaf->leaf_native;
for(u = 0; u < leaf->nrec; u++) {
/* Encode record */
- if((shared->type->encode)(f, p, native) < 0)
+ if((shared->type->encode)(f, shared->type, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
@@ -767,7 +767,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre
p = shared->page;
/* Magic number */
- if(HDmemcmp(p, H5B2_INT_MAGIC, H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree internal node signature")
p += H5B2_SIZEOF_MAGIC;
@@ -796,7 +796,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre
native = internal->int_native;
for(u = 0; u < internal->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((shared->type->decode)(f, shared->type, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
@@ -868,7 +868,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
p = shared->page;
/* Magic number */
- HDmemcpy(p, H5B2_INT_MAGIC, H5B2_SIZEOF_MAGIC);
+ HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
p += H5B2_SIZEOF_MAGIC;
/* Version # */
@@ -881,7 +881,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
native = internal->int_native;
for(u = 0; u < internal->nrec; u++) {
/* Encode record */
- if((shared->type->encode)(f, p, native) < 0)
+ if((shared->type->encode)(f, shared->type, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 0bc8cd9..88e6852 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -277,7 +277,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
temp_str);
HDassert(H5B2_INT_NREC(internal, shared, u));
(void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
- H5B2_INT_NREC(internal,shared,u), NULL);
+ shared->type, H5B2_INT_NREC(internal,shared,u), NULL);
} /* end for */
/* Print final node pointer */
@@ -386,7 +386,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
temp_str);
HDassert(H5B2_LEAF_NREC(leaf, shared, u));
(void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
- H5B2_LEAF_NREC(leaf,shared,u), NULL);
+ shared->type, H5B2_LEAF_NREC(leaf,shared,u), NULL);
} /* end for */
done:
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 1d35cbd..8c6f515 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -301,9 +301,9 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_locate_record)
hi = nrec;
- while (lo < hi && cmp) {
+ while(lo < hi && cmp) {
my_idx = (lo + hi) / 2;
- if ((cmp = (type->compare)(udata, native+rec_off[my_idx])) < 0)
+ if((cmp = (type->compare)(type, udata, native + rec_off[my_idx])) < 0)
hi = my_idx;
else
lo = my_idx + 1;
@@ -2239,7 +2239,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
} /* end else */
/* Make callback to store record in native form */
- if((shared->type->store)(H5B2_LEAF_NREC(leaf,shared,idx),udata)<0)
+ if((shared->type->store)(shared->type, H5B2_LEAF_NREC(leaf,shared,idx), udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
/* Update record count for node pointer to current node */
@@ -2251,7 +2251,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node (marked as dirty) */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
+ if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2617,16 +2617,16 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
native = leaf->leaf_native;
} /* end else */
- /* Iterate through records */
- for(u=0; u<curr_node->node_nrec && !ret_value; u++) {
+ /* Iterate through records, in order */
+ for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
- if(depth>0) {
- if((ret_value = H5B2_iterate_node(f,dxpl_id,bt2_shared,depth-1,&(node_ptrs[u]),op,op_data))<0)
+ if(depth > 0) {
+ if((ret_value = H5B2_iterate_node(f, dxpl_id, bt2_shared, depth-1, &(node_ptrs[u]), op, op_data)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
} /* end if */
/* Make callback for current record */
- if ((ret_value = (op)(H5B2_NAT_NREC(native,shared,u), op_data)) <0)
+ if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
} /* end for */
@@ -2661,7 +2661,8 @@ done:
*/
herr_t
H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *curr_node_ptr, void *udata)
+ H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
+ void *op_data)
{
H5B2_leaf_t *leaf; /* Pointer to leaf node */
haddr_t leaf_addr=HADDR_UNDEF; /* Leaf address on disk */
@@ -2695,9 +2696,10 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
if(H5B2_locate_record(shared->type,leaf->nrec,shared->nat_off,leaf->leaf_native,udata,&idx) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
- /* Make callback to retrieve record in native form */
- if((shared->type->retrieve)(udata,H5B2_LEAF_NREC(leaf,shared,idx))<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
+ /* Make 'remove' callback if there is one */
+ if(op)
+ if((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
/* Update number of records in node */
leaf->nrec--;
@@ -2751,7 +2753,8 @@ herr_t
H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
hbool_t *depth_decreased, void *swap_loc, unsigned depth,
H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, void *udata)
+ H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
+ void *op_data)
{
H5AC_info_t *new_cache_info; /* Pointer to new cache info */
unsigned *new_cache_info_flags_ptr = NULL;
@@ -2802,7 +2805,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Release space for root B-tree node on disk */
- if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, internal_addr, (hsize_t)shared->node_size)<0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, internal_addr, (hsize_t)shared->node_size)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
/* Let the cache know that the object is deleted */
@@ -2914,12 +2917,12 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to remove node */
if(depth>1) {
- if(H5B2_remove_internal(f,dxpl_id,bt2_shared,depth_decreased, swap_loc, depth-1,
- new_cache_info,new_cache_info_flags_ptr,new_node_ptr,udata)<0)
+ if(H5B2_remove_internal(f, dxpl_id, bt2_shared, depth_decreased, swap_loc, depth-1,
+ new_cache_info, new_cache_info_flags_ptr, new_node_ptr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2_remove_leaf(f,dxpl_id,bt2_shared,new_node_ptr,udata)<0)
+ if(H5B2_remove_leaf(f, dxpl_id, bt2_shared, new_node_ptr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -3143,11 +3146,12 @@ done:
*/
herr_t
H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
- const H5B2_node_ptr_t *curr_node)
+ const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data)
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
void *node=NULL; /* Pointers to current node */
+ uint8_t *native; /* Pointers to node's native records */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_delete_node)
@@ -3172,10 +3176,11 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
node = internal;
+ native = internal->int_native;
/* Descend into children */
for(u=0; u<internal->nrec+1; u++)
- if(H5B2_delete_node(f, dxpl_id, bt2_shared, depth-1, &(internal->node_ptrs[u]))<0)
+ if(H5B2_delete_node(f, dxpl_id, bt2_shared, depth-1, &(internal->node_ptrs[u]), op, op_data)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed")
} /* end if */
else {
@@ -3188,16 +3193,29 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
node = leaf;
+ native = leaf->leaf_native;
} /* end else */
+ /* If there's a callback defined, iterate over the records in this node */
+ if(op) {
+ unsigned u; /* Local index */
+
+ /* Iterate through records in this node */
+ for(u = 0; u < curr_node->node_nrec; u++) {
+ /* Make callback for each record */
+ if((op)(H5B2_NAT_NREC(native, shared, u), op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
+ } /* end for */
+ } /* end if */
+
/* Release space for current B-tree node on disk */
- if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, curr_node->addr, (hsize_t)shared->node_size)<0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, curr_node->addr, (hsize_t)shared->node_size)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree node")
done:
/* Unlock & delete current node */
if(node)
- if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 784b1e5..5a27494 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -215,13 +215,16 @@ H5_DLL herr_t H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Routines for removing records */
H5_DLL herr_t H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
- hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata);
+ hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata,
+ H5B2_remove_t op, void *op_data);
H5_DLL herr_t H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *curr_node_ptr, void *udata);
+ H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
+ void *op_data);
/* Routines for deleting nodes */
H5_DLL herr_t H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, const H5B2_node_ptr_t *curr_node);
+ unsigned depth, const H5B2_node_ptr_t *curr_node, H5B2_remove_t op,
+ void *op_data);
/* Metadata cache callbacks */
H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *b);
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 0990317..f71a256 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -52,7 +52,8 @@
/* B-tree IDs for various internal things. */
typedef enum H5B2_subid_t {
H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
- H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
+ H5B2_FHEAP_ID, /* B-tree is for fractal heap */
+ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
/* Define the operator callback function pointer for H5B2_iterate() */
@@ -64,6 +65,9 @@ typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
/* Define the 'modify' callback function pointer for H5B2_modify() */
typedef herr_t (*H5B2_modify_t)(void *record, void *op_data, hbool_t *changed);
+/* Define the 'remove' callback function pointer for H5B2_remove() & H5B2_delete() */
+typedef herr_t (*H5B2_remove_t)(const void *record, void *op_data);
+
/* Comparisons for H5B2_neighbor() call */
typedef enum H5B2_compare_t {
H5B2_COMPARE_LESS, /* Records with keys less than query value */
@@ -71,29 +75,31 @@ typedef enum H5B2_compare_t {
} H5B2_compare_t;
/*
- * Each class of object that can be pointed to by a B-link tree has a
+ * Each class of object that can be pointed to by a B-tree has a
* variable of this type that contains class variables and methods.
*/
-typedef struct H5B2_class_t {
- H5B2_subid_t id; /*id as found in file*/
- size_t nrec_size; /*size of native (memory) record*/
+typedef struct H5B2_class_t H5B2_class_t;
+struct H5B2_class_t {
+ H5B2_subid_t id; /* ID of B-tree class, as found in file */
+ size_t nrec_size; /* Size of native (memory) record */
+ void *cls_private; /* Pointer to class-private information */
/* Store & retrieve record from application to B-tree 'native' form */
- herr_t (*store)(void *nrecord, const void *udata); /* Store record in native record table */
- herr_t (*retrieve)(void *udata, const void *nrecord); /* Retrieve record in native record table */
+ herr_t (*store)(const H5B2_class_t *cls, void *nrecord, const void *udata); /* Store record in native record table */
+ herr_t (*retrieve)(const H5B2_class_t *cls, void *udata, const void *nrecord); /* Retrieve record in native record table */
/* Compare records, according to a key */
- herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
+ herr_t (*compare)(const H5B2_class_t *cls, const void *rec1, const void *rec2); /* Compare two native records */
/* Encode & decode record values */
- herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */
- herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */
+ herr_t (*encode)(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */
+ herr_t (*decode)(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */
/* Debug record values */
- herr_t (*debug) (FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
- int indent, int fwidth, const void *record, const void *udata);
-
-} H5B2_class_t;
+ herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
+ int indent, int fwidth, const H5B2_class_t *cls, const void *record,
+ const void *udata);
+};
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
@@ -125,11 +131,11 @@ H5_DLL herr_t H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
H5_DLL herr_t H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, void *udata, H5B2_modify_t op, void *op_data);
H5_DLL herr_t H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata);
+ haddr_t addr, void *udata, H5B2_remove_t op, void *op_data);
H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, hsize_t *nrec);
H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr);
+ haddr_t addr, H5B2_remove_t op, void *op_data);
/* Statistics routines */
H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 3d3f787..68f26ee 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -51,28 +51,29 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5B2_test_store(void *nrecord, const void *udata);
-static herr_t H5B2_test_retrieve(void *udata, const void *nrecord);
-static herr_t H5B2_test_compare(const void *rec1, const void *rec2);
-static herr_t H5B2_test_encode(const H5F_t *f, uint8_t *raw,
+static herr_t H5B2_test_store(const H5B2_class_t *cls, void *nrecord, const void *udata);
+static herr_t H5B2_test_retrieve(const H5B2_class_t *cls, void *udata, const void *nrecord);
+static herr_t H5B2_test_compare(const H5B2_class_t *cls, const void *rec1, const void *rec2);
+static herr_t H5B2_test_encode(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw,
const void *nrecord);
-static herr_t H5B2_test_decode(const H5F_t *f, const uint8_t *raw,
+static herr_t H5B2_test_decode(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw,
void *nrecord);
static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+ int indent, int fwidth, const H5B2_class_t *cls, const void *record, const void *_udata);
/*********************/
/* Package Variables */
/*********************/
const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
- H5B2_TEST_ID, /* Type of B-tree */
- sizeof(hsize_t), /* Size of native key */
- H5B2_test_store, /* Record storage callback */
- H5B2_test_retrieve, /* Record retrieval callback */
- H5B2_test_compare, /* Record comparison callback */
- H5B2_test_encode, /* Record encoding callback */
- H5B2_test_decode, /* Record decoding callback */
- H5B2_test_debug /* Record debugging callback */
+ H5B2_TEST_ID, /* Type of B-tree */
+ sizeof(hsize_t), /* Size of native record */
+ NULL, /* Class private information */
+ H5B2_test_store, /* Record storage callback */
+ H5B2_test_retrieve, /* Record retrieval callback */
+ H5B2_test_compare, /* Record comparison callback */
+ H5B2_test_encode, /* Record encoding callback */
+ H5B2_test_decode, /* Record decoding callback */
+ H5B2_test_debug /* Record debugging callback */
}};
/*****************************/
@@ -100,7 +101,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_store(void *nrecord, const void *udata)
+H5B2_test_store(const H5B2_class_t UNUSED *cls, void *nrecord, const void *udata)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_store)
@@ -125,7 +126,7 @@ H5B2_test_store(void *nrecord, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_retrieve(void *udata, const void *nrecord)
+H5B2_test_retrieve(const H5B2_class_t UNUSED *cls, void *udata, const void *nrecord)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_retrieve)
@@ -150,7 +151,7 @@ H5B2_test_retrieve(void *udata, const void *nrecord)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_compare(const void *rec1, const void *rec2)
+H5B2_test_compare(const H5B2_class_t UNUSED *cls, const void *rec1, const void *rec2)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_compare)
@@ -173,7 +174,7 @@ H5B2_test_compare(const void *rec1, const void *rec2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
+H5B2_test_encode(const H5F_t *f, const H5B2_class_t UNUSED *cls, uint8_t *raw, const void *nrecord)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_encode)
@@ -198,7 +199,7 @@ H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
+H5B2_test_decode(const H5F_t *f, const H5B2_class_t UNUSED *cls, const uint8_t *raw, void *nrecord)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_decode)
@@ -223,8 +224,9 @@ H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
- const void *record, const void UNUSED *_udata)
+H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+ int indent, int fwidth, const H5B2_class_t UNUSED *cls, const void *record,
+ const void UNUSED *_udata)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_debug)
diff --git a/test/btree2.c b/test/btree2.c
index 7f6c498..fb77e17 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -151,6 +151,32 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed)
/*-------------------------------------------------------------------------
+ * Function: remove_cb
+ *
+ * Purpose: v2 B-tree remove callback
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, August 8, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+remove_cb(const void *_record, void *_op_data)
+{
+ const hsize_t *record = (const hsize_t *)_record;
+ hsize_t *rrecord = (hsize_t *)_op_data;
+
+ *rrecord = *record;
+
+ return(0);
+} /* end remove_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_insert_basic
*
* Purpose: Basic tests for the B-tree v2 code
@@ -1930,6 +1956,7 @@ test_remove_basic(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -1969,7 +1996,7 @@ test_remove_basic(hid_t fapl)
TESTING("B-tree remove: record from empty B-tree");
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record);
+ ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL) TEST_ERROR
@@ -2008,7 +2035,7 @@ test_remove_basic(hid_t fapl)
TESTING("B-tree remove: non-existant record from 1 record B-tree");
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record);
+ ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL) TEST_ERROR
@@ -2018,14 +2045,15 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a record from a B-tree with 1 record */
TESTING("B-tree remove: existant record from 1 record B-tree");
record = 42;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 42) TEST_ERROR
+ if(rrecord != 42) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2093,7 +2121,7 @@ test_remove_basic(hid_t fapl)
TESTING("B-tree remove: non-existant record from level-0 B-tree");
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record);
+ ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL) TEST_ERROR
@@ -2103,14 +2131,15 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a record from a level-0 B-tree with mult. record */
TESTING("B-tree remove: mult. existant records from level-0 B-tree");
record = 42;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 42) TEST_ERROR
+ if(rrecord != 42) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2133,14 +2162,15 @@ test_remove_basic(hid_t fapl)
if(!H5F_addr_defined(root_addr)) TEST_ERROR
record = 34;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 34) TEST_ERROR
+ if(rrecord != 34) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2163,14 +2193,15 @@ test_remove_basic(hid_t fapl)
if(!H5F_addr_defined(root_addr)) TEST_ERROR
record = 56;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 56) TEST_ERROR
+ if(rrecord != 56) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2193,14 +2224,15 @@ test_remove_basic(hid_t fapl)
if(!H5F_addr_defined(root_addr)) TEST_ERROR
record = 38;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 38) TEST_ERROR
+ if(rrecord != 38) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2257,6 +2289,7 @@ test_remove_level1_noredistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -2317,7 +2350,7 @@ test_remove_level1_noredistrib(hid_t fapl)
TESTING("B-tree remove: non-existant record from level-1 B-tree");
record = (INSERT_SPLIT_ROOT_NREC*2)+1;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record);
+ ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL) TEST_ERROR
@@ -2337,14 +2370,15 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from right leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from right leaf of level-1 B-tree");
record = (INSERT_SPLIT_ROOT_NREC*2)-2;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*2)-2)) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*2)-2)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2361,14 +2395,15 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from left leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from left leaf of level-1 B-tree");
record = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 1;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 0) TEST_ERROR
+ if(rrecord != 0) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2385,14 +2420,15 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from middle leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from middle leaf of level-1 B-tree");
record = INSERT_SPLIT_ROOT_NREC;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = 0;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != INSERT_SPLIT_ROOT_NREC) TEST_ERROR
+ if(rrecord != INSERT_SPLIT_ROOT_NREC) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2439,6 +2475,7 @@ test_remove_level1_redistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -2498,14 +2535,15 @@ test_remove_level1_redistrib(hid_t fapl)
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (r->l)");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC/2); u++) {
record = (INSERT_SPLIT_ROOT_NREC*2)-(u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2524,14 +2562,15 @@ test_remove_level1_redistrib(hid_t fapl)
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (l->r)");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC/4); u++) {
record = u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != u) TEST_ERROR
+ if(rrecord != u) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2550,14 +2589,15 @@ test_remove_level1_redistrib(hid_t fapl)
TESTING("B-tree remove: redistribute 3 leaves in level-1 B-tree");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC/8); u++) {
record = ((INSERT_SPLIT_ROOT_NREC/4)*3) + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (((INSERT_SPLIT_ROOT_NREC/4)*3) + u)) TEST_ERROR
+ if(rrecord != (((INSERT_SPLIT_ROOT_NREC/4)*3) + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2605,6 +2645,7 @@ test_remove_level1_2leaf_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -2664,14 +2705,15 @@ test_remove_level1_2leaf_merge(hid_t fapl)
TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (r->l)");
for(u=0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = (INSERT_SPLIT_ROOT_NREC*2)-(u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2702,14 +2744,15 @@ test_remove_level1_2leaf_merge(hid_t fapl)
/* Remove records */
for(u=0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != u) TEST_ERROR
+ if(rrecord != u) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2757,6 +2800,7 @@ test_remove_level1_3leaf_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -2816,14 +2860,15 @@ test_remove_level1_3leaf_merge(hid_t fapl)
TESTING("B-tree remove: merge 3 leaves to 2 in level-1 B-tree");
for(u=0; u < INSERT_SPLIT_ROOT_NREC+2; u++) {
record = (INSERT_SPLIT_ROOT_NREC/2)+3+u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC/2)+3+u)) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC/2)+3+u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2871,6 +2916,7 @@ test_remove_level1_promote(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -2929,14 +2975,15 @@ test_remove_level1_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
TESTING("B-tree remove: promote from right leaf of level-1 B-tree");
record = 181;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 181) TEST_ERROR
+ if(rrecord != 181) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2953,14 +3000,15 @@ test_remove_level1_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from left leaf */
TESTING("B-tree remove: promote from left leaf of level-1 B-tree");
record = 42;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 42) TEST_ERROR
+ if(rrecord != 42) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -2977,14 +3025,15 @@ test_remove_level1_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
TESTING("B-tree remove: promote from middle leaf of level-1 B-tree");
record = 85;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 85) TEST_ERROR
+ if(rrecord != 85) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3031,6 +3080,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3092,14 +3142,15 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
/* Remove records from right leaf until its ready to redistribute */
for(u=0; u < 33; u++) {
record = (INSERT_SPLIT_ROOT_NREC*2)-(u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3113,14 +3164,15 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
} /* end for */
record = 101;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 101) TEST_ERROR
+ if(rrecord != 101) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3167,6 +3219,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3228,14 +3281,15 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
/* Remove records from right leaf until its ready to redistribute */
for(u=0; u < 33; u++) {
record = 43 + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (43 + u)) TEST_ERROR
+ if(rrecord != (43 + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3249,14 +3303,15 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
} /* end for */
record = 42;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 42) TEST_ERROR
+ if(rrecord != 42) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3303,6 +3358,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3364,14 +3420,15 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
/* Remove records from right leaf until its ready to redistribute */
for(u=0; u < 66; u++) {
record = (INSERT_SPLIT_ROOT_NREC*2)-(u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*2)-(u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3385,14 +3442,15 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
} /* end for */
record = 68;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 68) TEST_ERROR
+ if(rrecord != 68) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3439,6 +3497,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3500,14 +3559,15 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
/* Remove records from right leaf until its ready to redistribute */
for(u=0; u < 81; u++) {
record = 43 + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (43 + u)) TEST_ERROR
+ if(rrecord != (43 + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3521,14 +3581,15 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
} /* end for */
record = 26;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 26) TEST_ERROR
+ if(rrecord != 26) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3575,6 +3636,7 @@ test_remove_level1_collapse(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3634,14 +3696,15 @@ test_remove_level1_collapse(hid_t fapl)
TESTING("B-tree remove: collapse level-1 B-tree back to level-0");
for(u=0; u < 30; u++) {
record = INSERT_SPLIT_ROOT_NREC - (u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (INSERT_SPLIT_ROOT_NREC - (u+1))) TEST_ERROR
+ if(rrecord != (INSERT_SPLIT_ROOT_NREC - (u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3689,6 +3752,7 @@ test_remove_level2_promote(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3747,14 +3811,15 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from right internal node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from right internal of level-2 B-tree");
record = 1632;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 1632) TEST_ERROR
+ if(rrecord != 1632) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3771,14 +3836,15 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from left internal node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from left internal of level-2 B-tree");
record = 1117;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 1117) TEST_ERROR
+ if(rrecord != 1117) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3795,14 +3861,15 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from middle internal node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from middle internal of level-2 B-tree");
record = 1246;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 1246) TEST_ERROR
+ if(rrecord != 1246) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3819,14 +3886,15 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from root of level-2 B-tree");
record = 1074;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 1074) TEST_ERROR
+ if(rrecord != 1074) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3839,14 +3907,15 @@ test_remove_level2_promote(hid_t fapl)
if(nrec != (INSERT_SPLIT_ROOT_NREC*21)-4) TEST_ERROR
record = 558;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 558) TEST_ERROR
+ if(rrecord != 558) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3893,6 +3962,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -3952,14 +4022,15 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
for(u=0; u < 22; u++) {
record = (INSERT_SPLIT_ROOT_NREC*21) - (u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*21) - (u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*21) - (u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -3973,14 +4044,15 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
} /* end for */
record = 1632;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 1632) TEST_ERROR
+ if(rrecord != 1632) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4027,6 +4099,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4086,14 +4159,15 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
for(u=0; u < 17; u++) {
record = 43 + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (43 + u)) TEST_ERROR
+ if(rrecord != (43 + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4107,14 +4181,15 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
} /* end for */
record = 42;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 42) TEST_ERROR
+ if(rrecord != 42) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4161,6 +4236,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4220,14 +4296,15 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
for(u=0; u < 38; u++) {
record = (INSERT_SPLIT_ROOT_NREC*21) - (u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*21) - (u+1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*21) - (u+1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4241,7 +4318,8 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
} /* end for */
record = 1616;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -4295,6 +4373,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4354,14 +4433,15 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
for(u=0; u < 49; u++) {
record = 43 + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (43 + u)) TEST_ERROR
+ if(rrecord != (43 + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4375,14 +4455,15 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
} /* end for */
record = 26;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != 26) TEST_ERROR
+ if(rrecord != 26) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4429,6 +4510,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4488,14 +4570,15 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (l->r)");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC*5); u++) {
record = u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != u) TEST_ERROR
+ if(rrecord != u) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4543,6 +4626,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4602,14 +4686,15 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (r->l)");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC*6); u++) {
record = (INSERT_SPLIT_ROOT_NREC*21) - (u + 1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != ((INSERT_SPLIT_ROOT_NREC*21) - (u + 1))) TEST_ERROR
+ if(rrecord != ((INSERT_SPLIT_ROOT_NREC*21) - (u + 1))) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4657,6 +4742,7 @@ test_remove_level2_3internal_merge(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4716,14 +4802,15 @@ test_remove_level2_3internal_merge(hid_t fapl)
TESTING("B-tree remove: merge 3 internal nodes to 2 in level-2 B-tree");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC*8); u++) {
record = 559 + u;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
} /* end if */
/* Make certain that the record value is correct */
- if(record != (559 + u)) TEST_ERROR
+ if(rrecord != (559 + u)) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -4771,6 +4858,7 @@ test_remove_level2_collapse_right(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
@@ -4830,7 +4918,8 @@ test_remove_level2_collapse_right(hid_t fapl)
TESTING("B-tree remove: collapse level-1 B-tree back to level-0 (r->l)");
for(u=0; u < (INSERT_SPLIT_ROOT_NREC*12); u++) {
record = (INSERT_SPLIT_ROOT_NREC*21)-(u+1);
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -4887,6 +4976,7 @@ test_remove_lots(hid_t fapl)
char filename[1024];
H5F_t *f=NULL;
hsize_t record; /* Record to insert into tree */
+ hsize_t rrecord; /* Record to remove from tree */
haddr_t bt2_addr; /* Address of B-tree created */
time_t curr_time; /* Current time, for seeding random number generator */
hsize_t *records; /* Record #'s for random insertion */
@@ -4964,7 +5054,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Remove all records */
for(u=0; u<INSERT_MANY; u++) {
record=records[u];
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ rrecord = HSIZET_MAX;
+ if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord)<0) {
#ifdef QAK
HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
#endif /* QAK */
@@ -4974,7 +5065,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
} /* end if */
/* Make certain that the record value is correct */
- if(record != records[u]) TEST_ERROR
+ if(rrecord != records[u]) TEST_ERROR
/* Query the number of records in the B-tree */
if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) {
@@ -5238,7 +5329,7 @@ test_delete(hid_t fapl)
/*
* Delete v2 B-tree
*/
- if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr)<0) {
+ if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -5288,7 +5379,7 @@ test_delete(hid_t fapl)
/*
* Delete v2 B-tree
*/
- if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr)<0) {
+ if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -5338,7 +5429,7 @@ test_delete(hid_t fapl)
/*
* Delete v2 B-tree
*/
- if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr)<0) {
+ if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -5388,7 +5479,7 @@ test_delete(hid_t fapl)
/*
* Delete v2 B-tree
*/
- if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr)<0) {
+ if (H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;