mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-15 19:06:59 +08:00
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.
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pgarch.h
|
|
* Exports from postmaster/pgarch.c.
|
|
*
|
|
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/postmaster/pgarch.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef _PGARCH_H
|
|
#define _PGARCH_H
|
|
|
|
/* ----------
|
|
* Archiver control info.
|
|
*
|
|
* We expect that archivable files within pg_xlog will have names between
|
|
* 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
|
|
#define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial"
|
|
|
|
/* ----------
|
|
* Functions called from postmaster
|
|
* ----------
|
|
*/
|
|
extern int pgarch_start(void);
|
|
|
|
#ifdef EXEC_BACKEND
|
|
extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn();
|
|
#endif
|
|
|
|
#endif /* _PGARCH_H */
|