pgsql: Change StatementCancelHandler() to check the DoingCommandRead

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Change StatementCancelHandler() to check the DoingCommandRead
Date: 2008-01-26 19:55:08
Message-ID: 20080126195508.AB0B4754108@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Change StatementCancelHandler() to check the DoingCommandRead flag to decide
whether to execute an immediate interrupt, rather than testing whether
LockWaitCancel() cancelled a lock wait. The old way misclassified the case
where we were blocked in ProcWaitForSignal(), and arguably would misclassify
any other future additions of new ImmediateInterruptOK states too. This
allows reverting the old kluge that gave LockWaitCancel() a return value,
since no callers care anymore. Improve comments in the various
implementations of PGSemaphoreLock() to explain that on some platforms, the
assumption that semop() exits after a signal is wrong, and so we must ensure
that the signal handler itself throws elog if we want cancel or die interrupts
to be effective. Per testing related to bug #3883, though this patch doesn't
solve those problems fully.

Perhaps this change should be back-patched, but since pre-8.3 branches aren't
really relying on autovacuum to respond to SIGINT, it doesn't seem critical
for them.

Modified Files:
--------------
pgsql/src/backend/port:
posix_sema.c (r1.19 -> r1.20)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/posix_sema.c?r1=1.19&r2=1.20)
sysv_sema.c (r1.22 -> r1.23)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/sysv_sema.c?r1=1.22&r2=1.23)
win32_sema.c (r1.6 -> r1.7)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32_sema.c?r1=1.6&r2=1.7)
pgsql/src/backend/storage/lmgr:
proc.c (r1.198 -> r1.199)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/lmgr/proc.c?r1=1.198&r2=1.199)
pgsql/src/backend/tcop:
postgres.c (r1.541 -> r1.542)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/postgres.c?r1=1.541&r2=1.542)
pgsql/src/include/storage:
proc.h (r1.103 -> r1.104)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/proc.h?r1=1.103&r2=1.104)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-01-27 19:12:28 pgsql: Minor editorial improvements in documentation of
Previous Message User H-saito 2008-01-26 13:49:27 psqlodbc - psqlodbc: Fix problem disable of USE_SSL.