pgsql: Avoid throwing ERROR during WAL replay of DROP TABLESPACE. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid throwing ERROR during WAL replay of DROP TABLESPACE.
Date
Msg-id E1RuUUf-00075j-Kq@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Avoid throwing ERROR during WAL replay of DROP TABLESPACE.

Although we will not even issue an XLOG_TBLSPC_DROP WAL record unless
removal of the tablespace's directories succeeds, that does not guarantee
that the same operation will succeed during WAL replay.  Foreseeable
reasons for it to fail include temp files created in the tablespace by Hot
Standby backends, wrong directory permissions on a standby server, etc etc.
The original coding threw ERROR if replay failed to remove the directories,
but that is a serious overreaction.  Throwing an error aborts recovery,
and worse means that manual intervention will be needed to get the database
to start again, since otherwise the same error will recur on subsequent
attempts to replay the same WAL record.  And the consequence of failing to
remove the directories is only that some probably-small amount of disk
space is wasted, so it hardly seems justified to throw an error.
Accordingly, arrange to report such failures as LOG messages and keep going
when a failure occurs during replay.

Back-patch to 9.0 where Hot Standby was introduced.  In principle such
problems can occur in earlier releases, but Hot Standby increases the odds
of trouble significantly.  Given the lack of field reports of such issues,
I'm satisfied with patching back as far as the patch applies easily.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5fc78efcec01fd5e857278556ad4312ae94ecc58

Modified Files
--------------
src/backend/commands/tablespace.c |   65 ++++++++++++++++++++++++++----------
1 files changed, 47 insertions(+), 18 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid throwing ERROR during WAL replay of DROP TABLESPACE.
Next
From: Tom Lane
Date:
Subject: pgsql: Avoid throwing ERROR during WAL replay of DROP TABLESPACE.