diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-03-05 05:04:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-03-05 05:04:13 (GMT) |
commit | 8d2ddf51709999a74dd32df49e52509d82eee627 (patch) | |
tree | 3f5faa39a599d88193799a3a529bb8f4ea3fd358 /src/H5B2.c | |
parent | 9845d40eb5e13f31c33678f834b77451c84a24b7 (diff) | |
download | hdf5-8d2ddf51709999a74dd32df49e52509d82eee627.zip hdf5-8d2ddf51709999a74dd32df49e52509d82eee627.tar.gz hdf5-8d2ddf51709999a74dd32df49e52509d82eee627.tar.bz2 |
[svn-r10154] Purpose:
Bug fix/new feature
Description:
Tweak the record promotion algorithm to get it working correctly when
promoting and redistributing records.
Added tests for that case.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Solaris 2.9 (shanti)
Diffstat (limited to 'src/H5B2.c')
-rw-r--r-- | src/H5B2.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -3404,20 +3404,9 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, /* Locate node pointer for child */ cmp=H5B2_locate_record(shared->type,internal->nrec,shared->nat_off,internal->int_native,udata,&idx); - if(cmp>0) - idx++; - - /* Handle deleting a record from an internal node */ - if(cmp==0) { - /* Increment the index to work with */ + if(cmp >= 0) idx++; - /* Swap record to delete with record from child */ - if(H5B2_swap_child(f,dxpl_id,depth,internal,idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree") - } /* end if */ - - /* Set the number of redistribution retries */ /* This takes care of the case where a B-tree node needs to be * redistributed, but redistributing the node causes the index @@ -3470,12 +3459,20 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, /* Locate node pointer for child (after merge/redistribute) */ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ cmp=H5B2_locate_record(shared->type,internal->nrec,shared->nat_off,internal->int_native,udata,&idx); - if(cmp > 0) + if(cmp >= 0) idx++; /* Decrement the number of redistribution retries left */ retries--; } /* end while */ + + /* Handle deleting a record from an internal node */ + if(cmp==0) { + /* Swap record to delete with record from child */ + if(H5B2_swap_child(f,dxpl_id,depth,internal,idx) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree") + } /* end if */ + } /* end block */ /* Attempt to remove node */ |