Hi, Following the discussion here http://archives.postgresql.org/message-id/49d9e986.8010...@pse-consulting.de , I wrote a small patch which rotates the last XLog file on shutdown so that the archive command is also executed for this file and we are sure we have all the useful XLog files when we perform a clean shutdown of master + switch to the failover server. This rotation is done only if the archive mode is active and an archive command is set.
It's currently really difficult to switch easily (ie without copying the file manually) to the failover server without any data loss. Is there any problem I've missed? Could we consider the inclusion of such a patch or something similar? Comments? Regards, -- Guillaume
Index: src/backend/access/transam/xlog.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v retrieving revision 1.335 diff -c -r1.335 xlog.c *** src/backend/access/transam/xlog.c 7 Apr 2009 00:31:26 -0000 1.335 --- src/backend/access/transam/xlog.c 8 Apr 2009 13:18:40 -0000 *************** *** 5950,5956 **** --- 5950,5965 ---- if (RecoveryInProgress()) CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE); else + { CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE); + /* + * if archiving is active and an archive command is set, we need to + * rotate the last XLog file containing useful information so that + * the archive command is also executed for it + */ + if(XLogArchivingActive() && XLogArchiveCommandSet()) + RequestXLogSwitch(); + } ShutdownCLOG(); ShutdownSUBTRANS(); ShutdownMultiXact();
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers