[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
This commit is contained in:
Quincey Koziol 2006-08-11 13:47:44 -05:00
parent b648c14f13
commit 67eba917e2
2 changed files with 13 additions and 13 deletions

View File

@ -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")

View File

@ -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);