Commit d76bef34 authored by Shane Snyder's avatar Shane Snyder

dynamic leaves working + more test infrastructure

parent 3c2ab846
......@@ -141,7 +141,8 @@ int ssg_group_destroy(
* @param[in] update_cb_dat User data pointer passed to membership update callback
* @returns SSG group identifier for joined group on success, SSG_GROUP_ID_NULL otherwise
*
* NOTE: XXX in and out group ids
* NOTE: Use the returned group ID to refer to the group, as the input group ID
* becomes stale after the join is completed.
*/
ssg_group_id_t ssg_group_join(
ssg_group_id_t in_group_id,
......
......@@ -48,7 +48,6 @@ extern "C" {
} while(0)
/* debug printing macro for SSG */
/* TODO: direct debug output to file? */
/* TODO: how do we debug attachers? */
#ifdef DEBUG
#define SSG_DEBUG(__g, __fmt, ...) do { \
......@@ -103,6 +102,7 @@ typedef struct ssg_group
ssg_member_id_t self_id;
ssg_group_view_t view;
ssg_group_target_list_t target_list;
ssg_member_state_t *dead_members;
ssg_group_descriptor_t *descriptor;
swim_context_t *swim_ctx;
ABT_rwlock lock;
......@@ -128,6 +128,7 @@ typedef struct ssg_instance
margo_instance_id mid;
ssg_group_t *group_table;
ssg_attached_group_t *attached_group_table;
ABT_rwlock lock;
} ssg_instance_t;
enum ssg_group_descriptor_owner_status
......@@ -154,9 +155,14 @@ void ssg_register_rpcs(
void);
int ssg_group_join_send(
ssg_group_descriptor_t * group_descriptor,
hg_addr_t group_target_addr,
char ** group_name,
int * group_size,
void ** view_buf);
int ssg_group_leave_send(
ssg_group_descriptor_t * group_descriptor,
ssg_member_id_t self_id,
hg_addr_t group_target_addr);
int ssg_group_attach_send(
ssg_group_descriptor_t * group_descriptor,
char ** group_name,
......@@ -167,7 +173,6 @@ void ssg_apply_swim_user_updates(
swim_user_update_t *updates,
hg_size_t update_count);
/* XXX: is this right? can this be a global? */
extern ssg_instance_t *ssg_inst;
#ifdef __cplusplus
......
......@@ -41,17 +41,19 @@ MERCURY_GEN_STRUCT_PROC(ssg_group_descriptor_t, \
MERCURY_GEN_PROC(ssg_group_join_request_t, \
((ssg_group_descriptor_t) (group_descriptor))
((hg_string_t) (addr_str))
((hg_bulk_t) (bulk_handle)));
MERCURY_GEN_PROC(ssg_group_join_response_t, \
((hg_string_t) (group_name)) \
((uint32_t) (group_size)) \
((hg_size_t) (view_buf_size)));
((hg_size_t) (view_buf_size))
((uint8_t) (ret)));
#if 0
MERCURY_GEN_PROC(ssg_group_leave_request_t, \
((ssg_group_descriptor_t) (group_descriptor)));
#endif
((ssg_group_descriptor_t) (group_descriptor))
((ssg_member_id_t) (member_id)));
MERCURY_GEN_PROC(ssg_group_leave_response_t, \
((uint8_t) (ret)));
MERCURY_GEN_PROC(ssg_group_attach_request_t, \
((ssg_group_descriptor_t) (group_descriptor))
......@@ -64,9 +66,7 @@ MERCURY_GEN_PROC(ssg_group_attach_response_t, \
/* SSG RPC handler prototypes */
DECLARE_MARGO_RPC_HANDLER(ssg_group_join_recv_ult)
#if 0
DECLARE_MARGO_RPC_HANDLER(ssg_group_leave_recv_ult)
#endif
DECLARE_MARGO_RPC_HANDLER(ssg_group_attach_recv_ult)
/* internal helper routine prototypes */
......@@ -75,9 +75,7 @@ static int ssg_group_serialize(
/* SSG RPC IDs */
static hg_id_t ssg_group_join_rpc_id;
#if 0
static hg_id_t ssg_group_leave_rpc_id;
#endif
static hg_id_t ssg_group_attach_rpc_id;
/* ssg_register_rpcs
......@@ -86,17 +84,15 @@ static hg_id_t ssg_group_attach_rpc_id;
*/
void ssg_register_rpcs()
{
/* register HG RPCs for SSG */
/* register RPCs for SSG */
ssg_group_join_rpc_id =
MARGO_REGISTER(ssg_inst->mid, "ssg_group_join",
ssg_group_join_request_t, ssg_group_join_response_t,
ssg_group_join_recv_ult);
#if 0
ssg_group_leave_rpc_id =
MARGO_REGISTER(ssg_inst->mid, "ssg_group_leave",
ssg_group_leave_request_t, void,
ssg_group_leave_request_t, ssg_group_leave_response_t,
ssg_group_leave_recv_ult);
#endif
ssg_group_attach_rpc_id =
MARGO_REGISTER(ssg_inst->mid, "ssg_group_attach",
ssg_group_attach_request_t, ssg_group_attach_response_t,
......@@ -111,15 +107,16 @@ void ssg_register_rpcs()
*/
int ssg_group_join_send(
ssg_group_descriptor_t * group_descriptor,
hg_addr_t group_target_addr,
char ** group_name,
int * group_size,
void ** view_buf)
{
hg_addr_t member_addr = HG_ADDR_NULL;
hg_handle_t handle = HG_HANDLE_NULL;
hg_bulk_t bulk_handle = HG_BULK_NULL;
void *tmp_view_buf = NULL, *b;
hg_size_t tmp_view_buf_size = SSG_VIEW_BUF_DEF_SIZE;
char *self_addr_str = NULL;
ssg_group_join_request_t join_req;
ssg_group_join_response_t join_resp;
hg_return_t hret;
......@@ -129,15 +126,13 @@ int ssg_group_join_send(
*group_size = 0;
*view_buf = NULL;
/* lookup the address of the given group member */
hret = margo_addr_lookup(ssg_inst->mid, group_descriptor->addr_str,
&member_addr);
if (hret != HG_SUCCESS) goto fini;
hret = margo_create(ssg_inst->mid, member_addr,
hret = margo_create(ssg_inst->mid, group_target_addr,
ssg_group_join_rpc_id, &handle);
if (hret != HG_SUCCESS) goto fini;
SSG_GET_SELF_ADDR_STR(ssg_inst->mid, self_addr_str);
if (!self_addr_str) goto fini;
/* allocate a buffer to try to store the group view in */
/* NOTE: We don't know if this buffer is big enough to store the complete
* view. If the buffer is not large enough, the group member we are
......@@ -151,7 +146,9 @@ int ssg_group_join_send(
if (hret != HG_SUCCESS) goto fini;
/* send a join request to the given group member address */
/* XXX is the whole descriptor really needed? */
memcpy(&join_req.group_descriptor, group_descriptor, sizeof(*group_descriptor));
join_req.addr_str = self_addr_str;
join_req.bulk_handle = bulk_handle;
hret = margo_forward(handle, &join_req);
if (hret != HG_SUCCESS) goto fini;
......@@ -192,7 +189,7 @@ int ssg_group_join_send(
b = realloc(tmp_view_buf, join_resp.view_buf_size);
if(!b)
{
HG_Free_output(handle, &join_resp);
margo_free_output(handle, &join_resp);
goto fini;
}
tmp_view_buf = b;
......@@ -202,15 +199,16 @@ int ssg_group_join_send(
*group_name = strdup(join_resp.group_name);
*group_size = (int)join_resp.group_size;
*view_buf = tmp_view_buf;
sret = join_resp.ret;
margo_free_output(handle, &join_resp);
tmp_view_buf = NULL;
sret = SSG_SUCCESS;
if (sret == SSG_SUCCESS)
tmp_view_buf = NULL; /* don't free on success */
fini:
if (member_addr != HG_ADDR_NULL) margo_addr_free(ssg_inst->mid, member_addr);
if (handle != HG_HANDLE_NULL) margo_destroy(handle);
if (bulk_handle != HG_BULK_NULL) margo_bulk_free(bulk_handle);
free(tmp_view_buf);
free(self_addr_str);
return sret;
}
......@@ -226,94 +224,171 @@ static void ssg_group_join_recv_ult(
void *view_buf = NULL;
hg_size_t view_buf_size;
hg_bulk_t bulk_handle = HG_BULK_NULL;
char *join_addr_str = NULL;
hg_size_t join_addr_str_size = 0;
swim_user_update_t join_update;
int sret;
hg_return_t hret;
if (!ssg_inst) return;
join_resp.ret = SSG_FAILURE;
if (!ssg_inst) goto fini;
hgi = margo_get_info(handle);
if (!hgi) return;
if (!hgi) goto fini;
hret = margo_get_input(handle, &join_req);
if (hret != HG_SUCCESS) return;
if (hret != HG_SUCCESS) goto fini;
view_size_requested = margo_bulk_get_size(join_req.bulk_handle);
/* look for the given group in my local table of groups */
HASH_FIND(hh, ssg_inst->group_table, &join_req.group_descriptor.name_hash,
sizeof(uint64_t), g);
if (!g) goto fini;
if (!g)
{
margo_free_input(handle, &join_req);
goto fini;
}
sret = ssg_group_serialize(g, &view_buf, &view_buf_size);
if (sret != SSG_SUCCESS) goto fini;
if (sret != SSG_SUCCESS)
{
margo_free_input(handle, &join_req);
goto fini;
}
if (view_size_requested >= view_buf_size)
{
/* if attacher's buf is large enough, transfer the view */
hret = margo_bulk_create(ssg_inst->mid, 1, &view_buf, &view_buf_size,
HG_BULK_READ_ONLY, &bulk_handle);
if (hret != HG_SUCCESS) goto fini;
if (hret != HG_SUCCESS)
{
margo_free_input(handle, &join_req);
goto fini;
}
hret = margo_bulk_transfer(ssg_inst->mid, HG_BULK_PUSH, hgi->addr,
join_req.bulk_handle, 0, bulk_handle, 0, view_buf_size);
if (hret != HG_SUCCESS) goto fini;
/* get joining member's address string */
hret = margo_addr_to_string(ssg_inst->mid, NULL, &join_addr_str_size, hgi->addr);
if (hret != HG_SUCCESS) goto fini;
join_addr_str = malloc(join_addr_str_size);
if (join_addr_str == NULL) goto fini;
hret = margo_addr_to_string(ssg_inst->mid, join_addr_str, &join_addr_str_size, hgi->addr);
if (hret != HG_SUCCESS) goto fini;
if (hret != HG_SUCCESS)
{
margo_free_input(handle, &join_req);
goto fini;
}
/* create an SSG join update and register with SWIM to be gossiped */
SSG_USER_UPDATE_SERIALIZE(SSG_MEMBER_JOINED, join_addr_str,
join_addr_str_size, join_update);
SSG_USER_UPDATE_SERIALIZE(SSG_MEMBER_JOINED, join_req.addr_str,
strlen(join_req.addr_str) + 1, join_update);
swim_register_user_update(g->swim_ctx, join_update);
/* apply group join locally */
ssg_apply_swim_user_updates(g, &join_update, 1);
}
margo_free_input(handle, &join_req);
/* set the response and send back */
join_resp.group_name = g->name;
join_resp.group_size = (int)g->view.size;
join_resp.view_buf_size = view_buf_size;
join_resp.ret = SSG_SUCCESS;
fini:
/* respond */
margo_respond(handle, &join_resp);
fini:
free(view_buf);
free(join_addr_str);
margo_free_input(handle, &join_req);
if (handle != HG_HANDLE_NULL) margo_destroy(handle);
/* cleanup */
if (bulk_handle != HG_BULK_NULL) margo_bulk_free(bulk_handle);
margo_destroy(handle);
free(view_buf);
return;
}
DEFINE_MARGO_RPC_HANDLER(ssg_group_join_recv_ult)
#if 0
/* ssg_group_leave_send
*
*
*/
int ssg_group_leave_send(
ssg_group_descriptor_t * group_descriptor,
char ** group_name,
int * group_size,
void ** view_buf)
ssg_member_id_t self_id,
hg_addr_t group_target_addr)
{
hg_class_t *hgcl = NULL;
hg_addr_t member_addr = HG_ADDR_NULL;
hg_handle_t handle = HG_HANDLE_NULL;
ssg_group_leave_request_t leave_req;
ssg_group_leave_response_t leave_resp;
hg_return_t hret;
int sret = SSG_FAILURE;
/* send a join request to the given group member address */
hret = margo_create(ssg_inst->mid, group_target_addr,
ssg_group_leave_rpc_id, &handle);
if (hret != HG_SUCCESS) goto fini;
return SSG_SUCCESS;
/* send a leave request to the given group member */
/* XXX is the whole descriptor really needed? */
memcpy(&leave_req.group_descriptor, group_descriptor, sizeof(*group_descriptor));
leave_req.member_id = self_id;
hret = margo_forward(handle, &leave_req);
if (hret != HG_SUCCESS) goto fini;
hret = margo_get_output(handle, &leave_resp);
if (hret != HG_SUCCESS) goto fini;
sret = leave_resp.ret;
margo_free_output(handle, &leave_resp);
fini:
if (handle != HG_HANDLE_NULL) margo_destroy(handle);
return sret;
}
#endif
static void ssg_group_leave_recv_ult(
hg_handle_t handle)
{
const struct hg_info *hgi = NULL;
ssg_group_t *g = NULL;
ssg_group_leave_request_t leave_req;
ssg_group_leave_response_t leave_resp;
swim_user_update_t leave_update;
hg_return_t hret;
leave_resp.ret = SSG_FAILURE;
if (!ssg_inst) goto fini;
hgi = margo_get_info(handle);
if (!hgi) goto fini;
hret = margo_get_input(handle, &leave_req);
if (hret != HG_SUCCESS) goto fini;
/* look for the given group in my local table of groups */
HASH_FIND(hh, ssg_inst->group_table, &leave_req.group_descriptor.name_hash,
sizeof(uint64_t), g);
if (!g)
{
margo_free_input(handle, &leave_req);
goto fini;
}
/* create an SSG join update and register with SWIM to be gossiped */
SSG_USER_UPDATE_SERIALIZE(SSG_MEMBER_LEFT, &leave_req.member_id,
sizeof(leave_req.member_id), leave_update);
swim_register_user_update(g->swim_ctx, leave_update);
margo_free_input(handle, &leave_req);
/* apply group join locally */
ssg_apply_swim_user_updates(g, &leave_update, 1);
leave_resp.ret = SSG_SUCCESS;
fini:
/* respond */
margo_respond(handle, &leave_resp);
/* cleanup */
margo_destroy(handle);
return;
}
DEFINE_MARGO_RPC_HANDLER(ssg_group_leave_recv_ult)
/* ssg_group_attach_send
*
......
......@@ -44,12 +44,18 @@ static void ssg_group_lookup_ult(void * arg);
static ssg_group_t * ssg_group_create_internal(
const char * group_name, const char * const group_addr_strs[],
int group_size, ssg_membership_update_cb update_cb, void *update_cb_dat);
static int ssg_group_add_member(
ssg_group_t *g, const char * addr_str, hg_addr_t addr,
ssg_member_id_t member_id);
static int ssg_group_remove_member(
ssg_group_t *g, ssg_member_state_t *member_state);
static int ssg_group_view_create(
const char * const group_addr_strs[], int group_size,
const char * self_addr_str, ABT_rwlock view_lock,
ssg_group_view_t * view, ssg_member_id_t * self_id);
static ssg_member_state_t * ssg_group_view_add_member(
const char * addr_str, ssg_group_view_t * view, ABT_rwlock lock);
const char * addr_str, hg_addr_t addr, ssg_member_id_t member_id,
ssg_group_view_t * view);
static ssg_group_descriptor_t * ssg_group_descriptor_create(
uint64_t name_hash, const char * leader_addr_str, int owner_status);
static ssg_group_descriptor_t * ssg_group_descriptor_dup(
......@@ -114,6 +120,7 @@ int ssg_init(
return SSG_FAILURE;
memset(ssg_inst, 0, sizeof(*ssg_inst));
ssg_inst->mid = mid;
ABT_rwlock_create(&ssg_inst->lock);
ssg_register_rpcs();
......@@ -132,20 +139,26 @@ int ssg_finalize()
if (!ssg_inst)
return SSG_FAILURE;
ABT_rwlock_wrlock(ssg_inst->lock);
/* destroy all active groups */
HASH_ITER(hh, ssg_inst->group_table, g, g_tmp)
{
HASH_DELETE(hh, ssg_inst->group_table, g);
ABT_rwlock_unlock(ssg_inst->lock);
ssg_group_destroy_internal(g);
ABT_rwlock_wrlock(ssg_inst->lock);
}
/* detach from all attached groups */
HASH_ITER(hh, ssg_inst->attached_group_table, ag, ag_tmp)
{
HASH_DELETE(hh, ssg_inst->attached_group_table, ag);
ssg_attached_group_destroy(ag);
}
ABT_rwlock_unlock(ssg_inst->lock);
ABT_rwlock_free(&ssg_inst->lock);
free(ssg_inst);
ssg_inst = NULL;
......@@ -175,7 +188,12 @@ ssg_group_id_t ssg_group_create(
*/
g_id = (ssg_group_id_t)ssg_group_descriptor_dup(g->descriptor);
if (g_id == SSG_GROUP_ID_NULL)
{
ABT_rwlock_wrlock(ssg_inst->lock);
HASH_DELETE(hh, ssg_inst->group_table, g);
ABT_rwlock_unlock(ssg_inst->lock);
ssg_group_destroy_internal(g);
}
}
return g_id;
......@@ -352,14 +370,19 @@ int ssg_group_destroy(
return SSG_FAILURE;
}
ABT_rwlock_wrlock(ssg_inst->lock);
/* find the group structure and destroy it */
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (!g)
{
ABT_rwlock_unlock(ssg_inst->lock);
fprintf(stderr, "Error: SSG unable to find expected group reference\n");
return SSG_FAILURE;
}
HASH_DELETE(hh, ssg_inst->group_table, g);
ABT_rwlock_unlock(ssg_inst->lock);
ssg_group_destroy_internal(g);
return SSG_SUCCESS;
......@@ -372,10 +395,12 @@ ssg_group_id_t ssg_group_join(
{
ssg_group_descriptor_t *in_group_descriptor = (ssg_group_descriptor_t *)in_group_id;
char *self_addr_str = NULL;
hg_addr_t group_target_addr = HG_ADDR_NULL;
char *group_name = NULL;
int group_size;
void *view_buf = NULL;
const char **addr_strs = NULL;
hg_return_t hret;
int sret;
ssg_group_t *g = NULL;
ssg_group_id_t g_id = SSG_GROUP_ID_NULL;
......@@ -393,14 +418,19 @@ ssg_group_id_t ssg_group_join(
goto fini;
}
/* lookup the address of the target group member in the GID */
hret = margo_addr_lookup(ssg_inst->mid, in_group_descriptor->addr_str,
&group_target_addr);
if (hret != HG_SUCCESS) goto fini;
sret = ssg_group_join_send(in_group_descriptor, group_target_addr,
&group_name, &group_size, &view_buf);
if (sret != SSG_SUCCESS || !group_name || !view_buf) goto fini;
/* get my address string */
SSG_GET_SELF_ADDR_STR(ssg_inst->mid, self_addr_str);
if (self_addr_str == NULL) goto fini;
sret = ssg_group_join_send(in_group_descriptor, &group_name,
&group_size, &view_buf);
if (sret != SSG_SUCCESS || !group_name || !view_buf) goto fini;
/* set up address string array for all group members */
addr_strs = ssg_addr_str_buf_to_list(view_buf, group_size);
if (!addr_strs) goto fini;
......@@ -418,14 +448,22 @@ ssg_group_id_t ssg_group_join(
* it for the caller to hold on to
*/
g_id = (ssg_group_id_t)ssg_group_descriptor_dup(g->descriptor);
if (g_id == SSG_GROUP_ID_NULL) goto fini;
if (g_id == SSG_GROUP_ID_NULL)
{
ABT_rwlock_wrlock(ssg_inst->lock);
HASH_DELETE(hh, ssg_inst->group_table, g);
ABT_rwlock_unlock(ssg_inst->lock);
ssg_group_destroy_internal(g);
goto fini;
}
/* don't free on success */
group_name = NULL;
}
/* don't free on success */
group_name = NULL;
g = NULL;
fini:
if (g) ssg_group_destroy_internal(g);
if (group_target_addr != HG_ADDR_NULL)
margo_addr_free(ssg_inst->mid, group_target_addr);
free(addr_strs);
free(view_buf);
free(group_name);
......@@ -438,18 +476,66 @@ int ssg_group_leave(
ssg_group_id_t group_id)
{
ssg_group_descriptor_t *group_descriptor = (ssg_group_descriptor_t *)group_id;
ssg_group_t *g = NULL;
hg_addr_t group_target_addr = HG_ADDR_NULL;
hg_return_t hret;
int sret = SSG_FAILURE;
if (!ssg_inst || group_id == SSG_GROUP_ID_NULL) return SSG_FAILURE;
if (!ssg_inst || group_id == SSG_GROUP_ID_NULL) goto fini;
if (group_descriptor->owner_status != SSG_OWNER_IS_MEMBER)
{
fprintf(stderr, "Error: SSG unable to leave group it is not a member of\n");
return SSG_FAILURE;
goto fini;
}
return SSG_SUCCESS;
ABT_rwlock_rdlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (!g)
{
ABT_rwlock_unlock(ssg_inst->lock);
goto fini;
}
/* send the leave req to the first member in the view */
hret = margo_addr_dup(ssg_inst->mid, g->view.member_map->addr, &group_target_addr);
if (hret != HG_SUCCESS)
{
ABT_rwlock_unlock(ssg_inst->lock);
goto fini;
}
ABT_rwlock_unlock(ssg_inst->lock);
sret = ssg_group_leave_send(group_descriptor, g->self_id, group_target_addr);
if (sret != SSG_SUCCESS) goto fini;
/* at least one group member knows of the leave request -- safe to
* shutdown the group locally
*/
/* re-lookup the group as we don't hold the lock while sending the leave req */
ABT_rwlock_wrlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (g)
{
HASH_DELETE(hh, ssg_inst->group_table, g);
ABT_rwlock_unlock(ssg_inst->lock);
ssg_group_destroy_internal(g);
}
ABT_rwlock_unlock(ssg_inst->lock);
sret = SSG_SUCCESS;
fini:
if (group_target_addr != HG_ADDR_NULL)
margo_addr_free(ssg_inst->mid, group_target_addr);
return sret;
}
#if 0
int ssg_group_attach(
ssg_group_id_t group_id)
{
......@@ -545,6 +631,7 @@ int ssg_group_detach(
return SSG_SUCCESS;
}
#endif
/*********************************
*** SSG group access routines ***
......@@ -555,6 +642,7 @@ ssg_member_id_t ssg_get_group_self_id(
{
ssg_group_descriptor_t *group_descriptor = (ssg_group_descriptor_t *)group_id;
ssg_group_t *g;
ssg_member_id_t self_id;
if (!ssg_inst || group_id == SSG_GROUP_ID_NULL) return SSG_MEMBER_ID_INVALID;
......@@ -565,11 +653,16 @@ ssg_member_id_t ssg_get_group_self_id(
return SSG_MEMBER_ID_INVALID;
}
ABT_rwlock_rdlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (!g) return SSG_MEMBER_ID_INVALID;
if (g)
self_id = g->self_id;
else
self_id = SSG_MEMBER_ID_INVALID;
ABT_rwlock_unlock(ssg_inst->lock);
return g->self_id;
return self_id;
}
int ssg_get_group_size(
......@@ -584,6 +677,7 @@ int ssg_get_group_size(
{
ssg_group_t *g;
ABT_rwlock_rdlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (g)
......@@ -592,7 +686,9 @@ int ssg_get_group_size(
group_size = g->view.size + 1; /* add ourself to view size */
ABT_rwlock_unlock(g->lock);
}
ABT_rwlock_unlock(ssg_inst->lock);
}
#if 0
else if (group_descriptor->owner_status == SSG_OWNER_IS_ATTACHER)
{
ssg_attached_group_t *ag;
......@@ -606,6 +702,7 @@ int ssg_get_group_size(
ABT_rwlock_unlock(ag->lock);
}
}
#endif
else
{
fprintf(stderr, "Error: SSG can only obtain size of groups that the caller" \
......@@ -632,6 +729,7 @@ hg_addr_t ssg_get_addr(
{
ssg_group_t *g;
ABT_rwlock_rdlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (g)
......@@ -643,7 +741,9 @@ hg_addr_t ssg_get_addr(
member_addr = member_state->addr;
ABT_rwlock_unlock(g->lock);
}
ABT_rwlock_unlock(ssg_inst->lock);
}
#if 0
else if (group_descriptor->owner_status == SSG_OWNER_IS_ATTACHER)
{
ssg_attached_group_t *ag;
......@@ -660,6 +760,7 @@ hg_addr_t ssg_get_addr(
ABT_rwlock_unlock(ag->lock);
}
}
#endif
else
{
fprintf(stderr, "Error: SSG can only obtain member addresses of groups" \
......@@ -884,6 +985,8 @@ void ssg_group_dump(
{
ssg_group_descriptor_t *group_descriptor = (ssg_group_descriptor_t *)group_id;
ssg_group_view_t *group_view = NULL;
ABT_rwlock group_view_lock;
int group_size;
char *group_name = NULL;
char group_role[32];
char group_self_id[32];
......@@ -892,16 +995,21 @@ void ssg_group_dump(
{
ssg_group_t *g;
ABT_rwlock_rdlock(ssg_inst->lock);
HASH_FIND(hh, ssg_inst->group_table, &group_descriptor->name_hash,
sizeof(uint64_t), g);
if (g)
{
group_view = &g->view;
group_view_lock = g->lock;
group_size = g->view.size + 1;
group_name = g->name;
strcpy(group_role, "member");
sprintf(group_self_id, "%lu", g->self_id);
}
ABT_rwlock_unlock(ssg_inst->lock);
}
#if 0
else if (group_descriptor->owner_status == SSG_OWNER_IS_ATTACHER)
{
ssg_attached_group_t *ag;
......@@ -911,10 +1019,12 @@ void ssg_group_dump(
if (ag)
{
group_view = &ag->view;
group_size = ag->view.size;
group_name = ag->name;
strcpy(group_role, "attacher");
}
}
#endif
else
{
fprintf(stderr, "Error: SSG can only dump membership information for" \
......@@ -930,13 +1040,15 @@ void ssg_group_dump(
printf("\trole: '%s'\n", group_role);
if (