As with base backups, the easiest way to produce a standalone
hot backup is to use the <xref linkend="app-pgbasebackup">
tool. If you include the <literal>-X</> parameter when calling
- it, all the transaction log required to use the backup will be
+ it, all the write-ahead log required to use the backup will be
included in the backup automatically, and no special action is
required to restore the backup.
</para>
to the primary or upstream standby, where it can be seen using the
<link linkend="monitoring-stats-views-table">
<literal>pg_stat_replication</></link> view. The standby will report
- the last transaction log position it has written, the last position it
+ the last write-ahead log position it has written, the last position it
has flushed to disk, and the last position it has applied.
This parameter's
value is the maximum interval, in seconds, between reports. Updates are
<literal><function>pg_current_wal_flush_lsn()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Get current transaction log flush location</entry>
+ <entry>Get current write-ahead log flush location</entry>
</row>
<row>
<entry>
<literal><function>pg_current_wal_insert_lsn()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Get current transaction log insert location</entry>
+ <entry>Get current write-ahead log insert location</entry>
</row>
<row>
<entry>
<literal><function>pg_current_wal_lsn()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Get current transaction log write location</entry>
+ <entry>Get current write-ahead log write location</entry>
</row>
<row>
<entry>
<literal><function>pg_switch_wal()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Force switch to a new transaction log file (restricted to superusers by default, but other users can be granted EXECUTE to run the function)</entry>
+ <entry>Force switch to a new write-ahead log file (restricted to superusers by default, but other users can be granted EXECUTE to run the function)</entry>
</row>
<row>
<entry>
<literal><function>pg_walfile_name(<parameter>lsn</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>text</type></entry>
- <entry>Convert transaction log location to file name</entry>
+ <entry>Convert write-ahead log location to file name</entry>
</row>
<row>
<entry>
<literal><function>pg_walfile_name_offset(<parameter>lsn</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>text</>, <type>integer</></entry>
- <entry>Convert transaction log location to file name and decimal byte offset within file</entry>
+ <entry>Convert write-ahead log location to file name and decimal byte offset within file</entry>
</row>
<row>
<entry>
<literal><function>pg_wal_lsn_diff(<parameter>lsn</> <type>pg_lsn</>, <parameter>lsn</> <type>pg_lsn</>)</function></literal>
</entry>
<entry><type>numeric</></entry>
- <entry>Calculate the difference between two transaction log locations</entry>
+ <entry>Calculate the difference between two write-ahead log locations</entry>
</row>
</tbody>
</tgroup>
backup label file (<filename>backup_label</>) and, if there are any links
in the <filename>pg_tblspc/</> directory, a tablespace map file
(<filename>tablespace_map</>) into the database cluster's data directory,
- performs a checkpoint, and then returns the backup's starting transaction
+ performs a checkpoint, and then returns the backup's starting write-ahead
log location as text. The user can ignore this result value, but it is
provided in case it is useful. When used in non-exclusive mode, the
contents of these files are instead returned by the
</para>
<para>
- The function also creates a backup history file in the transaction log
+ The function also creates a backup history file in the write-ahead log
archive area. The history file includes the label given to
- <function>pg_start_backup</>, the starting and ending transaction log locations for
+ <function>pg_start_backup</>, the starting and ending write-ahead log locations for
the backup, and the starting and ending times of the backup. The return
- value is the backup's ending transaction log location (which again
+ value is the backup's ending write-ahead log location (which again
can be ignored). After recording the ending location, the current
- transaction log insertion
- point is automatically advanced to the next transaction log file, so that the
- ending transaction log file can be archived immediately to complete the backup.
+ write-ahead log insertion
+ point is automatically advanced to the next write-ahead log file, so that the
+ ending write-ahead log file can be archived immediately to complete the backup.
</para>
<para>
- <function>pg_switch_wal</> moves to the next transaction log file, allowing the
+ <function>pg_switch_wal</> moves to the next write-ahead log file, allowing the
current file to be archived (assuming you are using continuous archiving).
- The return value is the ending transaction log location + 1 within the just-completed transaction log file.
- If there has been no transaction log activity since the last transaction log switch,
+ The return value is the ending write-ahead log location + 1 within the just-completed write-ahead log file.
+ If there has been no write-ahead log activity since the last write-ahead log switch,
<function>pg_switch_wal</> does nothing and returns the start location
- of the transaction log file currently in use.
+ of the write-ahead log file currently in use.
</para>
<para>
- <function>pg_create_restore_point</> creates a named transaction log
+ <function>pg_create_restore_point</> creates a named write-ahead log
record that can be used as recovery target, and returns the corresponding
- transaction log location. The given name can then be used with
+ write-ahead log location. The given name can then be used with
<xref linkend="recovery-target-name"> to specify the point up to which
recovery will proceed. Avoid creating multiple restore points with the
same name, since recovery will stop at the first one whose name matches
</para>
<para>
- <function>pg_current_wal_lsn</> displays the current transaction log write
+ <function>pg_current_wal_lsn</> displays the current write-ahead log write
location in the same format used by the above functions. Similarly,
- <function>pg_current_wal_insert_lsn</> displays the current transaction log
+ <function>pg_current_wal_insert_lsn</> displays the current write-ahead log
insertion location and <function>pg_current_wal_flush_lsn</> displays the
- current transaction log flush location. The insertion location is the <quote>logical</>
+ current write-ahead log flush location. The insertion location is the <quote>logical</>
end of the transaction log at any instant, while the write location is the end of
what has actually been written out from the server's internal buffers and flush
location is the location guaranteed to be written to durable storage. The write
location is the end of what can be examined from outside the server, and is usually
- what you want if you are interested in archiving partially-complete transaction log
+ what you want if you are interested in archiving partially-complete write-ahead log
files. The insertion and flush locations are made available primarily for server
debugging purposes. These are both read-only operations and do not
require superuser permissions.
<para>
You can use <function>pg_walfile_name_offset</> to extract the
- corresponding transaction log file name and byte offset from the results of any of the
+ corresponding write-ahead log file name and byte offset from the results of any of the
above functions. For example:
<programlisting>
postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
00000001000000000000000D | 4039624
(1 row)
</programlisting>
- Similarly, <function>pg_walfile_name</> extracts just the transaction log file name.
- When the given transaction log location is exactly at a transaction log file boundary, both
- these functions return the name of the preceding transaction log file.
- This is usually the desired behavior for managing transaction log archiving
+ Similarly, <function>pg_walfile_name</> extracts just the write-ahead log file name.
+ When the given write-ahead log location is exactly at a write-ahead log file boundary, both
+ these functions return the name of the preceding write-ahead log file.
+ This is usually the desired behavior for managing write-ahead log archiving
behavior, since the preceding file is the last one that currently
needs to be archived.
</para>
<para>
<function>pg_wal_lsn_diff</> calculates the difference in bytes
- between two transaction log locations. It can be used with
+ between two write-ahead log locations. It can be used with
<structname>pg_stat_replication</structname> or some functions shown in
<xref linkend="functions-admin-backup-table"> to get the replication lag.
</para>
<literal><function>pg_last_wal_receive_lsn()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Get last transaction log location received and synced to disk by
+ <entry>Get last write-ahead log location received and synced to disk by
streaming replication. While streaming replication is in progress
this will increase monotonically. If recovery has completed this will
remain static at
<literal><function>pg_last_wal_replay_lsn()</function></literal>
</entry>
<entry><type>pg_lsn</type></entry>
- <entry>Get last transaction log location replayed during recovery.
+ <entry>Get last write-ahead log location replayed during recovery.
If recovery is still in progress this will increase monotonically.
If recovery has completed then this value will remain static at
the value of the last WAL record applied during that recovery.
</varlistentry>
<varlistentry>
- <term>Transaction Log Shipping</term>
+ <term>Write-Ahead Log Shipping</term>
<listitem>
<para>
<entry>Feature</entry>
<entry>Shared Disk Failover</entry>
<entry>File System Replication</entry>
- <entry>Transaction Log Shipping</entry>
+ <entry>Write-Ahead Log Shipping</entry>
<entry>Trigger-Based Master-Standby Replication</entry>
<entry>Statement-Based Replication Middleware</entry>
<entry>Asynchronous Multimaster Replication</entry>
<para>
When requesting synchronous replication, each commit of a
write transaction will wait until confirmation is
- received that the commit has been written to the transaction log on disk
+ received that the commit has been written to the write-ahead log on disk
of both the primary and standby server. The only possibility that data
can be lost is if both the primary and the standby suffer crashes at the
same time. This can provide a much higher level of durability, though only
</row>
<row>
<entry><literal>CLogTruncationLock</></entry>
- <entry>Waiting to truncate the transaction log or waiting for transaction log truncation to finish.</entry>
+ <entry>Waiting to truncate the write-ahead log or waiting for write-ahead log truncation to finish.</entry>
</row>
<row>
<entry><literal>clog</></entry>
<row>
<entry><structfield>sent_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log location sent on this connection</entry>
+ <entry>Last write-ahead log location sent on this connection</entry>
</row>
<row>
<entry><structfield>write_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log location written to disk by this standby
+ <entry>Last write-ahead log location written to disk by this standby
server</entry>
</row>
<row>
<entry><structfield>flush_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log location flushed to disk by this standby
+ <entry>Last write-ahead log location flushed to disk by this standby
server</entry>
</row>
<row>
<entry><structfield>replay_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log location replayed into the database on this
+ <entry>Last write-ahead log location replayed into the database on this
standby server</entry>
</row>
<row>
<row>
<entry><structfield>receive_start_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>First transaction log position used when WAL receiver is
+ <entry>First write-ahead log position used when WAL receiver is
started</entry>
</row>
<row>
<row>
<entry><structfield>received_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log position already received and flushed to
+ <entry>Last write-ahead log position already received and flushed to
disk, the initial value of this field being the first log position used
when WAL receiver is started</entry>
</row>
<row>
<entry><structfield>received_tli</></entry>
<entry><type>integer</></entry>
- <entry>Timeline number of last transaction log position received and
+ <entry>Timeline number of last write-ahead log position received and
flushed to disk, the initial value of this field being the timeline
number of the first log position used when WAL receiver is started
</entry>
<row>
<entry><structfield>latest_end_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log position reported to origin WAL sender</entry>
+ <entry>Last write-ahead log position reported to origin WAL sender</entry>
</row>
<row>
<entry><structfield>latest_end_time</></entry>
<entry><type>timestamp with time zone</></entry>
- <entry>Time of last transaction log position reported to origin WAL sender</entry>
+ <entry>Time of last write-ahead log position reported to origin WAL sender</entry>
</row>
<row>
<entry><structfield>slot_name</></entry>
<row>
<entry><structfield>received_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log position received, the initial value of
+ <entry>Last write-ahead log position received, the initial value of
this field being 0</entry>
</row>
<row>
<row>
<entry><structfield>latest_end_lsn</></entry>
<entry><type>pg_lsn</></entry>
- <entry>Last transaction log position reported to origin WAL sender
+ <entry>Last write-ahead log position reported to origin WAL sender
</entry>
</row>
<row>
<entry><structfield>latest_end_time</></entry>
<entry><type>timestamp with time zone</></entry>
- <entry>Time of last transaction log position reported to origin WAL
+ <entry>Time of last write-ahead log position reported to origin WAL
sender</entry>
</row>
</tbody>
<listitem>
<para>
Current WAL flush location. Useful to get a known location in the
- transaction log where streaming can start.
+ write-ahead log where streaming can start.
</para>
</listitem>
</varlistentry>
</term>
<listitem>
<para>
- This parameter specifies the LSN of the transaction log location up
+ This parameter specifies the LSN of the write-ahead log location up
to which recovery will proceed. The precise stopping point is also
influenced by <xref linkend="recovery-target-inclusive">. This
parameter is parsed using the system data type
<refnamediv>
<refname>CHECKPOINT</refname>
- <refpurpose>force a transaction log checkpoint</refpurpose>
+ <refpurpose>force a write-ahead log checkpoint</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Description</title>
<para>
- A checkpoint is a point in the transaction log sequence at which
+ A checkpoint is a point in the write-ahead log sequence at which
all data files have been updated to reflect the information in the
log. All data files will be flushed to disk. Refer to
<xref linkend="wal-configuration"> for more details about what happens
<term><option>--waldir=<replaceable class="parameter">directory</replaceable></option></term>
<listitem>
<para>
- This option specifies the directory where the transaction log
+ This option specifies the directory where the write-ahead log
should be stored.
</para>
</listitem>
target directory, the tar contents will be written to
standard output, suitable for piping to for example
<productname>gzip</productname>. This is only possible if
- the cluster has no additional tablespaces and transaction
- log streaming is not used.
+ the cluster has no additional tablespaces and WAL
+ streaming is not used.
</para>
</listitem>
</varlistentry>
<term><option>--waldir=<replaceable class="parameter">waldir</replaceable></option></term>
<listitem>
<para>
- Specifies the location for the transaction log directory.
+ Specifies the location for the write-ahead log directory.
<replaceable>waldir</replaceable> must be an absolute path.
- The transaction log directory can only be specified when
+ The write-ahead log directory can only be specified when
the backup is in plain mode.
</para>
</listitem>
<term><option>--wal-method=<replaceable class="parameter">method</replaceable></option></term>
<listitem>
<para>
- Includes the required transaction log files (WAL files) in the
- backup. This will include all transaction logs generated during
+ Includes the required write-ahead log files (WAL files) in the
+ backup. This will include all write-ahead logs generated during
the backup. Unless the method <literal>none</literal> is specified,
it is possible to start a postmaster directly in the extracted
directory without the need to consult the log archive, thus
making this a completely standalone backup.
</para>
<para>
- The following methods for collecting the transaction logs are
+ The following methods for collecting the write-ahead logs are
supported:
<variablelist>
<term><literal>none</literal></term>
<listitem>
<para>
- Don't include transaction log in the backup.
+ Don't include write-ahead log in the backup.
</para>
</listitem>
</varlistentry>
<term><literal>fetch</literal></term>
<listitem>
<para>
- The transaction log files are collected at the end of the backup.
+ The write-ahead log files are collected at the end of the backup.
Therefore, it is necessary for the
<xref linkend="guc-wal-keep-segments"> parameter to be set high
enough that the log is not removed before the end of the backup.
backup will fail and be unusable.
</para>
<para>
- The transaction log files will be written to
+ The write-ahead log files will be written to
the <filename>base.tar</filename> file.
</para>
</listitem>
<term><literal>stream</literal></term>
<listitem>
<para>
- Stream the transaction log while the backup is created. This will
+ Stream the write-ahead log while the backup is created. This will
open a second connection to the server and start streaming the
- transaction log in parallel while running the backup. Therefore,
+ write-ahead log in parallel while running the backup. Therefore,
it will use up two connections configured by the
<xref linkend="guc-max-wal-senders"> parameter. As long as the
- client can keep up with transaction log received, using this mode
- requires no extra transaction logs to be saved on the master.
+ client can keep up with write-ahead log received, using this mode
+ requires no extra write-ahead logs to be saved on the master.
</para>
<para>
- The transaction log files are written to a separate file
+ The write-ahead log files are written to a separate file
named <filename>pg_wal.tar</filename> (if the server is a version
earlier than 10, the file will be named <filename>pg_xlog.tar</filename>).
</para>
By default, when <command>pg_basebackup</command> aborts with an
error, it removes any directories it might have created before
discovering that it cannot finish the job (for example, data directory
- and transaction log directory). This option inhibits tidying-up and is
+ and write-ahead log directory). This option inhibits tidying-up and is
thus useful for debugging.
</para>
<refnamediv>
<refname>pg_receivewal</refname>
- <refpurpose>stream transaction logs from a <productname>PostgreSQL</productname> server</refpurpose>
+ <refpurpose>stream write-ahead logs from a <productname>PostgreSQL</productname> server</refpurpose>
</refnamediv>
<refsynopsisdiv>
Description
</title>
<para>
- <application>pg_receivewal</application> is used to stream the transaction log
- from a running <productname>PostgreSQL</productname> cluster. The transaction
+ <application>pg_receivewal</application> is used to stream the write-ahead log
+ from a running <productname>PostgreSQL</productname> cluster. The write-ahead
log is streamed using the streaming replication protocol, and is written
to a local directory of files. This directory can be used as the archive
location for doing a restore using point-in-time recovery (see
</para>
<para>
- <application>pg_receivewal</application> streams the transaction
+ <application>pg_receivewal</application> streams the write-ahead
log in real time as it's being generated on the server, and does not wait
for segments to complete like <xref linkend="guc-archive-command"> does.
For this reason, it is not necessary to set
</para>
<para>
- The transaction log is streamed over a regular
+ The write-ahead log is streamed over a regular
<productname>PostgreSQL</productname> connection and uses the replication
protocol. The connection must be made with a superuser or a user
having <literal>REPLICATION</literal> permissions (see
<term><option>--compress=<replaceable class="parameter">level</replaceable></option></term>
<listitem>
<para>
- Enables gzip compression of transaction logs, and specifies the
+ Enables gzip compression of write-ahead logs, and specifies the
compression level (0 through 9, 0 being no compression and 9 being best
compression). The suffix <filename>.gz</filename> will
automatically be added to all filenames.
When using <application>pg_receivewal</application> instead of
<xref linkend="guc-archive-command"> as the main WAL backup method, it is
strongly recommended to use replication slots. Otherwise, the server is
- free to recycle or remove transaction log files before they are backed up,
+ free to recycle or remove write-ahead log files before they are backed up,
because it does not have any information, either
from <xref linkend="guc-archive-command"> or the replication slots, about
how far the WAL stream has been archived. Note, however, that a
<title>Examples</title>
<para>
- To stream the transaction log from the server at
+ To stream the write-ahead log from the server at
<literal>mydbserver</literal> and store it in the local directory
<filename>/usr/local/pgsql/archive</filename>:
<screen>
<term><option>--log-prefix=<replaceable>prefix</></option></term>
<listitem>
<para>
- Set the filename prefix for the transaction log files created by
+ Set the filename prefix for the log files created by
<option>--log</>. The default is <literal>pgbench_log</>.
</para>
</listitem>
problem. However, differences shown by
<application>pg_test_fsync</application> might not make any significant
difference in real database throughput, especially since many database servers
- are not speed-limited by their transaction logs.
+ are not speed-limited by their write-ahead logs.
<application>pg_test_fsync</application> reports average file sync operation
time in microseconds for each <literal>wal_sync_method</literal>, which can also be used to
inform efforts to optimize the value of <xref linkend="guc-commit-delay">.
2016-12-21 [ecbdc4c55] Forbid invalid combination of options in pg_basebackup.
-->
<para>
- Allow <application>pg_basebackup</> to stream transaction log in
+ Allow <application>pg_basebackup</> to stream write-ahead log in
tar mode (Magnus Hagander)
</para>
if (nfields != 3)
ereport(FATAL,
(errmsg("syntax error in history file: %s", fline),
- errhint("Expected a transaction log switchpoint location.")));
+ errhint("Expected a write-ahead log switchpoint location.")));
if (result && tli <= lasttli)
ereport(FATAL,
/*-------------------------------------------------------------------------
*
* transam.c
- * postgres transaction log interface routines
+ * postgres transaction (commit) log interface routines
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
/*-------------------------------------------------------------------------
*
* xlog.c
- * PostgreSQL transaction log manager
+ * PostgreSQL write-ahead log manager
*
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
if (fd < 0)
ereport(PANIC,
(errcode_for_file_access(),
- errmsg("could not open transaction log file \"%s\": %m", path)));
+ errmsg("could not open write-ahead log file \"%s\": %m", path)));
return fd;
}
if (xldir == NULL)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not open transaction log directory \"%s\": %m",
+ errmsg("could not open write-ahead log directory \"%s\": %m",
XLOGDIR)));
/*
if (xldir == NULL)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not open transaction log directory \"%s\": %m",
+ errmsg("could not open write-ahead log directory \"%s\": %m",
XLOGDIR)));
/*
true, recycleSegNo, true))
{
ereport(DEBUG2,
- (errmsg("recycled transaction log file \"%s\"",
+ (errmsg("recycled write-ahead log file \"%s\"",
segname)));
CheckpointStats.ckpt_segs_recycled++;
/* Needn't recheck that slot on future iterations */
int rc;
ereport(DEBUG2,
- (errmsg("removing transaction log file \"%s\"",
+ (errmsg("removing write-ahead log file \"%s\"",
segname)));
#ifdef WIN32
{
ereport(LOG,
(errcode_for_file_access(),
- errmsg("could not rename old transaction log file \"%s\": %m",
+ errmsg("could not rename old write-ahead log file \"%s\": %m",
path)));
return;
}
if (xldir == NULL)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not open transaction log directory \"%s\": %m",
+ errmsg("could not open write-ahead log directory \"%s\": %m",
XLOGDIR)));
while ((xlde = ReadDir(xldir, XLOGDIR)) != NULL)
{
if (XLogArchiveCheckDone(xlde->d_name))
{
- ereport(DEBUG2,
- (errmsg("removing transaction log backup history file \"%s\"",
- xlde->d_name)));
+ elog(DEBUG2, "removing WAL backup history file \"%s\"",
+ xlde->d_name);
snprintf(path, sizeof(path), XLOGDIR "/%s", xlde->d_name);
unlink(path);
XLogArchiveCleanup(xlde->d_name);
errno = ENOSPC;
ereport(PANIC,
(errcode_for_file_access(),
- errmsg("could not write bootstrap transaction log file: %m")));
+ errmsg("could not write bootstrap write-ahead log file: %m")));
}
pgstat_report_wait_end();
if (pg_fsync(openLogFile) != 0)
ereport(PANIC,
(errcode_for_file_access(),
- errmsg("could not fsync bootstrap transaction log file: %m")));
+ errmsg("could not fsync bootstrap write-ahead log file: %m")));
pgstat_report_wait_end();
if (close(openLogFile))
ereport(PANIC,
(errcode_for_file_access(),
- errmsg("could not close bootstrap transaction log file: %m")));
+ errmsg("could not close bootstrap write-ahead log file: %m")));
openLogFile = -1;
average_usecs = average_sync_time - (uint64) average_secs *1000000;
elog(LOG, "%s complete: wrote %d buffers (%.1f%%); "
- "%d transaction log file(s) added, %d removed, %d recycled; "
+ "%d WAL file(s) added, %d removed, %d recycled; "
"write=%ld.%03d s, sync=%ld.%03d s, total=%ld.%03d s; "
"sync files=%d, longest=%ld.%03d s, average=%ld.%03d s; "
"distance=%d kB, estimate=%d kB",
*/
if (shutdown && checkPoint.redo != ProcLastRecPtr)
ereport(PANIC,
- (errmsg("concurrent transaction log activity while database system is shutting down")));
+ (errmsg("concurrent write-ahead log activity while database system is shutting down")));
/*
* Remember the prior checkpoint's redo pointer, used later to determine
*
* xlogfuncs.c
*
- * PostgreSQL transaction log manager user interface functions
+ * PostgreSQL write-ahead log manager user interface functions
*
* This file contains WAL control and information functions.
*
*
* xlogutils.c
*
- * PostgreSQL transaction log manager utility routines
+ * PostgreSQL write-ahead log manager utility routines
*
* This file contains support routines that are used by XLOG replay functions.
* None of this code is used during normal system operation.
* assume nothing happened.
*/
if ((switchpoint % XLogSegSize) != 0)
- ereport(DEBUG1,
- (errmsg("transaction log switch forced (archive_timeout=%d)",
- XLogArchiveTimeout)));
+ elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+ XLogArchiveTimeout);
}
/*
if (++failures >= NUM_ARCHIVE_RETRIES)
{
ereport(WARNING,
- (errmsg("archiving transaction log file \"%s\" failed too many times, will try again later",
+ (errmsg("archiving write-ahead log file \"%s\" failed too many times, will try again later",
xlog)));
return; /* give up archiving for now */
}
return false;
}
- ereport(DEBUG1,
- (errmsg("archived transaction log file \"%s\"", xlog)));
+ elog(DEBUG1, "archived write-ahead log file \"%s\"", xlog);
snprintf(activitymsg, sizeof(activitymsg), "last was %s", xlog);
set_ps_display(activitymsg, false);
{
/*
* Send SIGUSR1 to archiver process, to wake it up and begin archiving
- * next transaction log file.
+ * next WAL file.
*/
signal_child(PgArchPID, SIGUSR1);
}
if (made_new_xlogdir)
{
- fprintf(stderr, _("%s: removing transaction log directory \"%s\"\n"),
+ fprintf(stderr, _("%s: removing WAL directory \"%s\"\n"),
progname, xlog_dir);
if (!rmtree(xlog_dir, true))
- fprintf(stderr, _("%s: failed to remove transaction log directory\n"),
+ fprintf(stderr, _("%s: failed to remove WAL directory\n"),
progname);
}
else if (found_existing_xlogdir)
{
fprintf(stderr,
- _("%s: removing contents of transaction log directory \"%s\"\n"),
+ _("%s: removing contents of WAL directory \"%s\"\n"),
progname, xlog_dir);
if (!rmtree(xlog_dir, false))
- fprintf(stderr, _("%s: failed to remove contents of transaction log directory\n"),
+ fprintf(stderr, _("%s: failed to remove contents of WAL directory\n"),
progname);
}
/* otherwise died during startup, do nothing! */
if (made_new_xlogdir || found_existing_xlogdir)
fprintf(stderr,
- _("%s: transaction log directory \"%s\" not removed at user's request\n"),
+ _("%s: WAL directory \"%s\" not removed at user's request\n"),
progname, xlog_dir);
}
}
-/* Create transaction log directory, and symlink if required */
+/* Create WAL directory, and symlink if required */
void
create_xlog_or_symlink(void)
{
canonicalize_path(xlog_dir);
if (!is_absolute_path(xlog_dir))
{
- fprintf(stderr, _("%s: transaction log directory location must be an absolute path\n"), progname);
+ fprintf(stderr, _("%s: WAL directory location must be an absolute path\n"), progname);
exit_nicely();
}
warn_on_mount_point(ret);
else
fprintf(stderr,
- _("If you want to store the transaction log there, either\n"
- "remove or empty the directory \"%s\".\n"),
+ _("If you want to store the WAL there, either remove or empty the directory\n"
+ "\"%s\".\n"),
xlog_dir);
exit_nicely();
if (made_new_xlogdir)
{
- fprintf(stderr, _("%s: removing transaction log directory \"%s\"\n"),
+ fprintf(stderr, _("%s: removing WAL directory \"%s\"\n"),
progname, xlog_dir);
if (!rmtree(xlog_dir, true))
- fprintf(stderr, _("%s: failed to remove transaction log directory\n"),
+ fprintf(stderr, _("%s: failed to remove WAL directory\n"),
progname);
}
else if (found_existing_xlogdir)
{
fprintf(stderr,
- _("%s: removing contents of transaction log directory \"%s\"\n"),
+ _("%s: removing contents of WAL directory \"%s\"\n"),
progname, xlog_dir);
if (!rmtree(xlog_dir, false))
- fprintf(stderr, _("%s: failed to remove contents of transaction log directory\n"),
+ fprintf(stderr, _("%s: failed to remove contents of WAL directory\n"),
progname);
}
}
if (made_new_xlogdir || found_existing_xlogdir)
fprintf(stderr,
- _("%s: transaction log directory \"%s\" not removed at user's request\n"),
+ _("%s: WAL directory \"%s\" not removed at user's request\n"),
progname, xlog_dir);
}
" relocate tablespace in OLDDIR to NEWDIR\n"));
printf(_(" -X, --wal-method=none|fetch|stream\n"
" include required WAL files with specified method\n"));
- printf(_(" --waldir=WALDIR location for the transaction log directory\n"));
+ printf(_(" --waldir=WALDIR location for the write-ahead log directory\n"));
printf(_(" -z, --gzip compress tar output\n"));
printf(_(" -Z, --compress=0-9 compress tar output with given compression level\n"));
printf(_("\nGeneral options:\n"));
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
{
fprintf(stderr,
- _("%s: could not parse transaction log location \"%s\"\n"),
+ _("%s: could not parse write-ahead log location \"%s\"\n"),
progname, xlogend);
exit(1);
}
if (sscanf(startpos, "%X/%X", &hi, &lo) != 2)
{
fprintf(stderr,
- _("%s: could not parse transaction log location \"%s\"\n"),
+ _("%s: could not parse write-ahead log location \"%s\"\n"),
progname, startpos);
disconnect_and_exit(1);
}
/*
* When streaming WAL, pg_wal (or pg_xlog for pre-9.6
* clusters) will have been created by the wal receiver
- * process. Also, when transaction log directory location
+ * process. Also, when the WAL directory location
* was specified, pg_wal (or pg_xlog) has already been
* created as a symbolic link before starting the actual
* backup. So just ignore creation failures on related
MemSet(xlogend, 0, sizeof(xlogend));
if (verbose && includewal != NO_WAL)
- fprintf(stderr, _("%s: transaction log start point: %s on timeline %u\n"),
+ fprintf(stderr, _("%s: write-ahead log start point: %s on timeline %u\n"),
progname, xlogstart, starttli);
/*
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr,
- _("%s: could not get transaction log end position from server: %s"),
+ _("%s: could not get write-ahead log end position from server: %s"),
progname, PQerrorMessage(conn));
disconnect_and_exit(1);
}
if (PQntuples(res) != 1)
{
fprintf(stderr,
- _("%s: no transaction log end position returned from server\n"),
+ _("%s: no write-ahead log end position returned from server\n"),
progname);
disconnect_and_exit(1);
}
strlcpy(xlogend, PQgetvalue(res, 0, 0), sizeof(xlogend));
if (verbose && includewal != NO_WAL)
- fprintf(stderr, _("%s: transaction log end point: %s\n"), progname, xlogend);
+ fprintf(stderr, _("%s: write-ahead log end point: %s\n"), progname, xlogend);
PQclear(res);
res = PQgetResult(conn);
if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
{
fprintf(stderr,
- _("%s: could not parse transaction log location \"%s\"\n"),
+ _("%s: could not parse write-ahead log location \"%s\"\n"),
progname, xlogend);
disconnect_and_exit(1);
}
if (format == 't' && includewal == STREAM_WAL && strcmp(basedir, "-") == 0)
{
fprintf(stderr,
- _("%s: cannot stream transaction logs in tar mode to stdout\n"),
+ _("%s: cannot stream write-ahead logs in tar mode to stdout\n"),
progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
if (format != 'p')
{
fprintf(stderr,
- _("%s: transaction log directory location can only be specified in plain mode\n"),
+ _("%s: WAL directory location can only be specified in plain mode\n"),
progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
canonicalize_path(xlog_dir);
if (!is_absolute_path(xlog_dir))
{
- fprintf(stderr, _("%s: transaction log directory location must be "
+ fprintf(stderr, _("%s: WAL directory location must be "
"an absolute path\n"), progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
exit(1);
}
- /* Create transaction log symlink, if required */
+ /* Create pg_wal symlink, if required */
if (strcmp(xlog_dir, "") != 0)
{
char *linkloc;
/*-------------------------------------------------------------------------
*
- * pg_receivewal.c - receive streaming transaction log data and write it
+ * pg_receivewal.c - receive streaming WAL data and write it
* to a local file.
*
* Author: Magnus Hagander <magnus@hagander.net>
static void
usage(void)
{
- printf(_("%s receives PostgreSQL streaming transaction logs.\n\n"),
+ printf(_("%s receives PostgreSQL streaming write-ahead logs.\n\n"),
progname);
printf(_("Usage:\n"));
printf(_(" %s [OPTION]...\n"), progname);
printf(_("\nOptions:\n"));
- printf(_(" -D, --directory=DIR receive transaction log files into this directory\n"));
+ printf(_(" -D, --directory=DIR receive write-ahead log files into this directory\n"));
printf(_(" --if-not-exists do not error if slot already exists when creating a slot\n"));
printf(_(" -n, --no-loop do not loop on connection lost\n"));
printf(_(" -s, --status-interval=SECS\n"
" time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
printf(_(" -S, --slot=SLOTNAME replication slot to use\n"));
- printf(_(" --synchronous flush transaction log immediately after writing\n"));
+ printf(_(" --synchronous flush write-ahead log immediately after writing\n"));
printf(_(" -v, --verbose output verbose messages\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -Z, --compress=0-9 compress logs with given compression level\n"));
/*-------------------------------------------------------------------------
*
- * receivelog.c - receive transaction log files using the streaming
+ * receivelog.c - receive WAL files using the streaming
* replication protocol.
*
* Author: Magnus Hagander <magnus@hagander.net>
if (size < 0)
{
fprintf(stderr,
- _("%s: could not get size of transaction log file \"%s\": %s\n"),
+ _("%s: could not get size of write-ahead log file \"%s\": %s\n"),
progname, fn, stream->walmethod->getlasterror());
return false;
}
if (f == NULL)
{
fprintf(stderr,
- _("%s: could not open existing transaction log file \"%s\": %s\n"),
+ _("%s: could not open existing write-ahead log file \"%s\": %s\n"),
progname, fn, stream->walmethod->getlasterror());
return false;
}
if (stream->walmethod->sync(f) != 0)
{
fprintf(stderr,
- _("%s: could not sync existing transaction log file \"%s\": %s\n"),
+ _("%s: could not sync existing write-ahead log file \"%s\": %s\n"),
progname, fn, stream->walmethod->getlasterror());
stream->walmethod->close(f, CLOSE_UNLINK);
return false;
if (errno == 0)
errno = ENOSPC;
fprintf(stderr,
- _("%s: transaction log file \"%s\" has %d bytes, should be 0 or %d\n"),
+ _("%s: write-ahead log file \"%s\" has %d bytes, should be 0 or %d\n"),
progname, fn, (int) size, XLogSegSize);
return false;
}
if (f == NULL)
{
fprintf(stderr,
- _("%s: could not open transaction log file \"%s\": %s\n"),
+ _("%s: could not open write-ahead log file \"%s\": %s\n"),
progname, fn, stream->walmethod->getlasterror());
return false;
}
if (xlogoff != 0)
{
fprintf(stderr,
- _("%s: received transaction log record for offset %u with no file open\n"),
+ _("%s: received write-ahead log record for offset %u with no file open\n"),
progname, xlogoff);
return false;
}
if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2)
{
fprintf(stderr,
- _("%s: could not parse transaction log location \"%s\"\n"),
+ _("%s: could not parse write-ahead log location \"%s\"\n"),
progname, PQgetvalue(res, 0, 2));
PQclear(res);
if (ControlFile.state != DB_SHUTDOWNED && !force)
{
printf(_("The database server was not shut down cleanly.\n"
- "Resetting the transaction log might cause data to be lost.\n"
+ "Resetting the write-ahead log might cause data to be lost.\n"
"If you want to proceed anyway, use -f to force reset.\n"));
exit(1);
}
KillExistingArchiveStatus();
WriteEmptyXLOG();
- printf(_("Transaction log reset\n"));
+ printf(_("Write-ahead log reset\n"));
return 0;
}
static void
usage(void)
{
- printf(_("%s resets the PostgreSQL transaction log.\n\n"), progname);
+ printf(_("%s resets the PostgreSQL write-ahead log.\n\n"), progname);
printf(_("Usage:\n %s [OPTION]... DATADIR\n\n"), progname);
printf(_("Options:\n"));
printf(_(" -c XID,XID set oldest and newest transactions bearing commit timestamp\n"));
printf(_(" [-D] DATADIR data directory\n"));
printf(_(" -e XIDEPOCH set next transaction ID epoch\n"));
printf(_(" -f force update to be done\n"));
- printf(_(" -l XLOGFILE force minimum WAL starting location for new transaction log\n"));
+ printf(_(" -l WALFILE force minimum WAL starting location for new write-ahead log\n"));
printf(_(" -m MXID,MXID set next and oldest multitransaction ID\n"));
printf(_(" -n no update, just show what would be done (for testing)\n"));
printf(_(" -o OID set next OID\n"));
if (nfields != 3)
{
fprintf(stderr, _("syntax error in history file: %s\n"), fline);
- fprintf(stderr, _("Expected a transaction log switchpoint location.\n"));
+ fprintf(stderr, _("Expected a write-ahead log switchpoint location.\n"));
exit(1);
}
if (entries && tli <= lasttli)
static void
usage(void)
{
- printf(_("%s decodes and displays PostgreSQL transaction logs for debugging.\n\n"),
+ printf(_("%s decodes and displays PostgreSQL write-ahead logs for debugging.\n\n"),
progname);
printf(_("Usage:\n"));
printf(_(" %s [OPTION]... [STARTSEG [ENDSEG]]\n"), progname);
/*
* xlog.h
*
- * PostgreSQL transaction log manager
+ * PostgreSQL write-ahead log manager
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
/*
* xlog_internal.h
*
- * PostgreSQL transaction log internal declarations
+ * PostgreSQL write-ahead log internal declarations
*
* NOTE: this file is intended to contain declarations useful for
* manipulating the XLOG files directly, but it is not supposed to be
/*
* xlogdefs.h
*
- * Postgres transaction log manager record pointer and
+ * Postgres write-ahead log manager record pointer and
* timeline number definitions
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
=item $node->backup(backup_name)
Create a hot backup with B<pg_basebackup> in subdirectory B<backup_name> of
-B<< $node->backup_dir >>, including the transaction logs. Transaction logs are
+B<< $node->backup_dir >>, including the WAL. WAL files
fetched at the end of the backup, not streamed.
You'll have to configure a suitable B<max_wal_senders> on the
=item $node->backup_fs_hot(backup_name)
Create a backup with a filesystem level copy in subdirectory B<backup_name> of
-B<< $node->backup_dir >>, including transaction logs.
+B<< $node->backup_dir >>, including WAL.
Archiving must be enabled, as B<pg_start_backup()> and B<pg_stop_backup()> are
used. This is not checked or enforced.
=item $node->backup_fs_cold(backup_name)
Create a backup with a filesystem level copy in subdirectory B<backup_name> of
-B<< $node->backup_dir >>, including transaction logs. The server must be
+B<< $node->backup_dir >>, including WAL. The server must be
stopped as no attempt to handle concurrent writes is made.
Use B<backup> or B<backup_fs_hot> if you want to back up a running server.