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.
Этот коммит содержится в:
родитель
14ffc85379
Коммит
3b187c4db3
@ -72,7 +72,7 @@ int orte_gpr_replica_delete_entries(orte_gpr_addr_mode_t addr_mode,
|
||||
int rc;
|
||||
orte_gpr_replica_segment_t *seg=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 */
|
||||
if (NULL == segment) {
|
||||
|
@ -89,23 +89,41 @@ int orte_gpr_replica_delete_entries_fn(orte_gpr_addr_mode_t addr_mode,
|
||||
j < (orte_gpr_replica_globals.srch_cptr)->size; j++) {
|
||||
if (NULL != cptr[j]) {
|
||||
k++;
|
||||
for (i=0; i < num_keys; i++) { /* for each provided key */
|
||||
if (ORTE_SUCCESS == orte_gpr_replica_search_container(
|
||||
ORTE_GPR_REPLICA_OR,
|
||||
key_itags, 1, cptr[j])) {
|
||||
if (0 < orte_gpr_replica_globals.num_srch_ival) {
|
||||
/* found this key at least once - delete all
|
||||
* occurrences
|
||||
*/
|
||||
ivals = (orte_gpr_replica_itagval_t**)
|
||||
(orte_gpr_replica_globals.srch_ival)->addr;
|
||||
for (n=0, p=0; p < orte_gpr_replica_globals.num_srch_ival &&
|
||||
n < (orte_gpr_replica_globals.srch_ival)->size; n++) {
|
||||
if (NULL != ivals[n]) {
|
||||
p++;
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr_replica_delete_itagval(seg, cptr[j], ivals[n]))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
/* 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 */
|
||||
if (ORTE_SUCCESS == orte_gpr_replica_search_container(
|
||||
ORTE_GPR_REPLICA_OR,
|
||||
key_itags, 1, cptr[j])) {
|
||||
if (0 < orte_gpr_replica_globals.num_srch_ival) {
|
||||
/* found this key at least once - delete all
|
||||
* occurrences
|
||||
*/
|
||||
ivals = (orte_gpr_replica_itagval_t**)
|
||||
(orte_gpr_replica_globals.srch_ival)->addr;
|
||||
for (n=0, p=0; p < orte_gpr_replica_globals.num_srch_ival &&
|
||||
n < (orte_gpr_replica_globals.srch_ival)->size; n++) {
|
||||
if (NULL != ivals[n]) {
|
||||
p++;
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr_replica_delete_itagval(seg, cptr[j], ivals[n]))) {
|
||||
ORTE_ERROR_LOG(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);
|
||||
(cptr->num_itagvals)--;
|
||||
|
||||
/* if the container is now empty, remove it too */
|
||||
if (0 == cptr->num_itagvals) {
|
||||
if (ORTE_SUCCESS != (rc = orte_gpr_replica_release_container(seg, cptr))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
/* NOTE: If the container is now empty, *don't* remove it here
|
||||
* This is cause improper recursion if called from orte_gpr_replica_release_container
|
||||
*/
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -341,24 +341,28 @@ int orte_ras_base_node_delete(opal_list_t* nodes)
|
||||
{
|
||||
opal_list_item_t* item;
|
||||
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);
|
||||
item != opal_list_get_end(nodes);
|
||||
item = opal_list_get_next(nodes)) {
|
||||
orte_ras_base_node_t* node = (orte_ras_base_node_t*)item;
|
||||
char* cellid;
|
||||
char* tokens[3];
|
||||
item = opal_list_get_next(item)) {
|
||||
node = (orte_ras_base_node_t*)item;
|
||||
|
||||
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);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* setup index/keys for this node */
|
||||
tokens[0] = node->node_name;
|
||||
tokens[1] = cellid;
|
||||
tokens[2] = NULL;
|
||||
|
||||
rc = orte_gpr.delete_entries(
|
||||
ORTE_GPR_TOKENS_AND,
|
||||
ORTE_NODE_SEGMENT,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user