@@ -296,39 +296,46 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
296296
297297 cnt = 1 ;
298298 if (PMIX_SUCCESS == (rc = pmix_bfrop .unpack (buf , & bptr , & cnt , PMIX_BUFFER ))) {
299- cnt = 1 ;
300- cur_kval = PMIX_NEW (pmix_kval_t );
301- while (PMIX_SUCCESS == (rc = pmix_bfrop .unpack (bptr , cur_kval , & cnt , PMIX_KVAL ))) {
302- pmix_output_verbose (2 , pmix_globals .debug_output ,
303- "pmix: unpacked key %s" , cur_kval -> key );
304- if (PMIX_SUCCESS != (rc = pmix_hash_store (& nptr -> modex , cur_rank , cur_kval ))) {
305- PMIX_ERROR_LOG (rc );
306- }
307- if (NULL != cb -> key && 0 == strcmp (cb -> key , cur_kval -> key )) {
299+ /* if the rank is WILDCARD, then this is an nspace blob */
300+ if (PMIX_RANK_WILDCARD == cur_rank ) {
301+ pmix_client_process_nspace_blob (cb -> nspace , bptr );
302+ } else {
303+ cnt = 1 ;
304+ cur_kval = PMIX_NEW (pmix_kval_t );
305+ while (PMIX_SUCCESS == (rc = pmix_bfrop .unpack (bptr , cur_kval , & cnt , PMIX_KVAL ))) {
308306 pmix_output_verbose (2 , pmix_globals .debug_output ,
309- "pmix: found requested value" );
310- if (PMIX_SUCCESS != (rc = pmix_bfrop . copy (( void * * ) & val , cur_kval -> value , PMIX_VALUE ))) {
307+ "pmix: unpacked key %s" , cur_kval -> key );
308+ if (PMIX_SUCCESS != (rc = pmix_hash_store ( & nptr -> modex , cur_rank , cur_kval ))) {
311309 PMIX_ERROR_LOG (rc );
312- PMIX_RELEASE (cur_kval );
313- val = NULL ;
314- goto done ;
315310 }
311+ if (NULL != cb -> key && 0 == strcmp (cb -> key , cur_kval -> key )) {
312+ pmix_output_verbose (2 , pmix_globals .debug_output ,
313+ "pmix: found requested value" );
314+ if (PMIX_SUCCESS != (rc = pmix_bfrop .copy ((void * * )& val , cur_kval -> value , PMIX_VALUE ))) {
315+ PMIX_ERROR_LOG (rc );
316+ PMIX_RELEASE (cur_kval );
317+ val = NULL ;
318+ goto done ;
319+ }
320+ }
321+ PMIX_RELEASE (cur_kval ); // maintain acctg - hash_store does a retain
322+ cnt = 1 ;
323+ cur_kval = PMIX_NEW (pmix_kval_t );
316324 }
317- PMIX_RELEASE (cur_kval ); // maintain acctg - hash_store does a retain
318325 cnt = 1 ;
319- cur_kval = PMIX_NEW ( pmix_kval_t );
326+ PMIX_RELEASE ( cur_kval );
320327 }
321- cnt = 1 ;
322- PMIX_RELEASE (cur_kval );
323328 }
324329 PMIX_RELEASE (bptr ); // free's the data region
325- if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc ) {
330+ if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
331+ PMIX_SUCCESS != rc ) {
326332 PMIX_ERROR_LOG (rc );
327333 rc = PMIX_ERR_SILENT ; // avoid error-logging twice
328334 break ;
329335 }
330336 }
331- if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc ) {
337+ if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
338+ PMIX_SUCCESS != rc ) {
332339 PMIX_ERROR_LOG (rc );
333340 } else {
334341 rc = PMIX_SUCCESS ;
@@ -409,10 +416,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
409416 goto request ;
410417 }
411418
412- /* if the key is NULL, then we have to check both the job-data
413- * and the modex tables. If we don't yet have the modex data,
414- * then we are going to have to go get it. So let's check that
415- * case first */
419+ /* The NULL==key scenario only pertains to cases where legacy
420+ * PMI methods are being employed. In this case, we have to check
421+ * both the job-data and the modex tables. If we don't yet have
422+ * the modex data, then we are going to have to go get it. So let's
423+ * check that case first */
416424 if (NULL == cb -> key ) {
417425 PMIX_CONSTRUCT (& results , pmix_pointer_array_t );
418426 pmix_pointer_array_init (& results , 2 , INT_MAX , 1 );
@@ -451,9 +459,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
451459 }
452460 } else {
453461 /* if we didn't find a modex for this rank, then we need
454- * to go get it. Recall that the NULL==key scenario only
455- * pertains to cases where legacy PMI methods are being
456- * employed. Thus, the caller wants -all- information for
462+ * to go get it. Thus, the caller wants -all- information for
457463 * the specified rank, not just the job-level info. */
458464 goto request ;
459465 }
@@ -505,43 +511,26 @@ static void _getnbfn(int fd, short flags, void *cbdata)
505511 return ;
506512 }
507513
508- /* the requested data could be in the job-data table, so let's
509- * just check there first. */
510- if (PMIX_SUCCESS == (rc = pmix_hash_fetch (& nptr -> internal , PMIX_RANK_WILDCARD , cb -> key , & val ))) {
511- /* found it - we are in an event, so we can
512- * just execute the callback */
513- cb -> value_cbfunc (rc , val , cb -> cbdata );
514- /* cleanup */
515- if (NULL != val ) {
516- PMIX_VALUE_RELEASE (val );
517- }
518- PMIX_RELEASE (cb );
519- return ;
520- }
521- if (PMIX_RANK_WILDCARD == cb -> rank ) {
522- /* can't be anywhere else */
523- cb -> value_cbfunc (PMIX_ERR_NOT_FOUND , NULL , cb -> cbdata );
524- PMIX_RELEASE (cb );
525- return ;
526- }
527-
528- /* it could still be in the job-data table, only stored under its own
529- * rank and not WILDCARD - e.g., this is true of data returned about
530- * ourselves during startup */
531- if (PMIX_SUCCESS == (rc = pmix_hash_fetch (& nptr -> internal , cb -> rank , cb -> key , & val ))) {
532- /* found it - we are in an event, so we can
533- * just execute the callback */
534- cb -> value_cbfunc (rc , val , cb -> cbdata );
535- /* cleanup */
536- if (NULL != val ) {
537- PMIX_VALUE_RELEASE (val );
514+ /* if the key is in the PMIx namespace, then they are looking for data
515+ * that was provided at startup */
516+ if (0 == strncmp (cb -> key , "pmix" , 4 )) {
517+ /* should be in the internal hash table. */
518+ if (PMIX_SUCCESS == (rc = pmix_hash_fetch (& nptr -> internal , cb -> rank , cb -> key , & val ))) {
519+ /* found it - we are in an event, so we can
520+ * just execute the callback */
521+ cb -> value_cbfunc (rc , val , cb -> cbdata );
522+ /* cleanup */
523+ if (NULL != val ) {
524+ PMIX_VALUE_RELEASE (val );
525+ }
526+ PMIX_RELEASE (cb );
527+ return ;
538528 }
539- PMIX_RELEASE ( cb );
540- return ;
529+ /* if we don't have it, go request it */
530+ goto request ;
541531 }
542532
543- /* not finding it is not an error - it could be in the
544- * modex hash table, so check it */
533+ /* otherwise, the data must be something they "put" */
545534#if defined(PMIX_ENABLE_DSTORE ) && (PMIX_ENABLE_DSTORE == 1 )
546535 if (PMIX_SUCCESS == (rc = pmix_dstore_fetch (nptr -> nspace , cb -> rank , cb -> key , & val ))) {
547536#else
@@ -606,6 +595,16 @@ static void _getnbfn(int fd, short flags, void *cbdata)
606595 }
607596 }
608597
598+ /* if we are seeking "pmix" data for our own nspace, then we must fail
599+ * as it was provided at startup - any updates would have come via
600+ * event notifications */
601+ if (0 == strncmp (cb -> key , "pmix" , 4 ) &&
602+ 0 == strncmp (cb -> nspace , pmix_globals .myid .nspace , PMIX_MAX_NSLEN )) {
603+ cb -> value_cbfunc (PMIX_ERR_NOT_FOUND , NULL , cb -> cbdata );
604+ PMIX_RELEASE (cb );
605+ return ;
606+ }
607+
609608 /* see if we already have a request in place with the server for data from
610609 * this nspace:rank. If we do, then no need to ask again as the
611610 * request will return _all_ data from that proc */
@@ -628,6 +627,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
628627 return ;
629628 }
630629
630+ pmix_output_verbose (2 , pmix_globals .debug_output ,
631+ "%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s" ,
632+ pmix_globals .myid .nspace , pmix_globals .myid .rank ,
633+ cb -> nspace , cb -> rank , cb -> key );
634+
631635 /* create a callback object as we need to pass it to the
632636 * recv routine so we know which callback to use when
633637 * the return message is recvd */
0 commit comments