File tree 1 file changed +25
-10
lines changed
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)
438
438
439
439
if (request == HISTORY_REQUEST || request == PROFILE_REQUEST )
440
440
{
441
+ shm_mq_result mq_result ;
442
+
441
443
/* Send history or profile */
442
444
shm_mq_set_sender (collector_mq , MyProc );
443
445
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 )
446
448
{
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);
455
470
}
456
471
shm_mq_detach_compat (mqh , collector_mq );
457
472
}
You can’t perform that action at this time.
0 commit comments