summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/h5ff_client_attr.c278
-rw-r--r--src/H5VLiod_attr.c293
-rw-r--r--src/H5VLiod_map.c3
3 files changed, 273 insertions, 301 deletions
diff --git a/examples/h5ff_client_attr.c b/examples/h5ff_client_attr.c
index 9fc097f..2d6c175 100644
--- a/examples/h5ff_client_attr.c
+++ b/examples/h5ff_client_attr.c
@@ -10,14 +10,14 @@
#include "hdf5.h"
int main(int argc, char **argv) {
- const char file_name[]="eff_file.h5";
+ const char file_name[]="eff_file_attr.h5";
hid_t file_id;
hid_t gid1;
hid_t sid, dtid;
hid_t did1, map;
hid_t aid1, aid2, aid3, aid4, aid5;
- hid_t tid1, tid2, rid1, rid2;
+ hid_t tid1, rid1, rid2;
hid_t fapl_id, trspl_id;
hid_t e_stack;
hbool_t exists1;
@@ -90,113 +90,71 @@ int main(int argc, char **argv) {
rid1 = H5RCacquire(file_id, &version, H5P_DEFAULT, H5_EVENT_STACK_NULL);
assert(0 == version);
- /* create transaction object */
- tid1 = H5TRcreate(file_id, rid1, (uint64_t)1);
- assert(tid1);
-
/* start transaction 1 with default Leader/Delegate model. Leader
which is rank 0 here starts the transaction. It can be
asynchronous, but we make it synchronous here so that the
Leader can tell its delegates that the transaction is
started. */
if(0 == my_rank) {
+ /* create transaction object */
+ tid1 = H5TRcreate(file_id, rid1, (uint64_t)1);
+ assert(tid1);
+
ret = H5TRstart(tid1, H5P_DEFAULT, H5_EVENT_STACK_NULL);
assert(0 == ret);
- trans_num = 1;
- }
-
- /* Tell Delegates that transaction 1 is started. */
- MPI_Ibcast(&trans_num, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD, &mpi_req);
-
- /* Leader can continue writing to transaction 1,
- while others wait for the ibcast to complete */
- if(0 != my_rank)
- MPI_Wait(&mpi_req, MPI_STATUS_IGNORE);
-
- assert(1 == trans_num);
-
- /*
- Assume the following object create calls are collective.
-
- In a real world scenario, the following create calls are
- independent by default; i.e. only 1 process, typically a leader
- process, calls them. The user does the local-to-global,
- global-to-local thing to get the objects accessible to all delegates.
-
- This will not fail here because IOD used for now is skeletal,
- so it does not matter if the calls are collective or
- independent.
- */
-
- /* create group /G1 */
- gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
- assert(gid1 > 0);
-
- /* create dataset /G1/D1 */
- did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
- assert(did1 > 0);
-
- /* Commit the datatype dtid to the file. */
- ret = H5Tcommit_ff(file_id, "DT1", dtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT,
- tid1, e_stack);
- assert(ret == 0);
-
- /* create a Map object on the root group */
- map = H5Mcreate_ff(file_id, "MAP1", H5T_STD_I32LE, H5T_STD_I32LE,
- H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT, tid1, e_stack);
- assert(map > 0);
-
- /* create an attribute on root group */
- aid1 = H5Acreate_ff(file_id, "ROOT_ATTR", dtid, sid,
- H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
- assert(aid1);
-
- /* create an attribute on group G1. */
- aid2 = H5Acreate_ff(gid1, "GROUP_ATTR", dtid, sid,
- H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
- assert(aid2);
-
- /* write data to attributes */
- ret = H5Awrite_ff(aid1, dtid, wdata1, tid1, e_stack);
- assert(ret == 0);
- ret = H5Awrite_ff(aid2, dtid, wdata2, tid1, e_stack);
- assert(ret == 0);
-
- /* none leader procs have to complete operations before notifying the leader */
- if(0 != my_rank) {
- H5ESget_count(e_stack, &num_events);
- H5ESwait_all(e_stack, &status);
- H5ESclear(e_stack);
- printf("%d events in event stack. Completion status = %d\n", num_events, status);
- }
-
- /* Barrier to make sure all processes are done writing so Process
- 0 can finish transaction 1 and acquire a read context on it. */
- MPI_Barrier(MPI_COMM_WORLD);
-
- /* Leader process finished the transaction after all clients
- finish their updates. Leader also asks the library to acquire
- the committed transaction, that becomes a readable version
- after the commit completes. */
- if(0 == my_rank) {
- MPI_Wait(&mpi_req, MPI_STATUS_IGNORE);
-
- /* make this synchronous so we know the container version has been acquired */
- ret = H5TRfinish(tid1, H5P_DEFAULT, &rid2, H5_EVENT_STACK_NULL);
- assert(0 == ret);
+ /* create group /G1 */
+ gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT, tid1, e_stack);
+ assert(gid1 > 0);
+
+ /* create dataset /G1/D1 */
+ did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(did1 > 0);
+
+ /* Commit the datatype dtid to the file. */
+ ret = H5Tcommit_ff(file_id, "DT1", dtid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT, tid1, e_stack);
+ assert(ret == 0);
+
+ /* create a Map object on the root group */
+ map = H5Mcreate_ff(file_id, "MAP1", H5T_STD_I32LE, H5T_STD_I32LE,
+ H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT, tid1, e_stack);
+ assert(map > 0);
+
+ /* create an attribute on root group */
+ aid1 = H5Acreate_ff(file_id, "ROOT_ATTR", dtid, sid,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(aid1);
+
+ /* create an attribute on group G1. */
+ aid2 = H5Acreate_ff(gid1, "GROUP_ATTR", dtid, sid,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(aid2);
+
+ /* write data to attributes */
+ ret = H5Awrite_ff(aid1, dtid, wdata1, tid1, e_stack);
+ assert(ret == 0);
+ ret = H5Awrite_ff(aid2, dtid, wdata2, tid1, e_stack);
+ assert(ret == 0);
+
+ /* create an attribute on dataset */
+ aid3 = H5Acreate_ff(did1, "DSET_ATTR", dtid, sid,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(aid3);
+
+ /* create an attribute on datatype */
+ aid4 = H5Acreate_ff(dtid, "DTYPE_ATTR", dtid, sid,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(aid4);
+
+ /* create an attribute on dataset */
+ aid5 = H5Acreate_ff(map, "MAP_ATTR", dtid, sid,
+ H5P_DEFAULT, H5P_DEFAULT, tid1, e_stack);
+ assert(aid5);
}
- /* Local op */
- ret = H5TRclose(tid1);
- assert(0 == ret);
-
- /* close attribute objects */
- ret = H5Aclose_ff(aid1, e_stack);
- assert(ret == 0);
- ret = H5Aclose_ff(aid2, e_stack);
- assert(ret == 0);
-
/* release container version 0. This is async. */
ret = H5RCrelease(rid1, e_stack);
assert(0 == ret);
@@ -206,6 +164,39 @@ int main(int argc, char **argv) {
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ if(0 == my_rank) {
+ ret = H5Aclose_ff(aid1, H5_EVENT_STACK_NULL);
+ assert(ret == 0);
+ /* Delete an attribute */
+ ret = H5Adelete_ff(file_id, "ROOT_ATTR", tid1, e_stack);
+ assert(ret == 0);
+ /* rename an attribute */
+ ret = H5Arename_ff(gid1, "GROUP_ATTR", "RENAMED_GROUP_ATTR", tid1, e_stack);
+ assert(ret == 0);
+
+ /* make this synchronous so we know the container version has been acquired */
+ ret = H5TRfinish(tid1, H5P_DEFAULT, &rid2, H5_EVENT_STACK_NULL);
+ assert(0 == ret);
+ /* Local op */
+ ret = H5TRclose(tid1);
+ assert(0 == ret);
+
+ ret = H5Aclose_ff(aid2, e_stack);
+ assert(ret == 0);
+ ret = H5Aclose_ff(aid3, e_stack);
+ assert(ret == 0);
+ ret = H5Aclose_ff(aid4, e_stack);
+ assert(ret == 0);
+ ret = H5Aclose_ff(aid5, e_stack);
+ assert(ret == 0);
+ ret = H5Dclose_ff(did1, e_stack);
+ assert(ret == 0);
+ ret = H5Mclose_ff(map, e_stack);
+ assert(ret == 0);
+ ret = H5Gclose_ff(gid1, e_stack);
+ assert(ret == 0);
+ }
+
/* Tell other procs that container version 1 is acquired */
version = 1;
MPI_Bcast(&version, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
@@ -221,64 +212,26 @@ int main(int argc, char **argv) {
ret = H5Aexists_ff(file_id, "ROOT_ATTR", &exists1, rid2, e_stack);
assert(ret == 0);
- ret = H5Aexists_by_name_ff(file_id, "G1", "GROUP_ATTR", H5P_DEFAULT, &exists2, rid2, e_stack);
+ ret = H5Aexists_by_name_ff(file_id, "G1", "RENAMED_GROUP_ATTR", H5P_DEFAULT,
+ &exists2, rid2, e_stack);
assert(ret == 0);
- aid1 = H5Aopen_ff(file_id, "ROOT_ATTR", H5P_DEFAULT, rid2, e_stack);
- aid2 = H5Aopen_ff(gid1, "GROUP_ATTR", H5P_DEFAULT, rid2, e_stack);
+ gid1 = H5Gopen_ff(file_id, "G1", H5P_DEFAULT, rid2, e_stack);
+ aid2 = H5Aopen_ff(gid1, "RENAMED_GROUP_ATTR", H5P_DEFAULT, rid2, e_stack);
+ assert(aid2);
- ret = H5Aread_ff(aid1, dtid, rdata1, rid2, e_stack);
- assert(ret == 0);
ret = H5Aread_ff(aid2, dtid, rdata2, rid2, e_stack);
assert(ret == 0);
- /* close attribute objects */
- ret = H5Aclose_ff(aid1, e_stack);
- assert(ret == 0);
ret = H5Aclose_ff(aid2, e_stack);
assert(ret == 0);
-
- /* create & start transaction 2 with num_peers = my_size. This
- means all processes are transaction leaders, and all have to
- call start and finish on the transaction. */
- tid2 = H5TRcreate(file_id, rid2, (uint64_t)2);
- assert(tid2);
- trspl_id = H5Pcreate (H5P_TR_START);
- ret = H5Pset_trspl_num_peers(trspl_id, my_size);
- assert(0 == ret);
- ret = H5TRstart(tid2, trspl_id, e_stack);
- assert(0 == ret);
- ret = H5Pclose(trspl_id);
- assert(0 == ret);
-
- /* Do more updates on transaction 2 */
-
- /* Delete an attribute */
- ret = H5Adelete_ff(file_id, "ROOT_ATTR", tid2, e_stack);
- assert(ret == 0);
-
- /* rename an attribute */
- ret = H5Arename_ff(gid1, "GROUP_ATTR", "RENAMED_GROUP_ATTR", tid2, e_stack);
+ ret = H5Gclose_ff(gid1, e_stack);
assert(ret == 0);
- /* create an attribute on dataset */
- aid3 = H5Acreate_ff(did1, "DSET_ATTR", dtid, sid,
- H5P_DEFAULT, H5P_DEFAULT, tid2, e_stack);
- assert(aid1);
-
- /* create an attribute on datatype */
- aid4 = H5Acreate_ff(dtid, "DTYPE_ATTR", dtid, sid,
- H5P_DEFAULT, H5P_DEFAULT, tid2, e_stack);
- assert(aid2);
-
- /* create an attribute on dataset */
- aid5 = H5Acreate_ff(map, "MAP_ATTR", dtid, sid,
- H5P_DEFAULT, H5P_DEFAULT, tid2, e_stack);
- assert(aid1);
-
- /* finish transaction 2 */
- ret = H5TRfinish(tid2, H5P_DEFAULT, NULL, e_stack);
- assert(0 == ret);
+ H5ESget_count(e_stack, &num_events);
+ H5ESwait_all(e_stack, &status);
+ H5ESclear(e_stack);
+ printf("%d events in event stack. Completion status = %d\n", num_events, status);
if(my_rank == 0) {
/* release container version 1. This is async. */
@@ -286,20 +239,6 @@ int main(int argc, char **argv) {
assert(0 == ret);
}
- /* close objects */
- ret = H5Aclose_ff(aid3, e_stack);
- assert(ret == 0);
- ret = H5Aclose_ff(aid4, e_stack);
- assert(ret == 0);
- ret = H5Aclose_ff(aid5, e_stack);
- assert(ret == 0);
- ret = H5Dclose_ff(did1, e_stack);
- assert(ret == 0);
- ret = H5Mclose_ff(map, e_stack);
- assert(ret == 0);
- ret = H5Gclose_ff(gid1, e_stack);
- assert(ret == 0);
-
ret = H5Sclose(sid);
assert(ret == 0);
ret = H5Tclose(dtid);
@@ -318,24 +257,9 @@ int main(int argc, char **argv) {
assert(0 == ret);
ret = H5RCclose(rid2);
assert(0 == ret);
- ret = H5TRclose(tid2);
- assert(0 == ret);
- /* Now we can check operations that were issued previously */
- if(exists1)
- printf("Attribute ROOT_ATTR exists!\n");
- else
- printf("Errr Attribute ROOT_ATTR does NOT exist. \n");
-
- if(exists2)
- printf("Attribute GROUP_ATTR exists!\n");
- else
- printf("Errr Attribute GROUP_ATTR does NOT exist. \n");
-
- fprintf(stderr, "Read Data1: ");
- for(i=0;i<nelem;++i)
- fprintf(stderr, "%d ",rdata1[i]);
- fprintf(stderr, "\n");
+ assert(!exists1);
+ assert(exists2);
fprintf(stderr, "Read Data2: ");
for(i=0;i<nelem;++i)
diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c
index 0e01e6a..2b807ac 100644
--- a/src/H5VLiod_attr.c
+++ b/src/H5VLiod_attr.c
@@ -65,42 +65,43 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
iod_size_t *max_dims; /* MAX dims for IOD */
scratch_pad sp;
iod_checksum_t sp_cs = 0;
+ iod_size_t array_dims[H5S_MAX_RANK], current_dims[H5S_MAX_RANK];
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Create %s on object path %s\n", attr_name, loc_name);
+ fprintf(stderr, "Start attribute create %s at %"PRIu64" with ID %"PRIx64"\n",
+ attr_name, loc_handle.wr_oh, attr_id);
#endif
/* Open the object where the attribute needs to be created. */
- if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, &obj_id, &obj_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+ if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid,
+ &obj_id, &obj_oh) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
/* Set the IOD array creation parameters */
- array.cell_size = H5Tget_size(input->type_id);
- array.num_dims = H5Sget_simple_extent_ndims(input->space_id);
- if(NULL == (array.current_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(NULL == (max_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(H5Sget_simple_extent_dims(input->space_id, array.current_dims, max_dims) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
- array.firstdim_max = max_dims[0];
+ array.cell_size = (uint32_t)H5Tget_size(input->type_id);
+ array.num_dims = (uint32_t)H5Sget_simple_extent_ndims(input->space_id);
+ if(H5Sget_simple_extent_dims(input->space_id, current_dims, array_dims) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
+ array.firstdim_max = array_dims[0];
+ array.current_dims = current_dims;
array.chunk_dims = NULL;
/* create the attribute */
- if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_ARRAY, NULL, &array, &attr_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attribute");
+ if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_ARRAY, NULL,
+ &array, &attr_id, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attribute");
if (iod_obj_open_read(coh, attr_id, NULL, &attr_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
if (iod_obj_open_write(coh, attr_id, NULL, &attr_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
/* create the metadata KV object for the attribute */
if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
/* set values for the scratch pad object */
sp[0] = mdkv_id;
@@ -112,68 +113,68 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
if(cs_scope & H5_CHECKSUM_IOD) {
sp_cs = H5_checksum_crc64(&sp, sizeof(sp));
if (iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
}
else {
if (iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
}
/* Open Metadata KV object for write */
if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
/* insert object type metadata */
if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_ATTR, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* MSC - need to check size of datatype if it fits in
entry otherwise create a BLOB */
/* insert datatype metadata */
if(H5VL_iod_insert_datatype(mdkv_oh, wtid, input->type_id, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* insert dataspace metadata */
if(H5VL_iod_insert_dataspace(mdkv_oh, wtid, input->space_id, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* close the Metadata KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
/* if the starting location is not the last component, need to
read the attrkv_id of the last object where attribute needs
to be created */
- if(loc_id != obj_id) {
+ if(loc_id != obj_id || loc_attrkv_id == IOD_OBJ_INVALID) {
/* get scratch pad of the parent */
if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* open the attribute KV in scratch pad */
if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
else {
/* open the attribute KV */
if (iod_obj_open_write(coh, loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
/* insert new attribute in scratch pad of current object */
if(H5VL_iod_insert_new_link(attr_kv_oh, wtid, attr_name,
H5L_TYPE_HARD, &attr_id, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* close the Attribute KV object */
if(iod_obj_close(attr_kv_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
/* close parent group if it is not the location we started the
traversal into */
@@ -200,8 +201,6 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
HG_Handler_start_output(op_data->hg_handle, &output);
}
- if(max_dims) free(max_dims);
- if(array.current_dims) free(array.current_dims);
input = (attr_create_in_t *)H5MM_xfree(input);
op_data = (op_data_t *)H5MM_xfree(op_data);
@@ -250,47 +249,54 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
FUNC_ENTER_NOAPI_NOINIT
+
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Open %s\n", attr_name);
+ fprintf(stderr, "Start attribute open %s at %s (OH %"PRIu64" ID %"PRIx64")\n",
+ attr_name, loc_name, loc_handle.rd_oh.cookie, loc_id);
#endif
/* Open the object where the attribute needs to be opened. */
if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name,
rtid, &obj_id, &obj_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Attribute is on object (OH %"PRIu64" ID %"PRIx64")\n",
+ obj_oh.rd_oh.cookie, obj_id);
+#endif
/* if the starting location is not the last component, need to
read the attrkv_id of the last object where attribute needs
to be created */
- if(loc_id != obj_id) {
+ if(loc_id != obj_id || loc_attrkv_id == IOD_OBJ_INVALID) {
/* get scratch pad of the object */
if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* if attribute KV does not exist, return error*/
if(IOD_OBJ_INVALID == sp[1])
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
/* open the attribute KV in scratch pad */
if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
else {
/* open the attribute KV */
if (iod_obj_open_read(coh, loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
/* get attribute ID */
if(H5VL_iod_get_metadata(attr_kv_oh, rtid, H5VL_IOD_LINK,
attr_name, NULL, NULL, &iod_link) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
HDassert(iod_link.link_type == H5L_TYPE_HARD);
attr_id = iod_link.u.iod_id;
@@ -305,38 +311,41 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
/* open the attribute */
if (iod_obj_open_read(coh, attr_id, NULL /*hints*/, &attr_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &attr_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
/* get scratch pad of the attribute */
if(iod_obj_get_scratch(attr_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* open the metadata scratch pad of the attribute */
if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE,
+ if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE,
+ H5VL_IOD_KEY_OBJ_DATATYPE,
NULL, NULL, &output.type_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype");
- if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE,
+ if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE,
+ H5VL_IOD_KEY_OBJ_DATASPACE,
NULL, NULL, &output.space_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
/* close the metadata scratch pad */
if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
output.iod_id = attr_id;
output.mdkv_id = sp[0];
+ output.acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
output.iod_oh.rd_oh.cookie = attr_oh.rd_oh.cookie;
output.iod_oh.wr_oh.cookie = attr_oh.wr_oh.cookie;
@@ -413,28 +422,28 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
/* open the attribute if we don't have the handle yet */
if(iod_oh.cookie == IOD_OH_UNDEFINED) {
if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
opened_locally = TRUE;
}
size = HG_Bulk_handle_get_size(bulk_handle);
if(NULL == (buf = malloc(size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
/* MSC - Not needed if dataspace is available */
#if 0
/* open the metadata scratch pad of the attribute */
if (iod_obj_open_read(coh, mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE,
NULL, NULL, &space_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
/* close the metadata scratch pad */
if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
#endif
/* set the memory descriptor */
@@ -447,7 +456,7 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
/* get the rank of the dataspace */
if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion");
+ HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion");
hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims);
hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims);
@@ -456,31 +465,33 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
/* generate the descriptor */
if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection");
+ HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection");
/* set the file descriptor */
file_desc = hslabs;
/* read from array object */
if(iod_array_read(iod_oh, rtid, NULL, mem_desc, &file_desc, &iod_cs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ /* MSC - NEED IOD Checksums
if(cs_scope & H5_CHECKSUM_MEMORY) {
attr_cs = H5_checksum_crc64(buf, size);
if(attr_cs != iod_cs)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "Data corruption detected when reading attribute");
+ HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "Data corruption detected when reading attribute");
}
+ */
/* Create a new block handle to write the data */
HG_Bulk_block_handle_create(buf, size, HG_BULK_READ_ONLY, &bulk_block_handle);
/* Write bulk data here and wait for the data to be there */
if(HG_SUCCESS != HG_Bulk_write_all(dest, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
/* wait for it to complete */
if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_MAX_IDLE_TIME, HG_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
done:
#if H5VL_IOD_DEBUG
@@ -508,7 +519,7 @@ done:
/* close the attribute if we opened it in this routine */
if(opened_locally) {
if(iod_obj_close(iod_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
}
FUNC_LEAVE_NOAPI_VOID
@@ -565,26 +576,27 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
/* open the attribute if we don't have the handle yet */
if(iod_oh.cookie == IOD_OH_UNDEFINED) {
if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ opened_locally = TRUE;
}
/* Read bulk data here and wait for the data to be here */
size = HG_Bulk_handle_get_size(bulk_handle);
if(NULL == (buf = malloc(size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
HG_Bulk_block_handle_create(buf, size, HG_BULK_READWRITE, &bulk_block_handle);
/* Write bulk data here and wait for the data to be there */
if(HG_SUCCESS != HG_Bulk_read_all(source, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+ HGOTO_ERROR2(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
/* wait for it to complete */
if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_MAX_IDLE_TIME, HG_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+ HGOTO_ERROR2(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
/* free the bds block handle */
if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
+ HGOTO_ERROR2(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
#if H5VL_IOD_DEBUG
{
@@ -602,15 +614,15 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
#if 0
/* open the metadata scratch pad of the attribute */
if (iod_obj_open_read(coh, mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE,
NULL, NULL, &space_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
/* close the metadata scratch pad */
if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
#endif
/* set the memory descriptor */
@@ -623,7 +635,7 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
/* get the rank of the dataspace */
if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion");
+ HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion");
hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims);
hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims);
@@ -632,7 +644,7 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
/* generate the descriptor */
if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection");
+ HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection");
/* set the file descriptor */
file_desc = hslabs;
@@ -642,12 +654,12 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
/* write from array object */
if(iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, &attr_cs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
}
else {
/* write from array object */
if(iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
}
done:
@@ -674,7 +686,7 @@ done:
/* close the attribute if we opened it in this routine */
if(opened_locally) {
if(iod_obj_close(iod_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
}
FUNC_LEAVE_NOAPI_VOID
} /* end H5VL_iod_server_attr_write_cb() */
@@ -724,18 +736,19 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine,
#endif
/* Open the object where the attribute needs to be checked. */
- if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, &obj_id, &obj_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+ if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid,
+ &obj_id, &obj_oh) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
if(obj_id != loc_id) {
/* get scratch pad of the parent */
if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* if attribute KV does not exist, return false*/
@@ -746,12 +759,12 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine,
/* open the attribute KV in scratch pad */
if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
else {
/* open the attribute KV */
if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
/* close parent group if it is not the location we started the
@@ -822,6 +835,8 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
iod_kv_t kv; /* KV entry */
H5VL_iod_link_t iod_link;
scratch_pad sp;
+ iod_ret_t ret;
+ iod_checksum_t cs;
iod_checksum_t sp_cs = 0;
herr_t ret_value = SUCCEED;
@@ -832,36 +847,37 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
#endif
/* Open the object where the attribute needs to be checked. */
- if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, &obj_id, &obj_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+ if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name,
+ rtid, &obj_id, &obj_oh) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
- if(loc_id != obj_id) {
+ if(loc_id != obj_id || IOD_OBJ_INVALID == input->loc_attrkv_id) {
/* get scratch pad of the parent */
if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* if attribute KV does not exist, return error*/
if(IOD_OBJ_INVALID == sp[1])
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
/* open the attribute KV in scratch pad */
if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
else {
/* open the attribute KV */
if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
if (iod_obj_open_write(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
/* close parent group if it is not the location we started the
@@ -873,7 +889,7 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
/* get attribute ID */
if(H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK,
old_name, NULL, NULL, &iod_link) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
HDassert(iod_link.link_type == H5L_TYPE_HARD);
attr_id = iod_link.u.iod_id;
@@ -882,19 +898,21 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
kv.key = (void *)old_name;
kv.key_len = strlen(old_name);
kvs.kv = &kv;
+ kvs.cs = &cs;
+ kvs.ret = &ret;
if(iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
/* insert attribute with new name */
if(H5VL_iod_insert_new_link(attr_kv_oh.wr_oh, wtid, new_name,
H5L_TYPE_HARD, &attr_id, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* close the Attribute KV object */
if(iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
if(iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
done:
@@ -937,6 +955,7 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
iod_handles_t obj_oh; /* current object handle accessed */
iod_handles_t attr_kv_oh; /* KV handle holding attributes for object */
+ iod_handle_t attr_oh;
iod_obj_id_t obj_id, attr_id;
const char *loc_name = input->path; /* path to start hierarchy traversal */
const char *attr_name = input->attr_name; /* attribute's name */
@@ -948,6 +967,8 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
H5VL_iod_link_t iod_link;
scratch_pad sp;
iod_checksum_t sp_cs = 0;
+ iod_ret_t ret;
+ iod_checksum_t cs;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -957,36 +978,37 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
#endif
/* Open the object where the attribute needs to be removed. */
- if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, &obj_id, &obj_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
+ if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid,
+ &obj_id, &obj_oh) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object");
if(loc_id != obj_id) {
/* get scratch pad of the parent */
if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
/* verify scratch pad integrity */
if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
}
/* if attribute KV does not exist, return error*/
if(IOD_OBJ_INVALID == sp[1])
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
/* open the attribute KV in scratch pad */
if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
else {
/* open the attribute KV */
if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
if (iod_obj_open_write(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
}
/* close parent group if it is not the location we started the
@@ -998,25 +1020,56 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
/* get attribute ID */
if(H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK,
attr_name, NULL, NULL, &iod_link) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
HDassert(iod_link.link_type == H5L_TYPE_HARD);
attr_id = iod_link.u.iod_id;
+ /* remove metadata KV of attribute */
+ /* open the attribute */
+ if (iod_obj_open_read(coh, attr_id, NULL /*hints*/, &attr_oh, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ /* get scratch pad of the attribute */
+ if(iod_obj_get_scratch(attr_oh, rtid, &sp, &sp_cs, NULL) < 0)
+ HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
+ /* verify scratch pad integrity */
+ if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ }
+
+ ret = iod_obj_unlink(coh, sp[0], wtid, NULL);
+ if(ret < 0) {
+ fprintf(stderr, "ret %d error %s\n", ret, strerror(-ret));
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink MDKV of attribute object");
+ }
+
+ /* close the attribute oh */
+ if(iod_obj_close(attr_oh, NULL, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
/* remove attribute */
kv.key = (void *)attr_name;
kv.key_len = strlen(attr_name);
kvs.kv = &kv;
+ kvs.cs = &cs;
+ kvs.ret = &ret;
if(iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
- if(iod_obj_unlink(coh, attr_id, wtid, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+
+ ret = iod_obj_unlink(coh, attr_id, wtid, NULL);
+ if(ret < 0) {
+ fprintf(stderr, "ret %d error %s\n", ret, strerror(-ret));
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink object");
+ }
/* close the Attribute KV object */
if(iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
if(iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object");
done:
#if H5VL_IOD_DEBUG
@@ -1060,20 +1113,14 @@ H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine,
FUNC_ENTER_NOAPI_NOINIT
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Close\n");
-#endif
-
-#if 0
- if(IOD_OH_UNDEFINED == iod_oh.wr_oh.cookie ||
- IOD_OH_UNDEFINED == iod_oh.rd_oh.cookie) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't close object with invalid handle");
- }
+ fprintf(stderr, "Start attribute Close %"PRIu64" %"PRIu64"\n",
+ iod_oh.rd_oh, iod_oh.wr_oh);
#endif
if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
if((iod_obj_close(iod_oh.wr_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
done:
#if H5VL_IOD_DEBUG
diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c
index 5f0cd0c..4d9b10a 100644
--- a/src/H5VLiod_map.c
+++ b/src/H5VLiod_map.c
@@ -982,7 +982,8 @@ H5VL_iod_server_map_close_cb(AXE_engine_t UNUSED axe_engine,
FUNC_ENTER_NOAPI_NOINIT
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start map close\n");
+ fprintf(stderr, "Start map Close %"PRIu64" %"PRIu64"\n",
+ iod_oh.rd_oh, iod_oh.wr_oh);
#endif
if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0)