1
1

Fix the 'delete container' logic in gpr to prevent recursive delete of all

containers when one is requested.

Fix a bug in gpr_replica_del_index_api which doesn't preset num_tokens and
num_keys, but assumes they are 0.

Fix orte_ras_base_node_delete() function to operate properly to delete the
appropriate container in the 'orte-node' segment when requested.

This commit was SVN r6756.
Этот коммит содержится в:
Josh Hursey 2005-08-05 23:37:39 +00:00
родитель 14ffc85379
Коммит 3b187c4db3
4 изменённых файлов: 54 добавлений и 36 удалений

Просмотреть файл

@ -72,7 +72,7 @@ int orte_gpr_replica_delete_entries(orte_gpr_addr_mode_t addr_mode,
int rc; int rc;
orte_gpr_replica_segment_t *seg=NULL; orte_gpr_replica_segment_t *seg=NULL;
orte_gpr_replica_itag_t *token_itags=NULL, *key_itags=NULL; orte_gpr_replica_itag_t *token_itags=NULL, *key_itags=NULL;
size_t num_tokens, num_keys; size_t num_tokens = 0, num_keys = 0;
/* protect against errors */ /* protect against errors */
if (NULL == segment) { if (NULL == segment) {

Просмотреть файл

@ -89,6 +89,15 @@ int orte_gpr_replica_delete_entries_fn(orte_gpr_addr_mode_t addr_mode,
j < (orte_gpr_replica_globals.srch_cptr)->size; j++) { j < (orte_gpr_replica_globals.srch_cptr)->size; j++) {
if (NULL != cptr[j]) { if (NULL != cptr[j]) {
k++; k++;
/* If no keys are provided, then remove entire container */
if (0 < num_tokens && 0 == num_keys){
rc = orte_gpr_replica_release_container(seg, cptr[j]);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
else if( 0 < num_keys) {
for (i=0; i < num_keys; i++) { /* for each provided key */ for (i=0; i < num_keys; i++) { /* for each provided key */
if (ORTE_SUCCESS == orte_gpr_replica_search_container( if (ORTE_SUCCESS == orte_gpr_replica_search_container(
ORTE_GPR_REPLICA_OR, ORTE_GPR_REPLICA_OR,
@ -107,6 +116,15 @@ int orte_gpr_replica_delete_entries_fn(orte_gpr_addr_mode_t addr_mode,
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
if ( 0 == ((cptr[j])->itagvals)->size) {
/* If container is empty, remove it */
rc = orte_gpr_replica_release_container(seg, cptr[j]);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc);
return rc;
}
}
}
} }
} }
} }

Просмотреть файл

@ -221,13 +221,9 @@ MOVEON:
orte_pointer_array_set_item(cptr->itagvals, i, NULL); orte_pointer_array_set_item(cptr->itagvals, i, NULL);
(cptr->num_itagvals)--; (cptr->num_itagvals)--;
/* if the container is now empty, remove it too */ /* NOTE: If the container is now empty, *don't* remove it here
if (0 == cptr->num_itagvals) { * This is cause improper recursion if called from orte_gpr_replica_release_container
if (ORTE_SUCCESS != (rc = orte_gpr_replica_release_container(seg, cptr))) { */
ORTE_ERROR_LOG(rc);
return rc;
}
}
return ORTE_SUCCESS; return ORTE_SUCCESS;
} }

Просмотреть файл

@ -341,24 +341,28 @@ int orte_ras_base_node_delete(opal_list_t* nodes)
{ {
opal_list_item_t* item; opal_list_item_t* item;
int rc; int rc;
size_t num_values, num_tokens;
orte_ras_base_node_t* node;
char** tokens;
num_values = opal_list_get_size(nodes);
if (0 >= num_values) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
for(item = opal_list_get_first(nodes); for(item = opal_list_get_first(nodes);
item != opal_list_get_end(nodes); item != opal_list_get_end(nodes);
item = opal_list_get_next(nodes)) { item = opal_list_get_next(item)) {
orte_ras_base_node_t* node = (orte_ras_base_node_t*)item; node = (orte_ras_base_node_t*)item;
char* cellid;
char* tokens[3];
if(ORTE_SUCCESS != (rc = orte_ns.convert_cellid_to_string(&cellid, node->node_cellid))) { /* setup index/keys for this node */
rc = orte_schema.get_node_tokens(&tokens, &num_tokens, node->node_cellid, node->node_name);
if (ORTE_SUCCESS != rc) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }
/* setup index/keys for this node */
tokens[0] = node->node_name;
tokens[1] = cellid;
tokens[2] = NULL;
rc = orte_gpr.delete_entries( rc = orte_gpr.delete_entries(
ORTE_GPR_TOKENS_AND, ORTE_GPR_TOKENS_AND,
ORTE_NODE_SEGMENT, ORTE_NODE_SEGMENT,