Skip to content

Commit f0bcb17

Browse files
committed
#ifdef ASYNC_DEBUG various sections of async.c
Submitted by: Massimo Dal Zotto <dz@cs.unitn.it>
1 parent db7a90f commit f0bcb17

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/backend/commands/async.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.8 1996/12/07 04:36:38 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.9 1996/12/19 04:54:56 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -117,13 +117,17 @@ Async_NotifyHandler(SIGNAL_ARGS)
117117
if ((CurrentTransactionState->state == TRANS_DEFAULT) &&
118118
(CurrentTransactionState->blockState == TRANS_DEFAULT)) {
119119

120+
#ifdef ASYNC_DEBUG
120121
elog(DEBUG, "Waking up sleeping backend process");
122+
#endif
121123
Async_NotifyFrontEnd();
122124

123125
}else {
126+
#ifdef ASYNC_DEBUG
124127
elog(DEBUG, "Process is in the middle of another transaction, state = %d, block state = %d",
125128
CurrentTransactionState->state,
126129
CurrentTransactionState->blockState);
130+
#endif
127131
notifyFrontEndPending = 1;
128132
}
129133
}
@@ -167,7 +171,9 @@ Async_Notify(char *relname)
167171

168172
char *notifyName;
169173

174+
#ifdef ASYNC_DEBUG
170175
elog(DEBUG,"Async_Notify: %s",relname);
176+
#endif
171177

172178
if (!pendingNotifies)
173179
pendingNotifies = DLNewList();
@@ -249,7 +255,9 @@ Async_NotifyAtCommit()
249255
if (notifyIssued) { /* 'notify <relname>' issued by us */
250256
notifyIssued = 0;
251257
StartTransactionCommand();
258+
#ifdef ASYNC_DEBUG
252259
elog(DEBUG, "Async_NotifyAtCommit.");
260+
#endif
253261
ScanKeyEntryInitialize(&key, 0,
254262
Anum_pg_listener_notify,
255263
Integer32EqualRegProcedure,
@@ -268,10 +276,14 @@ Async_NotifyAtCommit()
268276
tdesc, &isnull);
269277

270278
if (ourpid == DatumGetInt32(d)) {
279+
#ifdef ASYNC_DEBUG
271280
elog(DEBUG, "Notifying self, setting notifyFronEndPending to 1");
281+
#endif
272282
notifyFrontEndPending = 1;
273283
} else {
284+
#ifdef ASYNC_DEBUG
274285
elog(DEBUG, "Notifying others");
286+
#endif
275287
#ifndef win32
276288
if (kill(DatumGetInt32(d), SIGUSR2) < 0) {
277289
if (errno == ESRCH) {
@@ -373,7 +385,9 @@ Async_Listen(char *relname, int pid)
373385
char *relnamei;
374386
TupleDesc tupDesc;
375387

388+
#ifdef ASYNC_DEBUG
376389
elog(DEBUG,"Async_Listen: %s",relname);
390+
#endif
377391
for (i = 0 ; i < Natts_pg_listener; i++) {
378392
nulls[i] = ' ';
379393
values[i] = PointerGetDatum(NULL);
@@ -514,7 +528,9 @@ Async_NotifyFrontEnd()
514528

515529
notifyFrontEndPending = 0;
516530

531+
#ifdef ASYNC_DEBUG
517532
elog(DEBUG, "Async_NotifyFrontEnd: notifying front end.");
533+
#endif
518534

519535
StartTransactionCommand();
520536
ourpid = getpid();

0 commit comments

Comments
 (0)