pgsql: Repair two places where SIGTERM exit could leave shared memory

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Repair two places where SIGTERM exit could leave shared memory
Date: 2008-04-16 23:59:40
Message-ID: 20080416235940.9E08A7559CC@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Repair two places where SIGTERM exit could leave shared memory state
corrupted. (Neither is very important if SIGTERM is used to shut down the
whole database cluster together, but there's a problem if someone tries to
SIGTERM individual backends.) To do this, introduce new infrastructure
macros PG_ENSURE_ERROR_CLEANUP/PG_END_ENSURE_ERROR_CLEANUP that take care
of transiently pushing an on_shmem_exit cleanup hook. Also use this method
for createdb cleanup --- that wasn't a shared-memory-corruption problem,
but SIGTERM abort of createdb could leave orphaned files lying around.

Backpatch as far as 8.2. The shmem corruption cases don't exist in 8.1,
and the createdb usage doesn't seem important enough to risk backpatching
further.

Modified Files:
--------------
pgsql/src/backend/access/nbtree:
nbtree.c (r1.158 -> r1.159)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtree.c?r1=1.158&r2=1.159)
nbtutils.c (r1.88 -> r1.89)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtutils.c?r1=1.88&r2=1.89)
pgsql/src/backend/access/transam:
xlog.c (r1.296 -> r1.297)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlog.c?r1=1.296&r2=1.297)
pgsql/src/backend/commands:
dbcommands.c (r1.205 -> r1.206)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/dbcommands.c?r1=1.205&r2=1.206)
pgsql/src/backend/port:
ipc_test.c (r1.24 -> r1.25)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/ipc_test.c?r1=1.24&r2=1.25)
pgsql/src/backend/storage/ipc:
ipc.c (r1.100 -> r1.101)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/ipc/ipc.c?r1=1.100&r2=1.101)
pgsql/src/include/access:
nbtree.h (r1.117 -> r1.118)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/nbtree.h?r1=1.117&r2=1.118)
pgsql/src/include/storage:
ipc.h (r1.74 -> r1.75)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/ipc.h?r1=1.74&r2=1.75)
pgsql/src/include/utils:
elog.h (r1.92 -> r1.93)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/elog.h?r1=1.92&r2=1.93)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-04-16 23:59:51 pgsql: Repair two places where SIGTERM exit could leave shared memory
Previous Message Andrew Dunstan 2008-04-16 22:16:00 pgsql: Fix MinGW warnings re formats and unused variables.

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-04-17 00:08:46 Re: Lessons from commit fest
Previous Message Alvaro Herrera 2008-04-16 23:53:56 Re: printTable API (was: Show INHERIT in \du)