summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-08-11 18:47:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-08-11 18:47:44 (GMT)
commit67eba917e2ae0c97015dbcc116a582da73ceb389 (patch)
treea134c186b829248d999ffdea4927c4da939e0042
parentb648c14f13498349a743e9ef925399a8e6b592de (diff)
downloadhdf5-67eba917e2ae0c97015dbcc116a582da73ceb389.zip
hdf5-67eba917e2ae0c97015dbcc116a582da73ceb389.tar.gz
hdf5-67eba917e2ae0c97015dbcc116a582da73ceb389.tar.bz2
[svn-r12565] Description:
Move metadata cache address rename for fractal heap indirect block immediately after reallocing the storage on disk - to prevent another routine in the library from confusing the cache by allocating more storage and attempting to insert it in metadata cache at the old block's location. Gotta like those monte carlo/random insert & delete tests, which exposed this... :-) Tested: Solaris 2.9 (shanti) Not failing on other machines
-rw-r--r--src/H5HFiblock.c24
-rw-r--r--test/fheap.c2
2 files changed, 13 insertions, 13 deletions
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index c6f54cb..7bb7884 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -478,9 +478,16 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry);
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
#ifdef QAK
-HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
+HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr);
#endif /* QAK */
+ /* Move object in cache, if it actually was relocated */
+ if(H5F_addr_ne(iblock->addr, new_addr)) {
+ if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move fractal heap root indirect block")
+ iblock->addr = new_addr;
+ } /* end if */
+
/* Re-allocate direct block entry table */
if(NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries")
@@ -506,13 +513,6 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
if(H5HF_iblock_dirty(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
- /* Move object in cache, if it actually was relocated */
- if(H5F_addr_ne(iblock->addr, new_addr)) {
- if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move fractal heap root indirect block")
- iblock->addr = new_addr;
- } /* end if */
-
/* Update other shared header info */
hdr->man_dtable.curr_root_rows = new_nrows;
hdr->man_dtable.table_addr = new_addr;
@@ -605,10 +605,6 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
#endif /* QAK */
- /* Re-allocate direct block entry table */
- if(NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (iblock->nrows * hdr->man_dtable.cparam.width))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries")
-
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
@@ -616,6 +612,10 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
iblock->addr = new_addr;
} /* end if */
+ /* Re-allocate direct block entry table */
+ if(NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (iblock->nrows * hdr->man_dtable.cparam.width))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries")
+
/* Mark indirect block as dirty */
if(H5HF_iblock_dirty(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
diff --git a/test/fheap.c b/test/fheap.c
index 1afda73..b6d9aa2 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -11075,7 +11075,7 @@ test_man_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fhea
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
#ifdef QAK
-seed = (unsigned long)1154963939;
+seed = (unsigned long)1155181717;
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
#endif /* QAK */
HDsrandom(seed);