pg_archive_bypass

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема pg_archive_bypass
Дата
Msg-id 87631lc2zf.fsf@hi-media-techno.com
обсуждение исходный текст
Ответы Re: pg_archive_bypass  (Simon Riggs <simon@2ndQuadrant.com>)
Re: pg_archive_bypass  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Re: pg_archive_bypass  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Hi,

I tend to consider it a bug that there's no known way under windows to
use the same trick as under Unix by using '/usr/bin/true' as your
archive command. And this Unix trick itself does feel like a hack.

Also I'd very much like to be able to recommend (even if not change the
official defaults) to setup wal_level to archive, archive_mode=on and
archive_command=pg_archive_bypass, so that the day you have a HA budget
ain't the day you're going to restart the server to enable the fault
tolerance settings…

So please find attached a very simple "let's see about it" patch to
implement an internal archive_command that just returns true and is
called pg_archive_bypass. It's missing documentation, which I'll provide
if needed (meaning there's some will to consider applying such a patch).

Regards,
--
dim

*** a/src/backend/postmaster/pgarch.c
--- b/src/backend/postmaster/pgarch.c
***************
*** 475,481 **** pgarch_ArchiverCopyLoop(void)
  /*
   * pgarch_archiveXlog
   *
!  * Invokes system(3) to copy one archive file to wherever it should go
   *
   * Returns true if successful
   */
--- 475,485 ----
  /*
   * pgarch_archiveXlog
   *
!  * Invokes system(3) to copy one archive file to wherever it should go, or
!  * just return true if set to the internal command "pg_archive_bypass". That
!  * allows windows users to easily have the "/usr/bin/true", and that allows
!  * for setting up a archiving only when you need it by changing the command
!  * and issuing a reload.
   *
   * Returns true if successful
   */
***************
*** 490,495 **** pgarch_archiveXlog(char *xlog)
--- 494,509 ----
      const char *sp;
      int            rc;

+     /*
+      * If the command is "pg_archive_bypass", just return true
+      */
+     if( strcmp(XLogArchiveCommand, "pg_archive_bypass") == 0 )
+     {
+         ereport(DEBUG3,
+                 (errmsg_internal("bypassing archive command")));
+         return true;
+     }
+
      snprintf(pathname, MAXPGPATH, XLOGDIR "/%s", xlog);

      /*

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: Command to prune archive at restartpoints
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_dump(all) --quote-all-identifiers