pgsql: Change StatementCancelHandler() to check the DoingCommandRead - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Change StatementCancelHandler() to check the DoingCommandRead
Date
Msg-id 20080126195508.AB0B4754108@cvs.postgresql.org
Whole thread Raw
List 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)

pgsql-committers by date:

Previous
From: h-saito@pgfoundry.org (User H-saito)
Date:
Subject: psqlodbc - psqlodbc: Fix problem disable of USE_SSL.
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Minor editorial improvements in documentation of