File tree Expand file tree Collapse file tree 1 file changed +25
-10
lines changed Expand file tree Collapse file tree 1 file changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -438,20 +438,35 @@ collector_main(Datum main_arg)
438438
439439 if (request == HISTORY_REQUEST || request == PROFILE_REQUEST )
440440 {
441+ shm_mq_result mq_result ;
442+
441443 /* Send history or profile */
442444 shm_mq_set_sender (collector_mq , MyProc );
443445 mqh = shm_mq_attach (collector_mq , NULL , NULL );
444- shm_mq_wait_for_attach (mqh );
445- if ( shm_mq_get_receiver ( collector_mq ) != NULL )
446+ mq_result = shm_mq_wait_for_attach (mqh );
447+ switch ( mq_result )
446448 {
447- if (request == HISTORY_REQUEST )
448- {
449- send_history (& observations , mqh );
450- }
451- else if (request == PROFILE_REQUEST )
452- {
453- send_profile (profile_hash , mqh );
454- }
449+ case SHM_MQ_SUCCESS :
450+ switch (request )
451+ {
452+ case HISTORY_REQUEST :
453+ send_history (& observations , mqh );
454+ break ;
455+ case PROFILE_REQUEST :
456+ send_profile (profile_hash , mqh );
457+ break ;
458+ default :
459+ AssertState (false);
460+ }
461+ break ;
462+ case SHM_MQ_DETACHED :
463+ ereport (WARNING ,
464+ (errmsg ("pg_wait_sampling collector: "
465+ "receiver of message queue have been "
466+ "detached" )));
467+ break ;
468+ default :
469+ AssertState (false);
455470 }
456471 shm_mq_detach_compat (mqh , collector_mq );
457472 }
You can’t perform that action at this time.
0 commit comments