2004-07-19 04:47:16 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* pgarch.h
|
|
|
|
* Exports from postmaster/pgarch.c.
|
|
|
|
*
|
2024-01-04 02:49:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
2004-07-19 04:47:16 +02:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/postmaster/pgarch.h
|
2004-07-19 04:47:16 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef _PGARCH_H
|
|
|
|
#define _PGARCH_H
|
|
|
|
|
2014-01-28 18:58:22 +01:00
|
|
|
/* ----------
|
|
|
|
* Archiver control info.
|
|
|
|
*
|
2016-10-20 17:24:37 +02:00
|
|
|
* We expect that archivable files within pg_wal will have names between
|
2014-01-28 18:58:22 +01:00
|
|
|
* MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters
|
|
|
|
* appearing in VALID_XFN_CHARS. The status files in archive_status have
|
|
|
|
* corresponding names with ".ready" or ".done" appended.
|
|
|
|
* ----------
|
|
|
|
*/
|
|
|
|
#define MIN_XFN_CHARS 16
|
|
|
|
#define MAX_XFN_CHARS 40
|
At promotion, archive last segment from old timeline with .partial suffix.
Previously, we would archive the possible-incomplete WAL segment with its
normal filename, but that causes trouble if the server owning that timeline
is still running, and tries to archive the same segment later. It's not nice
for the standby to trip up the master's archival like that. And it's pretty
confusing, anyway, to have an incomplete segment in the archive that's
indistinguishable from a normal, complete segment.
To avoid such confusion, add a .partial suffix to the file. Or to be more
precise, make a copy of the old segment under the .partial suffix, and
archive that instead of the original file. pg_receivexlog also uses the
.partial suffix for the same purpose, to tell apart incompletely streamed
files from complete ones.
There is no automatic mechanism to use the .partial files at recovery, so
they will go unused, unless the administrator manually copies to them to
the pg_xlog directory (and removes the .partial suffix). Recovery won't
normally need the WAL - when recovering to the new timeline, it will find
the same WAL on the first segment on the new timeline instead - but it
nevertheless feels better to archive the file with the .partial suffix, for
debugging purposes if nothing else.
2015-05-08 20:59:01 +02:00
|
|
|
#define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial"
|
2014-01-28 18:58:22 +01:00
|
|
|
|
Make archiver process an auxiliary process.
This commit changes WAL archiver process so that it's treated as
an auxiliary process and can use shared memory. This is an infrastructure
patch required for upcoming shared-memory based stats collector patch
series. These patch series basically need any processes including archiver
that can report the statistics to access to shared memory. Since this patch
itself is useful to simplify the code and when users monitor the status of
archiver, it's committed separately in advance.
This commit simplifies the code for WAL archiving. For example, previously
backends need to signal to archiver via postmaster when they notify
archiver that there are some WAL files to archive. On the other hand,
this commit removes that signal to postmaster and enables backends to
notify archier directly using shared latch.
Also, as the side of this change, the information about archiver process
becomes viewable at pg_stat_activity view.
Author: Kyotaro Horiguchi
Reviewed-by: Andres Freund, Álvaro Herrera, Julien Rouhaud, Tomas Vondra, Arthur Zakirov, Fujii Masao
Discussion: https://postgr.es/m/20180629.173418.190173462.horiguchi.kyotaro@lab.ntt.co.jp
2021-03-15 05:13:14 +01:00
|
|
|
extern Size PgArchShmemSize(void);
|
|
|
|
extern void PgArchShmemInit(void);
|
|
|
|
extern bool PgArchCanRestart(void);
|
2024-03-18 10:35:08 +01:00
|
|
|
extern void PgArchiverMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn();
|
Make archiver process an auxiliary process.
This commit changes WAL archiver process so that it's treated as
an auxiliary process and can use shared memory. This is an infrastructure
patch required for upcoming shared-memory based stats collector patch
series. These patch series basically need any processes including archiver
that can report the statistics to access to shared memory. Since this patch
itself is useful to simplify the code and when users monitor the status of
archiver, it's committed separately in advance.
This commit simplifies the code for WAL archiving. For example, previously
backends need to signal to archiver via postmaster when they notify
archiver that there are some WAL files to archive. On the other hand,
this commit removes that signal to postmaster and enables backends to
notify archier directly using shared latch.
Also, as the side of this change, the information about archiver process
becomes viewable at pg_stat_activity view.
Author: Kyotaro Horiguchi
Reviewed-by: Andres Freund, Álvaro Herrera, Julien Rouhaud, Tomas Vondra, Arthur Zakirov, Fujii Masao
Discussion: https://postgr.es/m/20180629.173418.190173462.horiguchi.kyotaro@lab.ntt.co.jp
2021-03-15 05:13:14 +01:00
|
|
|
extern void PgArchWakeup(void);
|
2021-11-11 21:02:53 +01:00
|
|
|
extern void PgArchForceDirScan(void);
|
2004-07-19 04:47:16 +02:00
|
|
|
|
|
|
|
#endif /* _PGARCH_H */
|