*** async.c.8.3.5 2009-01-28 12:25:11.966356419 -0500 --- async.c 2009-01-28 12:26:51.955740151 -0500 *************** *** 101,107 **** #include "utils/fmgroids.h" #include "utils/memutils.h" #include "utils/ps_status.h" ! /* * State for pending LISTEN/UNLISTEN actions consists of an ordered list of --- 101,107 ---- #include "utils/fmgroids.h" #include "utils/memutils.h" #include "utils/ps_status.h" ! #include "storage/procarray.h" /* * State for pending LISTEN/UNLISTEN actions consists of an ordered list of *************** *** 628,633 **** --- 628,634 ---- } else { + int listenerExists = 1; if (Trace_notify) elog(DEBUG1, "AtCommit_Notify: notifying pid %d", listenerPID); *************** *** 649,657 **** * we should just do it for any failure (certainly at least * for EPERM too...) */ ! simple_heap_delete(lRel, &lTuple->t_self); } ! else if (listener->notification == 0) { /* Rewrite the tuple with my PID in notification column */ rTuple = heap_modifytuple(lTuple, tdesc, value, nulls, repl); --- 650,670 ---- * we should just do it for any failure (certainly at least * for EPERM too...) */ ! if (IsBackendPid(listenerPID)) ! { ! elog(LOG, "kill(%d) SIGUSR2 failed, but process is running: %m", ! listenerPID); ! } ! else ! { ! elog(LOG, "kill(%d) SIGUSR2 failed, process is NOT running: %m", ! listenerPID); ! listenerExists = 0; ! simple_heap_delete(lRel, &lTuple->t_self); ! } } ! ! if (listenerExists && listener->notification == 0) { /* Rewrite the tuple with my PID in notification column */ rTuple = heap_modifytuple(lTuple, tdesc, value, nulls, repl);