Commit f82ec32a authored by Robert Haas's avatar Robert Haas

Rename "pg_xlog" directory to "pg_wal".

"xlog" is not a particularly clear abbreviation for "write-ahead log",
and it sometimes confuses users into believe that the contents of the
"pg_xlog" directory are not critical data, leading to unpleasant
consequences.  So, rename the directory to "pg_wal".

This patch modifies pg_upgrade and pg_basebackup to understand both
the old and new directory layouts; the former is necessary given the
purpose of the tool, while the latter merely avoids an unnecessary
backward-compatibility break.

We may wish to consider renaming other programs, switches, and
functions which still use the old "xlog" naming to also refer to
"wal".  However, that's still under discussion, so let's do just this
much for now.

Discussion: CAB7nPqTeC-8+zux8_-4ZD46V7YPwooeFxgndfsq5Rg8ibLVm1A@mail.gmail.com

Michael Paquier
parent ec7db2b4
...@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data ...@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para> <para>
At all times, <productname>PostgreSQL</> maintains a At all times, <productname>PostgreSQL</> maintains a
<firstterm>write ahead log</> (WAL) in the <filename>pg_xlog/</> <firstterm>write ahead log</> (WAL) in the <filename>pg_wal/</>
subdirectory of the cluster's data directory. The log records subdirectory of the cluster's data directory. The log records
every change made to the database's data files. This log exists every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the primarily for crash-safety purposes: if the system crashes, the
...@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows ...@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced, <literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this: the actual command executed might look like this:
<programlisting> <programlisting>
test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065 test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting> </programlisting>
A similar command will be generated for each new file to be archived. A similar command will be generated for each new file to be archived.
</para> </para>
...@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/ ...@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/
fills, nothing further can be archived until the tape is swapped. fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator You should ensure that any error condition or request to a human operator
is reported appropriately so that the situation can be is reported appropriately so that the situation can be
resolved reasonably quickly. The <filename>pg_xlog/</> directory will resolved reasonably quickly. The <filename>pg_wal/</> directory will
continue to fill with WAL segment files until the situation is resolved. continue to fill with WAL segment files until the situation is resolved.
(If the file system containing <filename>pg_xlog/</> fills up, (If the file system containing <filename>pg_wal/</> fills up,
<productname>PostgreSQL</> will do a PANIC shutdown. No committed <productname>PostgreSQL</> will do a PANIC shutdown. No committed
transactions will be lost, but the database will remain offline until transactions will be lost, but the database will remain offline until
you free some space.) you free some space.)
...@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/ ...@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/
operation continues even if the archiving process falls a little behind. operation continues even if the archiving process falls a little behind.
If archiving falls significantly behind, this will increase the amount of If archiving falls significantly behind, this will increase the amount of
data that would be lost in the event of a disaster. It will also mean that data that would be lost in the event of a disaster. It will also mean that
the <filename>pg_xlog/</> directory will contain large numbers of the <filename>pg_wal/</> directory will contain large numbers of
not-yet-archived segment files, which could eventually exceed available not-yet-archived segment files, which could eventually exceed available
disk space. You are advised to monitor the archiving process to ensure that disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend. it is working as you intend.
...@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/ ...@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving, configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty one way to do it is to set <varname>archive_command</> to the empty
string (<literal>''</>). string (<literal>''</>).
This will cause WAL files to accumulate in <filename>pg_xlog/</> until a This will cause WAL files to accumulate in <filename>pg_wal/</> until a
working <varname>archive_command</> is re-established. working <varname>archive_command</> is re-established.
</para> </para>
</sect2> </sect2>
...@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup(); ...@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para> <para>
You should, however, omit from the backup the files within the You should, however, omit from the backup the files within the
cluster's <filename>pg_xlog/</> subdirectory. This cluster's <filename>pg_wal/</> subdirectory. This
slight adjustment is worthwhile because it reduces the risk slight adjustment is worthwhile because it reduces the risk
of mistakes when restoring. This is easy to arrange if of mistakes when restoring. This is easy to arrange if
<filename>pg_xlog/</> is a symbolic link pointing to someplace outside <filename>pg_wal/</> is a symbolic link pointing to someplace outside
the cluster directory, which is a common setup anyway for performance the cluster directory, which is a common setup anyway for performance
reasons. You might also want to exclude <filename>postmaster.pid</> reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information and <filename>postmaster.opts</>, which record information
...@@ -1149,7 +1149,7 @@ SELECT pg_stop_backup(); ...@@ -1149,7 +1149,7 @@ SELECT pg_stop_backup();
location in case you need them later. Note that this precaution will location in case you need them later. Note that this precaution will
require that you have enough free space on your system to hold two require that you have enough free space on your system to hold two
copies of your existing database. If you do not have enough space, copies of your existing database. If you do not have enough space,
you should at least save the contents of the cluster's <filename>pg_xlog</> you should at least save the contents of the cluster's <filename>pg_wal</>
subdirectory, as it might contain logs which subdirectory, as it might contain logs which
were not archived before the system went down. were not archived before the system went down.
</para> </para>
...@@ -1172,9 +1172,9 @@ SELECT pg_stop_backup(); ...@@ -1172,9 +1172,9 @@ SELECT pg_stop_backup();
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Remove any files present in <filename>pg_xlog/</>; these came from the Remove any files present in <filename>pg_wal/</>; these came from the
file system backup and are therefore probably obsolete rather than current. file system backup and are therefore probably obsolete rather than current.
If you didn't archive <filename>pg_xlog/</> at all, then recreate If you didn't archive <filename>pg_wal/</> at all, then recreate
it with proper permissions, it with proper permissions,
being careful to ensure that you re-establish it as a symbolic link being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before. if you had it set up that way before.
...@@ -1183,7 +1183,7 @@ SELECT pg_stop_backup(); ...@@ -1183,7 +1183,7 @@ SELECT pg_stop_backup();
<listitem> <listitem>
<para> <para>
If you have unarchived WAL segment files that you saved in step 2, If you have unarchived WAL segment files that you saved in step 2,
copy them into <filename>pg_xlog/</>. (It is best to copy them, copy them into <filename>pg_wal/</>. (It is best to copy them,
not move them, so you still have the unmodified files if a not move them, so you still have the unmodified files if a
problem occurs and you have to start over.) problem occurs and you have to start over.)
</para> </para>
...@@ -1265,9 +1265,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p' ...@@ -1265,9 +1265,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para> <para>
WAL segments that cannot be found in the archive will be sought in WAL segments that cannot be found in the archive will be sought in
<filename>pg_xlog/</>; this allows use of recent un-archived segments. <filename>pg_wal/</>; this allows use of recent un-archived segments.
However, segments that are available from the archive will be used in However, segments that are available from the archive will be used in
preference to files in <filename>pg_xlog/</>. preference to files in <filename>pg_wal/</>.
</para> </para>
<para> <para>
......
...@@ -2932,7 +2932,7 @@ include_dir 'conf.d' ...@@ -2932,7 +2932,7 @@ include_dir 'conf.d'
<listitem> <listitem>
<para> <para>
Specifies the minimum number of past log file segments kept in the Specifies the minimum number of past log file segments kept in the
<filename>pg_xlog</> <filename>pg_wal</>
directory, in case a standby server needs to fetch them for streaming directory, in case a standby server needs to fetch them for streaming
replication. Each segment is normally 16 megabytes. If a standby replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than server connected to the sending server falls behind by more than
...@@ -2946,7 +2946,7 @@ include_dir 'conf.d' ...@@ -2946,7 +2946,7 @@ include_dir 'conf.d'
<para> <para>
This sets only the minimum number of segments retained in This sets only the minimum number of segments retained in
<filename>pg_xlog</>; the system might need to retain more segments <filename>pg_wal</>; the system might need to retain more segments
for WAL archival or to recover from a checkpoint. If for WAL archival or to recover from a checkpoint. If
<varname>wal_keep_segments</> is zero (the default), the system <varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number doesn't keep any extra segments for standby purposes, so the number
...@@ -3322,7 +3322,7 @@ include_dir 'conf.d' ...@@ -3322,7 +3322,7 @@ include_dir 'conf.d'
<para> <para>
Specify how long the standby server should wait when WAL data is not Specify how long the standby server should wait when WAL data is not
available from any sources (streaming replication, available from any sources (streaming replication,
local <filename>pg_xlog</> or WAL archive) before retrying to local <filename>pg_wal</> or WAL archive) before retrying to
retrieve WAL data. This parameter can only be set in the retrieve WAL data. This parameter can only be set in the
<filename>postgresql.conf</> file or on the server command line. <filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified. The default value is 5 seconds. Units are milliseconds if not specified.
......
...@@ -15327,7 +15327,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n); ...@@ -15327,7 +15327,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13 pg_snapshots | 13
pg_multixact | 14 pg_multixact | 14
PG_VERSION | 15 PG_VERSION | 15
pg_xlog | 16 pg_wal | 16
pg_hba.conf | 17 pg_hba.conf | 17
pg_stat_tmp | 18 pg_stat_tmp | 18
pg_subtrans | 19 pg_subtrans | 19
......
...@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order. ...@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master (see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will over a TCP connection (streaming replication). The standby server will
also attempt to restore any WAL found in the standby cluster's also attempt to restore any WAL found in the standby cluster's
<filename>pg_xlog</> directory. That typically happens after a server <filename>pg_wal</> directory. That typically happens after a server
restart, when the standby replays again WAL that was streamed from the restart, when the standby replays again WAL that was streamed from the
master before the restart, but you can also manually copy files to master before the restart, but you can also manually copy files to
<filename>pg_xlog</> at any time to have them replayed. <filename>pg_wal</> at any time to have them replayed.
</para> </para>
<para> <para>
At startup, the standby begins by restoring all WAL available in the At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it archive location, calling <varname>restore_command</>. Once it
reaches the end of WAL available there and <varname>restore_command</> reaches the end of WAL available there and <varname>restore_command</>
fails, it tries to restore any WAL available in the <filename>pg_xlog</> directory. fails, it tries to restore any WAL available in the <filename>pg_wal</> directory.
If that fails, and streaming replication has been configured, the If that fails, and streaming replication has been configured, the
standby tries to connect to the primary server and start streaming WAL standby tries to connect to the primary server and start streaming WAL
from the last valid record found in archive or <filename>pg_xlog</>. If that fails from the last valid record found in archive or <filename>pg_wal</>. If that fails
or streaming replication is not configured, or if the connection is or streaming replication is not configured, or if the connection is
later disconnected, the standby goes back to step 1 and tries to later disconnected, the standby goes back to step 1 and tries to
restore the file from the archive again. This loop of retries from the restore the file from the archive again. This loop of retries from the
archive, <filename>pg_xlog</>, and via streaming replication goes on until the server archive, <filename>pg_wal</>, and via streaming replication goes on until the server
is stopped or failover is triggered by a trigger file. is stopped or failover is triggered by a trigger file.
</para> </para>
...@@ -619,7 +619,7 @@ protocol to make nodes agree on a serializable transactional order. ...@@ -619,7 +619,7 @@ protocol to make nodes agree on a serializable transactional order.
Standby mode is exited and the server switches to normal operation Standby mode is exited and the server switches to normal operation
when <command>pg_ctl promote</> is run or a trigger file is found when <command>pg_ctl promote</> is run or a trigger file is found
(<varname>trigger_file</>). Before failover, (<varname>trigger_file</>). Before failover,
any WAL immediately available in the archive or in <filename>pg_xlog</> will be any WAL immediately available in the archive or in <filename>pg_wal</> will be
restored, but no attempt is made to connect to the master. restored, but no attempt is made to connect to the master.
</para> </para>
</sect2> </sect2>
...@@ -895,7 +895,7 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' ...@@ -895,7 +895,7 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass'
However, these methods often result in retaining more WAL segments than However, these methods often result in retaining more WAL segments than
required, whereas replication slots retain only the number of segments required, whereas replication slots retain only the number of segments
known to be needed. An advantage of these methods is that they bound known to be needed. An advantage of these methods is that they bound
the space requirement for <literal>pg_xlog</>; there is currently no way the space requirement for <literal>pg_wal</>; there is currently no way
to do this using replication slots. to do this using replication slots.
</para> </para>
<para> <para>
......
...@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; ...@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of of checkpoints, but increases the storage requirements of
<filename>/pg_xlog</>. <filename>/pg_wal</>.
</para> </para>
</listitem> </listitem>
......
...@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are: ...@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para> <para>
Include the necessary WAL segments in the backup. This will include Include the necessary WAL segments in the backup. This will include
all the files between start and stop backup in the all the files between start and stop backup in the
<filename>pg_xlog</filename> directory of the base directory tar <filename>pg_wal</filename> directory of the base directory tar
file. file.
</para> </para>
</listitem> </listitem>
...@@ -2076,8 +2076,8 @@ The commands accepted in walsender mode are: ...@@ -2076,8 +2076,8 @@ The commands accepted in walsender mode are:
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<filename>pg_xlog</>, including subdirectories. If the backup is run <filename>pg_wal</>, including subdirectories. If the backup is run
with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be with WAL files included, a synthesized version of <filename>pg_wal</filename> will be
included, but it will only contain the files necessary for the included, but it will only contain the files necessary for the
backup to work, not the rest of the contents. backup to work, not the rest of the contents.
</para> </para>
......
...@@ -173,22 +173,22 @@ PostgreSQL documentation ...@@ -173,22 +173,22 @@ PostgreSQL documentation
<para> <para>
The WAL starting address should be The WAL starting address should be
larger than any WAL segment file name currently existing in larger than any WAL segment file name currently existing in
the directory <filename>pg_xlog</> under the data directory. the directory <filename>pg_wal</> under the data directory.
These names are also in hexadecimal and have three parts. The first These names are also in hexadecimal and have three parts. The first
part is the <quote>timeline ID</> and should usually be kept the same. part is the <quote>timeline ID</> and should usually be kept the same.
For example, if <filename>00000001000000320000004A</> is the For example, if <filename>00000001000000320000004A</> is the
largest entry in <filename>pg_xlog</>, use <literal>-l 00000001000000320000004B</> or higher. largest entry in <filename>pg_wal</>, use <literal>-l 00000001000000320000004B</> or higher.
</para> </para>
<note> <note>
<para> <para>
<command>pg_resetxlog</command> itself looks at the files in <command>pg_resetxlog</command> itself looks at the files in
<filename>pg_xlog</> and chooses a default <option>-l</> setting <filename>pg_wal</> and chooses a default <option>-l</> setting
beyond the last existing file name. Therefore, manual adjustment of beyond the last existing file name. Therefore, manual adjustment of
<option>-l</> should only be needed if you are aware of WAL segment <option>-l</> should only be needed if you are aware of WAL segment
files that are not currently present in <filename>pg_xlog</>, such as files that are not currently present in <filename>pg_wal</>, such as
entries in an offline archive; or if the contents of entries in an offline archive; or if the contents of
<filename>pg_xlog</> have been lost entirely. <filename>pg_wal</> have been lost entirely.
</para> </para>
</note> </note>
</listitem> </listitem>
......
...@@ -61,14 +61,14 @@ PostgreSQL documentation ...@@ -61,14 +61,14 @@ PostgreSQL documentation
<para> <para>
<application>pg_rewind</> examines the timeline histories of the source <application>pg_rewind</> examines the timeline histories of the source
and target clusters to determine the point where they diverged, and and target clusters to determine the point where they diverged, and
expects to find WAL in the target cluster's <filename>pg_xlog</> directory expects to find WAL in the target cluster's <filename>pg_wal</> directory
reaching all the way back to the point of divergence. The point of divergence reaching all the way back to the point of divergence. The point of divergence
can be found either on the target timeline, the source timeline, or their common can be found either on the target timeline, the source timeline, or their common
ancestor. In the typical failover scenario where the target cluster was ancestor. In the typical failover scenario where the target cluster was
shut down soon after the divergence, this is not a problem, but if the shut down soon after the divergence, this is not a problem, but if the
target cluster ran for a long time after the divergence, the old WAL target cluster ran for a long time after the divergence, the old WAL
files might no longer be present. In that case, they can be manually files might no longer be present. In that case, they can be manually
copied from the WAL archive to the <filename>pg_xlog</> directory, or copied from the WAL archive to the <filename>pg_wal</> directory, or
fetched on startup by configuring <filename>recovery.conf</>. The use of fetched on startup by configuring <filename>recovery.conf</>. The use of
<application>pg_rewind</> is not limited to failover, e.g. a standby <application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded server can be promoted, run some write transactions, and then rewinded
......
...@@ -118,7 +118,7 @@ PostgreSQL documentation ...@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
Directory in which to find log segment files. The default is to search Directory in which to find log segment files. The default is to search
for them in the <literal>pg_xlog</literal> subdirectory of the current for them in the <literal>pg_wal</literal> subdirectory of the current
directory. directory.
</para> </para>
</listitem> </listitem>
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
<para> <para>
Specifies the file name to write test data in. Specifies the file name to write test data in.
This file should be in the same file system that the This file should be in the same file system that the
<filename>pg_xlog</> directory is or will be placed in. <filename>pg_wal</> directory is or will be placed in.
(<filename>pg_xlog</> contains the <acronym>WAL</> files.) (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current The default is <filename>pg_test_fsync.out</> in the current
directory. directory.
</para> </para>
......
...@@ -345,7 +345,7 @@ NET STOP postgresql-9.0 ...@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster your old cluster
once you start the new cluster after the upgrade. Link mode also once you start the new cluster after the upgrade. Link mode also
requires that the old and new cluster data directories be in the requires that the old and new cluster data directories be in the
same file system. (Tablespaces and <filename>pg_xlog</> can be on same file system. (Tablespaces and <filename>pg_wal</> can be on
different file systems.) See <literal>pg_upgrade --help</> for a full different file systems.) See <literal>pg_upgrade --help</> for a full
list of options. list of options.
</para> </para>
...@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d ...@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para> <para>
If you have tablespaces, you will need to run a similar If you have tablespaces, you will need to run a similar
<application>rsync</> command for each tablespace directory. If you <application>rsync</> command for each tablespace directory. If you
have relocated <filename>pg_xlog</> outside the data directories, have relocated <filename>pg_wal</> outside the data directories,
<application>rsync</> must be run on those directories too. <application>rsync</> must be run on those directories too.
</para> </para>
</step> </step>
......
...@@ -141,7 +141,7 @@ Item ...@@ -141,7 +141,7 @@ Item
</row> </row>
<row> <row>
<entry><filename>pg_xlog</></entry> <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry> <entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row> </row>
......
...@@ -557,7 +557,7 @@ ...@@ -557,7 +557,7 @@
</para> </para>
<para> <para>
The number of WAL segment files in <filename>pg_xlog</> directory depends on The number of WAL segment files in <filename>pg_wal</> directory depends on
<varname>min_wal_size</>, <varname>max_wal_size</> and <varname>min_wal_size</>, <varname>max_wal_size</> and
the amount of WAL generated in previous checkpoint cycles. When old log the amount of WAL generated in previous checkpoint cycles. When old log
segment files are no longer needed, they are removed or recycled (that is, segment files are no longer needed, they are removed or recycled (that is,
...@@ -582,7 +582,7 @@ ...@@ -582,7 +582,7 @@
kept at all times. Also, if WAL archiving is used, old segments can not be kept at all times. Also, if WAL archiving is used, old segments can not be
removed or recycled until they are archived. If WAL archiving cannot keep up removed or recycled until they are archived. If WAL archiving cannot keep up
with the pace that WAL is generated, or if <varname>archive_command</varname> with the pace that WAL is generated, or if <varname>archive_command</varname>
fails repeatedly, old WAL files will accumulate in <filename>pg_xlog</> fails repeatedly, old WAL files will accumulate in <filename>pg_wal</>
until the situation is resolved. A slow or failed standby server that until the situation is resolved. A slow or failed standby server that
uses a replication slot will have the same effect (see uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">). <xref linkend="streaming-replication-slots">).
...@@ -594,7 +594,7 @@ ...@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to all its state to disk, updates the <filename>pg_control</> file to
indicate that the already-processed WAL data need not be scanned again, indicate that the already-processed WAL data need not be scanned again,
and then recycles any old log segment files in the <filename>pg_xlog</> and then recycles any old log segment files in the <filename>pg_wal</>
directory. directory.
Restartpoints can't be performed more frequently than checkpoints in the Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records. master because restartpoints can only be performed at checkpoint records.
...@@ -750,7 +750,7 @@ ...@@ -750,7 +750,7 @@
<para> <para>
<acronym>WAL</acronym> logs are stored in the directory <acronym>WAL</acronym> logs are stored in the directory
<filename>pg_xlog</filename> under the data directory, as a set of <filename>pg_wal</filename> under the data directory, as a set of
segment files, normally each 16 MB in size (but the size can be changed segment files, normally each 16 MB in size (but the size can be changed
by altering the <option>--with-wal-segsize</> configure option when by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally building the server). Each segment is divided into pages, normally
...@@ -767,7 +767,7 @@ ...@@ -767,7 +767,7 @@
<para> <para>
It is advantageous if the log is located on a different disk from the It is advantageous if the log is located on a different disk from the
main database files. This can be achieved by moving the main database files. This can be achieved by moving the
<filename>pg_xlog</filename> directory to another location (while the server <filename>pg_wal</filename> directory to another location (while the server
is shut down, of course) and creating a symbolic link from the is shut down, of course) and creating a symbolic link from the
original location in the main data directory to the new location. original location in the main data directory to the new location.
</para> </para>
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/* /*
* Copies all timeline history files with id's between 'begin' and 'end' * Copies all timeline history files with id's between 'begin' and 'end'
* from archive to pg_xlog. * from archive to pg_wal.
*/ */
void void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end) restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
...@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI) ...@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
result = lcons(entry, result); result = lcons(entry, result);
/* /*
* If the history file was fetched from archive, save it in pg_xlog for * If the history file was fetched from archive, save it in pg_wal for
* future reference. * future reference.
*/ */
if (fromArchive) if (fromArchive)
......
...@@ -235,9 +235,9 @@ static int LocalXLogInsertAllowed = -1; ...@@ -235,9 +235,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process. * valid in the startup process.
* *
* When ArchiveRecoveryRequested is true, but InArchiveRecovery is false, we're * When ArchiveRecoveryRequested is true, but InArchiveRecovery is false, we're
* currently performing crash recovery using only XLOG files in pg_xlog, but * currently performing crash recovery using only XLOG files in pg_wal, but
* will switch to using offline XLOG archives as soon as we reach the end of * will switch to using offline XLOG archives as soon as we reach the end of
* WAL in pg_xlog. * WAL in pg_wal.
*/ */
bool ArchiveRecoveryRequested = false; bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false; bool InArchiveRecovery = false;
...@@ -700,12 +700,12 @@ typedef enum ...@@ -700,12 +700,12 @@ typedef enum
{ {
XLOG_FROM_ANY = 0, /* request to read WAL from any source */ XLOG_FROM_ANY = 0, /* request to read WAL from any source */
XLOG_FROM_ARCHIVE, /* restored using restore_command */ XLOG_FROM_ARCHIVE, /* restored using restore_command */
XLOG_FROM_PG_XLOG, /* existing file in pg_xlog */ XLOG_FROM_PG_WAL, /* existing file in pg_wal */
XLOG_FROM_STREAM /* streamed from master */ XLOG_FROM_STREAM /* streamed from master */
} XLogSource; } XLogSource;
/* human-readable names for XLogSources, for debugging output */ /* human-readable names for XLogSources, for debugging output */
static const char *xlogSourceNames[] = {"any", "archive", "pg_xlog", "stream"}; static const char *xlogSourceNames[] = {"any", "archive", "pg_wal", "stream"};
/* /*
* openLogFile is -1 or a kernel FD for an open log file segment. * openLogFile is -1 or a kernel FD for an open log file segment.
...@@ -3345,7 +3345,7 @@ XLogFileOpen(XLogSegNo segno) ...@@ -3345,7 +3345,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery). * Open a logfile segment for reading (during recovery).
* *
* If source == XLOG_FROM_ARCHIVE, the segment is retrieved from archive. * If source == XLOG_FROM_ARCHIVE, the segment is retrieved from archive.
* Otherwise, it's assumed to be already available in pg_xlog. * Otherwise, it's assumed to be already available in pg_wal.
*/ */
static int static int
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
...@@ -3374,7 +3374,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, ...@@ -3374,7 +3374,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1; return -1;
break; break;
case XLOG_FROM_PG_XLOG: case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM: case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno); XLogFilePath(path, tli, segno);
restoredFromArchive = false; restoredFromArchive = false;
...@@ -3393,7 +3393,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, ...@@ -3393,7 +3393,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
KeepFileRestoredFromArchive(path, xlogfname); KeepFileRestoredFromArchive(path, xlogfname);
/* /*
* Set path to point at the new file in pg_xlog. * Set path to point at the new file in pg_wal.
*/ */
snprintf(path, MAXPGPATH, XLOGDIR "/%s", xlogfname); snprintf(path, MAXPGPATH, XLOGDIR "/%s", xlogfname);
} }
...@@ -3481,10 +3481,10 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, int source) ...@@ -3481,10 +3481,10 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, int source)
} }
} }
if (source == XLOG_FROM_ANY || source == XLOG_FROM_PG_XLOG) if (source == XLOG_FROM_ANY || source == XLOG_FROM_PG_WAL)
{ {
fd = XLogFileRead(segno, emode, tli, fd = XLogFileRead(segno, emode, tli,
XLOG_FROM_PG_XLOG, true); XLOG_FROM_PG_WAL, true);
if (fd != -1) if (fd != -1)
{ {
if (!expectedTLEs) if (!expectedTLEs)
...@@ -3693,10 +3693,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr) ...@@ -3693,10 +3693,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
* *
* This is called during recovery, whenever we switch to follow a new * This is called during recovery, whenever we switch to follow a new
* timeline, and at the end of recovery when we create a new timeline. We * timeline, and at the end of recovery when we create a new timeline. We
* wouldn't otherwise care about extra WAL files lying in pg_xlog, but they * wouldn't otherwise care about extra WAL files lying in pg_wal, but they
* might be leftover pre-allocated or recycled WAL segments on the old timeline * might be leftover pre-allocated or recycled WAL segments on the old timeline
* that we haven't used yet, and contain garbage. If we just leave them in * that we haven't used yet, and contain garbage. If we just leave them in
* pg_xlog, they will eventually be archived, and we can't let that happen. * pg_wal, they will eventually be archived, and we can't let that happen.
* Files that belong to our timeline history are valid, because we have * Files that belong to our timeline history are valid, because we have
* successfully replayed them, but from others we can't be sure. * successfully replayed them, but from others we can't be sure.
* *
...@@ -3853,15 +3853,15 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr) ...@@ -3853,15 +3853,15 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
} }
/* /*
* Verify whether pg_xlog and pg_xlog/archive_status exist. * Verify whether pg_wal and pg_wal/archive_status exist.
* If the latter does not exist, recreate it. * If the latter does not exist, recreate it.
* *
* It is not the goal of this function to verify the contents of these * It is not the goal of this function to verify the contents of these
* directories, but to help in cases where someone has performed a cluster * directories, but to help in cases where someone has performed a cluster
* copy for PITR purposes but omitted pg_xlog from the copy. * copy for PITR purposes but omitted pg_wal from the copy.
* *
* We could also recreate pg_xlog if it doesn't exist, but a deliberate * We could also recreate pg_wal if it doesn't exist, but a deliberate
* policy decision was made not to. It is fairly common for pg_xlog to be * policy decision was made not to. It is fairly common for pg_wal to be
* a symlink, and if that was the DBA's intent then automatically making a * a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice. * plain directory would result in degraded performance with no notice.
*/ */
...@@ -3871,7 +3871,7 @@ ValidateXLOGDirectoryStructure(void) ...@@ -3871,7 +3871,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH]; char path[MAXPGPATH];
struct stat stat_buf; struct stat stat_buf;
/* Check for pg_xlog; if it doesn't exist, error out */ /* Check for pg_wal; if it doesn't exist, error out */
if (stat(XLOGDIR, &stat_buf) != 0 || if (stat(XLOGDIR, &stat_buf) != 0 ||
!S_ISDIR(stat_buf.st_mode)) !S_ISDIR(stat_buf.st_mode))
ereport(FATAL, ereport(FATAL,
...@@ -4027,11 +4027,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode, ...@@ -4027,11 +4027,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing * If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the * crash recovery, switch to archive recovery and retry using the
* offline archive. We have now replayed all the valid WAL in * offline archive. We have now replayed all the valid WAL in
* pg_xlog, so we are presumably now consistent. * pg_wal, so we are presumably now consistent.
* *
* We require that there's at least some valid WAL present in * We require that there's at least some valid WAL present in
* pg_xlog, however (!fetch_ckpt). We could recover using the WAL * pg_wal, however (!fetch_ckpt). We could recover using the WAL
* from the archive, even if pg_xlog is completely empty, but we'd * from the archive, even if pg_wal is completely empty, but we'd
* have no idea how far we'd have to replay to reach consistency. * have no idea how far we'd have to replay to reach consistency.
* So err on the safe side and give up. * So err on the safe side and give up.
*/ */
...@@ -4039,7 +4039,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode, ...@@ -4039,7 +4039,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt) !fetching_ckpt)
{ {
ereport(DEBUG1, ereport(DEBUG1,
(errmsg_internal("reached end of WAL in pg_xlog, entering archive recovery"))); (errmsg_internal("reached end of WAL in pg_wal, entering archive recovery")));
InArchiveRecovery = true; InArchiveRecovery = true;
if (StandbyModeRequested) if (StandbyModeRequested)
StandbyMode = true; StandbyMode = true;
...@@ -4156,7 +4156,7 @@ rescanLatestTimeLine(void) ...@@ -4156,7 +4156,7 @@ rescanLatestTimeLine(void)
/* /*
* As in StartupXLOG(), try to ensure we have all the history files * As in StartupXLOG(), try to ensure we have all the history files
* between the old target and new target in pg_xlog. * between the old target and new target in pg_wal.
*/ */
restoreTimeLineHistoryFiles(oldtarget + 1, newtarget); restoreTimeLineHistoryFiles(oldtarget + 1, newtarget);
...@@ -5189,7 +5189,7 @@ readRecoveryCommandFile(void) ...@@ -5189,7 +5189,7 @@ readRecoveryCommandFile(void)
ereport(WARNING, ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command", (errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
RECOVERY_COMMAND_FILE), RECOVERY_COMMAND_FILE),
errhint("The database server will regularly poll the pg_xlog subdirectory to check for files placed there."))); errhint("The database server will regularly poll the pg_wal subdirectory to check for files placed there.")));
} }
else else
{ {
...@@ -6056,7 +6056,7 @@ StartupXLOG(void) ...@@ -6056,7 +6056,7 @@ StartupXLOG(void)
#endif #endif
/* /*
* Verify that pg_xlog and pg_xlog/archive_status exist. In cases where * Verify that pg_wal and pg_wal/archive_status exist. In cases where
* someone has performed a copy for PITR, these directories may have been * someone has performed a copy for PITR, these directories may have been
* excluded and need to be re-created. * excluded and need to be re-created.
*/ */
...@@ -6269,7 +6269,7 @@ StartupXLOG(void) ...@@ -6269,7 +6269,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file. * and put it into archive recovery by creating a recovery.conf file.
* *
* Our strategy in that case is to perform crash recovery first, * Our strategy in that case is to perform crash recovery first,
* replaying all the WAL present in pg_xlog, and only enter archive * replaying all the WAL present in pg_wal, and only enter archive
* recovery after that. * recovery after that.
* *
* But usually we already know how far we need to replay the WAL (up * But usually we already know how far we need to replay the WAL (up
...@@ -6473,7 +6473,7 @@ StartupXLOG(void) ...@@ -6473,7 +6473,7 @@ StartupXLOG(void)
/* /*
* Copy any missing timeline history files between 'now' and the recovery * Copy any missing timeline history files between 'now' and the recovery
* target timeline from archive to pg_xlog. While we don't need those * target timeline from archive to pg_wal. While we don't need those
* files ourselves - the history file of the recovery target timeline * files ourselves - the history file of the recovery target timeline
* covers all the previous timelines in the history too - a cascading * covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL * standby server might be interested in them. Or, if you archive the WAL
...@@ -7094,7 +7094,7 @@ StartupXLOG(void) ...@@ -7094,7 +7094,7 @@ StartupXLOG(void)
/* /*
* We are now done reading the xlog from stream. Turn off streaming * We are now done reading the xlog from stream. Turn off streaming
* recovery to force fetching the files (which would be required at end of * recovery to force fetching the files (which would be required at end of
* recovery, e.g., timeline history file) from archive or pg_xlog. * recovery, e.g., timeline history file) from archive or pg_wal.
*/ */
StandbyMode = false; StandbyMode = false;
...@@ -7382,7 +7382,7 @@ StartupXLOG(void) ...@@ -7382,7 +7382,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial * As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read * suffix, and archive it. Archive recovery will never try to read
* .partial segments, so they will normally go unused. But in the odd * .partial segments, so they will normally go unused. But in the odd
* PITR case, the administrator can copy them manually to the pg_xlog * PITR case, the administrator can copy them manually to the pg_wal
* directory (removing the suffix). They can be useful in debugging, * directory (removing the suffix). They can be useful in debugging,
* too. * too.
* *
...@@ -9958,7 +9958,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, ...@@ -9958,7 +9958,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
* first WAL segment containing the startup checkpoint has pages in * first WAL segment containing the startup checkpoint has pages in
* the beginning with the old timeline ID. That can cause trouble at * the beginning with the old timeline ID. That can cause trouble at
* recovery: we won't have a history file covering the old timeline if * recovery: we won't have a history file covering the old timeline if
* pg_xlog directory was not included in the base backup and the WAL * pg_wal directory was not included in the base backup and the WAL
* archive was cleared too before starting the backup. * archive was cleared too before starting the backup.
* *
* This also ensures that we have emitted a WAL page header that has * This also ensures that we have emitted a WAL page header that has
...@@ -10605,7 +10605,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) ...@@ -10605,7 +10605,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
* archived before returning. If archiving isn't enabled, the required WAL * archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with * needs to be transported via streaming replication (hopefully with
* wal_keep_segments set high enough), or some more exotic mechanism like * wal_keep_segments set high enough), or some more exotic mechanism like
* polling and copying files from pg_xlog with script. We have no * polling and copying files from pg_wal with script. We have no
* knowledge of those mechanisms, so it's up to the user to ensure that he * knowledge of those mechanisms, so it's up to the user to ensure that he
* gets all the required WAL. * gets all the required WAL.
* *
...@@ -11195,9 +11195,9 @@ next_record_is_invalid: ...@@ -11195,9 +11195,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'. * Open the WAL segment containing WAL position 'RecPtr'.
* *
* The segment can be fetched via restore_command, or via walreceiver having * The segment can be fetched via restore_command, or via walreceiver having
* streamed the record, or it can already be present in pg_xlog. Checking * streamed the record, or it can already be present in pg_wal. Checking
* pg_xlog is mainly for crash recovery, but it will be polled in standby mode * pg_wal is mainly for crash recovery, but it will be polled in standby mode
* too, in case someone copies a new segment directly to pg_xlog. That is not * too, in case someone copies a new segment directly to pg_wal. That is not
* documented or recommended, though. * documented or recommended, though.
* *
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should * If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
...@@ -11227,8 +11227,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11227,8 +11227,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*------- /*-------
* Standby mode is implemented by a state machine: * Standby mode is implemented by a state machine:
* *
* 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
* pg_xlog (XLOG_FROM_XLOG) * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file * 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM) * 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines * 4. Rescan timelines
...@@ -11244,7 +11244,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11244,7 +11244,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*------- *-------
*/ */
if (!InArchiveRecovery) if (!InArchiveRecovery)
currentSource = XLOG_FROM_PG_XLOG; currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0) else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE; currentSource = XLOG_FROM_ARCHIVE;
...@@ -11263,13 +11263,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11263,13 +11263,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource) switch (currentSource)
{ {
case XLOG_FROM_ARCHIVE: case XLOG_FROM_ARCHIVE:
case XLOG_FROM_PG_XLOG: case XLOG_FROM_PG_WAL:
/* /*
* Check to see if the trigger file exists. Note that we * Check to see if the trigger file exists. Note that we
* do this only after failure, so when you create the * do this only after failure, so when you create the
* trigger file, we still finish replaying as much as we * trigger file, we still finish replaying as much as we
* can from archive and pg_xlog before failover. * can from archive and pg_wal before failover.
*/ */
if (StandbyMode && CheckForStandbyTrigger()) if (StandbyMode && CheckForStandbyTrigger())
{ {
...@@ -11279,7 +11279,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11279,7 +11279,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/* /*
* Not in standby mode, and we've now tried the archive * Not in standby mode, and we've now tried the archive
* and pg_xlog. * and pg_wal.
*/ */
if (!StandbyMode) if (!StandbyMode)
return false; return false;
...@@ -11339,7 +11339,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11339,7 +11339,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but * little chance that the problem will just go away, but
* PANIC is not good for availability either, especially * PANIC is not good for availability either, especially
* in hot standby mode. So, we treat that the same as * in hot standby mode. So, we treat that the same as
* disconnection, and retry from archive/pg_xlog again. * disconnection, and retry from archive/pg_wal again.
* The WAL in the archive should be identical to what was * The WAL in the archive should be identical to what was
* streamed, so it's unlikely that it helps, but one can * streamed, so it's unlikely that it helps, but one can
* hope... * hope...
...@@ -11400,11 +11400,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11400,11 +11400,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
elog(ERROR, "unexpected WAL source %d", currentSource); elog(ERROR, "unexpected WAL source %d", currentSource);
} }
} }
else if (currentSource == XLOG_FROM_PG_XLOG) else if (currentSource == XLOG_FROM_PG_WAL)
{ {
/* /*
* We just successfully read a file in pg_xlog. We prefer files in * We just successfully read a file in pg_wal. We prefer files in
* the archive over ones in pg_xlog, so try the next file again * the archive over ones in pg_wal, so try the next file again
* from the archive first. * from the archive first.
*/ */
if (InArchiveRecovery) if (InArchiveRecovery)
...@@ -11425,7 +11425,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11425,7 +11425,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource) switch (currentSource)
{ {
case XLOG_FROM_ARCHIVE: case XLOG_FROM_ARCHIVE:
case XLOG_FROM_PG_XLOG: case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */ /* Close any old file we might have open. */
if (readFile >= 0) if (readFile >= 0)
{ {
...@@ -11438,7 +11438,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11438,7 +11438,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/* /*
* Try to restore the file from archive, or read an existing * Try to restore the file from archive, or read an existing
* file from pg_xlog. * file from pg_wal.
*/ */
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2, readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY : currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
...@@ -11447,7 +11447,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11447,7 +11447,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */ return true; /* success! */
/* /*
* Nope, not found in archive or pg_xlog. * Nope, not found in archive or pg_wal.
*/ */
lastSourceFailed = true; lastSourceFailed = true;
break; break;
...@@ -11503,7 +11503,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11503,7 +11503,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history * not open already. Also read the timeline history
* file if we haven't initialized timeline history * file if we haven't initialized timeline history
* yet; it should be streamed over and present in * yet; it should be streamed over and present in
* pg_xlog by now. Use XLOG_FROM_STREAM so that * pg_wal by now. Use XLOG_FROM_STREAM so that
* source info is set correctly and XLogReceiptTime * source info is set correctly and XLogReceiptTime
* isn't changed. * isn't changed.
*/ */
...@@ -11535,10 +11535,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11535,10 +11535,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/* /*
* Note that we don't "return false" immediately here. * Note that we don't "return false" immediately here.
* After being triggered, we still want to replay all * After being triggered, we still want to replay all
* the WAL that was already streamed. It's in pg_xlog * the WAL that was already streamed. It's in pg_wal
* now, so we just treat this as a failure, and the * now, so we just treat this as a failure, and the
* state machine will move on to replay the streamed * state machine will move on to replay the streamed
* WAL from pg_xlog, and then recheck the trigger and * WAL from pg_wal, and then recheck the trigger and
* exit replay. * exit replay.
*/ */
lastSourceFailed = true; lastSourceFailed = true;
...@@ -11578,7 +11578,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, ...@@ -11578,7 +11578,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* or legitimate end-of-WAL situation. Generally, we use it as-is, but if * or legitimate end-of-WAL situation. Generally, we use it as-is, but if
* we're retrying the exact same record that we've tried previously, only * we're retrying the exact same record that we've tried previously, only
* complain the first time to keep the noise down. However, we only do when * complain the first time to keep the noise down. However, we only do when
* reading from pg_xlog, because we don't expect any invalid records in archive * reading from pg_wal, because we don't expect any invalid records in archive
* or in records streamed from master. Files in the archive should be complete, * or in records streamed from master. Files in the archive should be complete,
* and we should never hit the end of WAL because we stop and wait for more WAL * and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it. * to arrive before replaying it.
...@@ -11593,7 +11593,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr) ...@@ -11593,7 +11593,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{ {
static XLogRecPtr lastComplaint = 0; static XLogRecPtr lastComplaint = 0;
if (readSource == XLOG_FROM_PG_XLOG && emode == LOG) if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{ {
if (RecPtr == lastComplaint) if (RecPtr == lastComplaint)
emode = DEBUG1; emode = DEBUG1;
......
...@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal) ...@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/* /*
* A file was restored from the archive under a temporary filename (path), * A file was restored from the archive under a temporary filename (path),
* and now we want to keep it. Rename it under the permanent filename in * and now we want to keep it. Rename it under the permanent filename in
* in pg_xlog (xlogfname), replacing any existing file with the same name. * in pg_wal (xlogfname), replacing any existing file with the same name.
*/ */
void void
KeepFileRestoredFromArchive(char *path, char *xlogfname) KeepFileRestoredFromArchive(char *path, char *xlogfname)
......
...@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS) ...@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump * pg_stop_backup: finish taking an on-line backup dump
* *
* We write an end-of-backup WAL record, and remove the backup label file * We write an end-of-backup WAL record, and remove the backup label file
* created by pg_start_backup, creating a backup history file in pg_xlog * created by pg_start_backup, creating a backup history file in pg_wal
* instead (whence it will immediately be archived). The backup history file * instead (whence it will immediately be archived). The backup history file
* contains the same info found in the label file, plus the backup-end time * contains the same info found in the label file, plus the backup-end time
* and WAL location. Before 9.0, the backup-end time was read from the backup * and WAL location. Before 9.0, the backup-end time was read from the backup
......
...@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in ...@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart. WalRcvData->receiveStart.
As walreceiver receives WAL from the master server, and writes and flushes As walreceiver receives WAL from the master server, and writes and flushes
it to disk (in pg_xlog), it updates WalRcvData->receivedUpto and signals it to disk (in pg_wal), it updates WalRcvData->receivedUpto and signals
the startup process to know how far WAL replay can advance. the startup process to know how far WAL replay can advance.
Walreceiver sends information about replication progress to the master server Walreceiver sends information about replication progress to the master server
......
...@@ -346,7 +346,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) ...@@ -346,7 +346,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
TimeLineID tli; TimeLineID tli;
/* /*
* I'd rather not worry about timelines here, so scan pg_xlog and * I'd rather not worry about timelines here, so scan pg_wal and
* include all WAL files in the range between 'startptr' and 'endptr', * include all WAL files in the range between 'startptr' and 'endptr',
* regardless of the timeline the file is stamped with. If there are * regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in * some spurious WAL files belonging to timelines that don't belong in
...@@ -359,11 +359,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) ...@@ -359,11 +359,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno); XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno); XLogFileName(lastoff, ThisTimeLineID, endsegno);
dir = AllocateDir("pg_xlog"); dir = AllocateDir("pg_wal");
if (!dir) if (!dir)
ereport(ERROR, ereport(ERROR,
(errmsg("could not open directory \"%s\": %m", "pg_xlog"))); (errmsg("could not open directory \"%s\": %m", "pg_wal")));
while ((de = ReadDir(dir, "pg_xlog")) != NULL) while ((de = ReadDir(dir, "pg_wal")) != NULL)
{ {
/* Does it look like a WAL segment, and is it in the range? */ /* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) && if (IsXLogFileName(de->d_name) &&
...@@ -401,7 +401,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) ...@@ -401,7 +401,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
qsort(walFiles, nWalFiles, sizeof(char *), compareWalFileNames); qsort(walFiles, nWalFiles, sizeof(char *), compareWalFileNames);
/* /*
* There must be at least one xlog file in the pg_xlog directory, * There must be at least one xlog file in the pg_wal directory,
* since we are doing backup-including-xlog. * since we are doing backup-including-xlog.
*/ */
if (nWalFiles < 1) if (nWalFiles < 1)
...@@ -1054,23 +1054,23 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, ...@@ -1054,23 +1054,23 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
} }
/* /*
* We can skip pg_xlog, the WAL segments need to be fetched from the * We can skip pg_wal, the WAL segments need to be fetched from the
* WAL archive anyway. But include it as an empty directory anyway, so * WAL archive anyway. But include it as an empty directory anyway, so
* we get permissions right. * we get permissions right.
*/ */
if (strcmp(pathbuf, "./pg_xlog") == 0) if (strcmp(pathbuf, "./pg_wal") == 0)
{ {
/* If pg_xlog is a symlink, write it as a directory anyway */ /* If pg_wal is a symlink, write it as a directory anyway */
size += _tarWriteDir(pathbuf, basepathlen, &statbuf, sizeonly); size += _tarWriteDir(pathbuf, basepathlen, &statbuf, sizeonly);
/* /*
* Also send archive_status directory (by hackishly reusing * Also send archive_status directory (by hackishly reusing
* statbuf from above ...). * statbuf from above ...).
*/ */
size += _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf, size += _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf,
sizeonly); sizeonly);
continue; /* don't recurse into pg_xlog */ continue; /* don't recurse into pg_wal */
} }
/* Allow symbolic links in pg_tblspc only */ /* Allow symbolic links in pg_tblspc only */
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver * If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new * goes into "waiting" mode, and waits for the startup process to give new
* instructions. The startup process will treat that the same as * instructions. The startup process will treat that the same as
* disconnection, and will rescan the archive/pg_xlog directory. But when the * disconnection, and will rescan the archive/pg_wal directory. But when the
* startup process wants to try streaming replication again, it will just * startup process wants to try streaming replication again, it will just
* nudge the existing walreceiver process that's waiting, instead of launching * nudge the existing walreceiver process that's waiting, instead of launching
* a new one. * a new one.
...@@ -365,7 +365,7 @@ WalReceiverMain(void) ...@@ -365,7 +365,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will * we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await * finish the streaming immediately, and we will go back to await
* orders from the startup process. If recovery_target_timeline is * orders from the startup process. If recovery_target_timeline is
* 'latest', the startup process will scan pg_xlog and find the new * 'latest', the startup process will scan pg_wal and find the new
* history file, bump recovery target timeline, and ask us to restart * history file, bump recovery target timeline, and ask us to restart
* on the new timeline. * on the new timeline.
*/ */
...@@ -742,7 +742,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last) ...@@ -742,7 +742,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli))); tli)));
/* /*
* Write the file to pg_xlog. * Write the file to pg_wal.
*/ */
writeTimeLineHistoryFile(tli, content, len); writeTimeLineHistoryFile(tli, content, len);
......
...@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd) ...@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* segment that contains switchpoint, but on the new timeline, so * segment that contains switchpoint, but on the new timeline, so
* that it doesn't end up with a partial segment. If you ask for a * that it doesn't end up with a partial segment. If you ask for a
* too old starting point, you'll get an error later when we fail * too old starting point, you'll get an error later when we fail
* to find the requested WAL segment in pg_xlog. * to find the requested WAL segment in pg_wal.
* *
* XXX: we could be more strict here and only allow a startpoint * XXX: we could be more strict here and only allow a startpoint
* that's older than the switchpoint, if it's still in the same * that's older than the switchpoint, if it's still in the same
...@@ -2058,7 +2058,7 @@ retry: ...@@ -2058,7 +2058,7 @@ retry:
* *
* For example, imagine that this server is currently on timeline * For example, imagine that this server is currently on timeline
* 5, and we're streaming timeline 4. The switch from timeline 4 * 5, and we're streaming timeline 4. The switch from timeline 4
* to 5 happened at 0/13002088. In pg_xlog, we have these files: * to 5 happened at 0/13002088. In pg_wal, we have these files:
* *
* ... * ...
* 000000040000000000000012 * 000000040000000000000012
......
...@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name) ...@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents. * Issue fsync recursively on PGDATA and all its contents.
* *
* We fsync regular files and directories wherever they are, but we * We fsync regular files and directories wherever they are, but we
* follow symlinks only for pg_xlog and immediately under pg_tblspc. * follow symlinks only for pg_wal and immediately under pg_tblspc.
* Other symlinks are presumed to point at files we're not responsible * Other symlinks are presumed to point at files we're not responsible
* for fsyncing, and might not have privileges to write at all. * for fsyncing, and might not have privileges to write at all.
* *
...@@ -2811,7 +2811,7 @@ SyncDataDirectory(void) ...@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
return; return;
/* /*
* If pg_xlog is a symlink, we'll need to recurse into it separately, * If pg_wal is a symlink, we'll need to recurse into it separately,
* because the first walkdir below will ignore it. * because the first walkdir below will ignore it.
*/ */
xlog_is_symlink = false; xlog_is_symlink = false;
...@@ -2820,16 +2820,16 @@ SyncDataDirectory(void) ...@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{ {
struct stat st; struct stat st;
if (lstat("pg_xlog", &st) < 0) if (lstat("pg_wal", &st) < 0)
ereport(LOG, ereport(LOG,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m", errmsg("could not stat file \"%s\": %m",
"pg_xlog"))); "pg_wal")));
else if (S_ISLNK(st.st_mode)) else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true; xlog_is_symlink = true;
} }
#else #else
if (pgwin32_is_junction("pg_xlog")) if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true; xlog_is_symlink = true;
#endif #endif
...@@ -2841,7 +2841,7 @@ SyncDataDirectory(void) ...@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS #ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1); walkdir(".", pre_sync_fname, false, DEBUG1);
if (xlog_is_symlink) if (xlog_is_symlink)
walkdir("pg_xlog", pre_sync_fname, false, DEBUG1); walkdir("pg_wal", pre_sync_fname, false, DEBUG1);
walkdir("pg_tblspc", pre_sync_fname, true, DEBUG1); walkdir("pg_tblspc", pre_sync_fname, true, DEBUG1);
#endif #endif
...@@ -2849,14 +2849,14 @@ SyncDataDirectory(void) ...@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order. * Now we do the fsync()s in the same order.
* *
* The main call ignores symlinks, so in addition to specially processing * The main call ignores symlinks, so in addition to specially processing
* pg_xlog if it's a symlink, pg_tblspc has to be visited separately with * pg_wal if it's a symlink, pg_tblspc has to be visited separately with
* process_symlinks = true. Note that if there are any plain directories * process_symlinks = true. Note that if there are any plain directories
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case * in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it. * so we don't worry about optimizing it.
*/ */
walkdir(".", datadir_fsync_fname, false, LOG); walkdir(".", datadir_fsync_fname, false, LOG);
if (xlog_is_symlink) if (xlog_is_symlink)
walkdir("pg_xlog", datadir_fsync_fname, false, LOG); walkdir("pg_wal", datadir_fsync_fname, false, LOG);
walkdir("pg_tblspc", datadir_fsync_fname, true, LOG); walkdir("pg_tblspc", datadir_fsync_fname, true, LOG);
} }
......
...@@ -195,7 +195,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo ...@@ -195,7 +195,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = { static const char *const subdirs[] = {
"global", "global",
"pg_xlog/archive_status", "pg_wal/archive_status",
"pg_clog", "pg_clog",
"pg_commit_ts", "pg_commit_ts",
"pg_dynshmem", "pg_dynshmem",
...@@ -2091,8 +2091,6 @@ make_postgres(FILE *cmdfd) ...@@ -2091,8 +2091,6 @@ make_postgres(FILE *cmdfd)
PG_CMD_PUTS(*line); PG_CMD_PUTS(*line);
} }
/* /*
* signal handler in case we are interrupted. * signal handler in case we are interrupted.
* *
...@@ -2830,7 +2828,7 @@ create_xlog_or_symlink(void) ...@@ -2830,7 +2828,7 @@ create_xlog_or_symlink(void)
char *subdirloc; char *subdirloc;
/* form name of the place for the subdirectory or symlink */ /* form name of the place for the subdirectory or symlink */
subdirloc = psprintf("%s/pg_xlog", pg_data); subdirloc = psprintf("%s/pg_wal", pg_data);
if (strcmp(xlog_dir, "") != 0) if (strcmp(xlog_dir, "") != 0)
{ {
...@@ -2963,7 +2961,7 @@ initialize_data_directory(void) ...@@ -2963,7 +2961,7 @@ initialize_data_directory(void)
create_xlog_or_symlink(); create_xlog_or_symlink();
/* Create required subdirectories (other than pg_xlog) */ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... ")); printf(_("creating subdirectories ... "));
fflush(stdout); fflush(stdout);
...@@ -3260,7 +3258,7 @@ main(int argc, char *argv[]) ...@@ -3260,7 +3258,7 @@ main(int argc, char *argv[])
fputs(_("syncing data to disk ... "), stdout); fputs(_("syncing data to disk ... "), stdout);
fflush(stdout); fflush(stdout);
fsync_pgdata(pg_data, progname); fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok(); check_ok();
return 0; return 0;
} }
...@@ -3326,7 +3324,7 @@ main(int argc, char *argv[]) ...@@ -3326,7 +3324,7 @@ main(int argc, char *argv[])
{ {
fputs(_("syncing data to disk ... "), stdout); fputs(_("syncing data to disk ... "), stdout);
fflush(stdout); fflush(stdout);
fsync_pgdata(pg_data, progname); fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok(); check_ok();
} }
else else
......
...@@ -55,6 +55,12 @@ typedef struct TablespaceList ...@@ -55,6 +55,12 @@ typedef struct TablespaceList
TablespaceListCell *tail; TablespaceListCell *tail;
} TablespaceList; } TablespaceList;
/*
* pg_xlog has been renamed to pg_wal in version 10. This version number
* should be compared with PQserverVersion().
*/
#define MINIMUM_VERSION_FOR_PG_WAL 100000
/* Global options */ /* Global options */
static char *basedir = NULL; static char *basedir = NULL;
static TablespaceList tablespace_dirs = {NULL, NULL}; static TablespaceList tablespace_dirs = {NULL, NULL};
...@@ -526,15 +532,22 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier) ...@@ -526,15 +532,22 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */ /* Error message already written in GetConnection() */
exit(1); exit(1);
snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/pg_xlog", basedir); /* In post-10 cluster, pg_xlog has been renamed to pg_wal */
snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/%s",
basedir,
PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
"pg_xlog" : "pg_wal");
/* /*
* Create pg_xlog/archive_status (and thus pg_xlog) so we can write to * Create pg_wal/archive_status or pg_xlog/archive_status (and thus
* basedir/pg_xlog as the directory entry in the tar file may arrive * pg_wal or pg_xlog) depending on the target server so we can write to
* later. * basedir/pg_wal or basedir/pg_xlog as the directory entry in the tar
* file may arrive later.
*/ */
snprintf(statusdir, sizeof(statusdir), "%s/pg_xlog/archive_status", snprintf(statusdir, sizeof(statusdir), "%s/%s/archive_status",
basedir); basedir,
PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
"pg_xlog" : "pg_wal");
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST) if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
{ {
...@@ -1338,15 +1351,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) ...@@ -1338,15 +1351,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0) if (mkdir(filename, S_IRWXU) != 0)
{ {
/* /*
* When streaming WAL, pg_xlog will have been created * When streaming WAL, pg_wal (or pg_xlog for pre-9.6
* by the wal receiver process. Also, when transaction * clusters) will have been created by the wal receiver
* log directory location was specified, pg_xlog has * process. Also, when transaction log directory location
* already been created as a symbolic link before * was specified, pg_wal (or pg_xlog) has already been
* starting the actual backup. So just ignore creation * created as a symbolic link before starting the actual
* failures on related directories. * backup. So just ignore creation failures on related
* directories.
*/ */
if (!((pg_str_endswith(filename, "/pg_xlog") || if (!((pg_str_endswith(filename, "/pg_wal") ||
pg_str_endswith(filename, "/archive_status")) && pg_str_endswith(filename, "/pg_xlog")||
pg_str_endswith(filename, "/archive_status")) &&
errno == EEXIST)) errno == EEXIST))
{ {
fprintf(stderr, fprintf(stderr,
...@@ -1634,15 +1649,10 @@ BaseBackup(void) ...@@ -1634,15 +1649,10 @@ BaseBackup(void)
char xlogend[64]; char xlogend[64];
int minServerMajor, int minServerMajor,
maxServerMajor; maxServerMajor;
int serverMajor; int serverVersion,
serverMajor;
/* Assert(conn != NULL);
* Connect in replication mode to the server
*/
conn = GetConnection();
if (!conn)
/* Error message already written in GetConnection() */
exit(1);
/* /*
* Check server version. BASE_BACKUP command was introduced in 9.1, so we * Check server version. BASE_BACKUP command was introduced in 9.1, so we
...@@ -1650,7 +1660,8 @@ BaseBackup(void) ...@@ -1650,7 +1660,8 @@ BaseBackup(void)
*/ */
minServerMajor = 901; minServerMajor = 901;
maxServerMajor = PG_VERSION_NUM / 100; maxServerMajor = PG_VERSION_NUM / 100;
serverMajor = PQserverVersion(conn) / 100; serverVersion = PQserverVersion(conn);
serverMajor = serverVersion / 100;
if (serverMajor < minServerMajor || serverMajor > maxServerMajor) if (serverMajor < minServerMajor || serverMajor > maxServerMajor)
{ {
const char *serverver = PQparameterStatus(conn, "server_version"); const char *serverver = PQparameterStatus(conn, "server_version");
...@@ -1979,7 +1990,7 @@ BaseBackup(void) ...@@ -1979,7 +1990,7 @@ BaseBackup(void)
} }
else else
{ {
(void) fsync_pgdata(basedir, progname); (void) fsync_pgdata(basedir, progname, serverVersion);
} }
} }
...@@ -2296,6 +2307,14 @@ main(int argc, char **argv) ...@@ -2296,6 +2307,14 @@ main(int argc, char **argv)
if (format == 'p' || strcmp(basedir, "-") != 0) if (format == 'p' || strcmp(basedir, "-") != 0)
verify_dir_is_empty_or_create(basedir, &made_new_pgdata, &found_existing_pgdata); verify_dir_is_empty_or_create(basedir, &made_new_pgdata, &found_existing_pgdata);
/* connection in replication mode to server */
conn = GetConnection();
if (!conn)
{
/* Error message already written in GetConnection() */
exit(1);
}
/* Create transaction log symlink, if required */ /* Create transaction log symlink, if required */
if (strcmp(xlog_dir, "") != 0) if (strcmp(xlog_dir, "") != 0)
{ {
...@@ -2303,19 +2322,24 @@ main(int argc, char **argv) ...@@ -2303,19 +2322,24 @@ main(int argc, char **argv)
verify_dir_is_empty_or_create(xlog_dir, &made_new_xlogdir, &found_existing_xlogdir); verify_dir_is_empty_or_create(xlog_dir, &made_new_xlogdir, &found_existing_xlogdir);
/* form name of the place where the symlink must go */ /*
linkloc = psprintf("%s/pg_xlog", basedir); * Form name of the place where the symlink must go. pg_xlog has
* been renamed to pg_wal in post-10 clusters.
*/
linkloc = psprintf("%s/%s", basedir,
PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
"pg_xlog" : "pg_wal");
#ifdef HAVE_SYMLINK #ifdef HAVE_SYMLINK
if (symlink(xlog_dir, linkloc) != 0) if (symlink(xlog_dir, linkloc) != 0)
{ {
fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"), fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"),
progname, linkloc, strerror(errno)); progname, linkloc, strerror(errno));
exit(1); disconnect_and_exit(1);
} }
#else #else
fprintf(stderr, _("%s: symlinks are not supported on this platform\n")); fprintf(stderr, _("%s: symlinks are not supported on this platform\n"));
exit(1); disconnect_and_exit(1);
#endif #endif
free(linkloc); free(linkloc);
} }
......
...@@ -67,9 +67,9 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ], ...@@ -67,9 +67,9 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
'pg_basebackup runs'); 'pg_basebackup runs');
ok(-f "$tempdir/backup/PG_VERSION", 'backup was created'); ok(-f "$tempdir/backup/PG_VERSION", 'backup was created');
# Only archive_status directory should be copied in pg_xlog/. # Only archive_status directory should be copied in pg_wal/.
is_deeply( is_deeply(
[ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ], [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ], [ sort qw(. .. archive_status) ],
'no WAL files copied'); 'no WAL files copied');
...@@ -230,12 +230,12 @@ like( ...@@ -230,12 +230,12 @@ like(
$node->command_ok( $node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ], [ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'pg_basebackup -X fetch runs'); 'pg_basebackup -X fetch runs');
ok(grep(/^[0-9A-F]{24}$/, slurp_dir("$tempdir/backupxf/pg_xlog")), ok(grep(/^[0-9A-F]{24}$/, slurp_dir("$tempdir/backupxf/pg_wal")),
'WAL files copied'); 'WAL files copied');
$node->command_ok( $node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ], [ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'pg_basebackup -X stream runs'); 'pg_basebackup -X stream runs');
ok(grep(/^[0-9A-F]{24}$/, slurp_dir("$tempdir/backupxf/pg_xlog")), ok(grep(/^[0-9A-F]{24}$/, slurp_dir("$tempdir/backupxf/pg_wal")),
'WAL files copied'); 'WAL files copied');
$node->command_fails( $node->command_fails(
......
...@@ -890,7 +890,7 @@ FindEndOfXLOG(void) ...@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
newXlogSegNo = ControlFile.checkPointCopy.redo / ControlFile.xlog_seg_size; newXlogSegNo = ControlFile.checkPointCopy.redo / ControlFile.xlog_seg_size;
/* /*
* Scan the pg_xlog directory to find existing WAL segment files. We * Scan the pg_wal directory to find existing WAL segment files. We
* assume any present have been used; in most scenarios this should be * assume any present have been used; in most scenarios this should be
* conservative, because of xlog.c's attempts to pre-create files. * conservative, because of xlog.c's attempts to pre-create files.
*/ */
......
...@@ -131,10 +131,10 @@ recurse_dir(const char *datadir, const char *parentpath, ...@@ -131,10 +131,10 @@ recurse_dir(const char *datadir, const char *parentpath,
/* /*
* If it's a symlink within pg_tblspc, we need to recurse into it, * If it's a symlink within pg_tblspc, we need to recurse into it,
* to process all the tablespaces. We also follow a symlink if * to process all the tablespaces. We also follow a symlink if
* it's for pg_xlog. Symlinks elsewhere are ignored. * it's for pg_wal. Symlinks elsewhere are ignored.
*/ */
if ((parentpath && strcmp(parentpath, "pg_tblspc") == 0) || if ((parentpath && strcmp(parentpath, "pg_tblspc") == 0) ||
strcmp(path, "pg_xlog") == 0) strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback); recurse_dir(datadir, path, callback);
#else #else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n", pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
......
...@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize, ...@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
return; return;
/* /*
* Pretend that pg_xlog is a directory, even if it's really a symlink. We * Pretend that pg_wal is a directory, even if it's really a symlink. We
* don't want to mess with the symlink itself, nor complain if it's a * don't want to mess with the symlink itself, nor complain if it's a
* symlink in source but not in target or vice versa. * symlink in source but not in target or vice versa.
*/ */
if (strcmp(path, "pg_xlog") == 0 && type == FILE_TYPE_SYMLINK) if (strcmp(path, "pg_wal") == 0 && type == FILE_TYPE_SYMLINK)
type = FILE_TYPE_DIRECTORY; type = FILE_TYPE_DIRECTORY;
/* /*
...@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize, ...@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type) switch (type)
{ {
case FILE_TYPE_DIRECTORY: case FILE_TYPE_DIRECTORY:
if (exists && !S_ISDIR(statbuf.st_mode) && strcmp(path, "pg_xlog") != 0) if (exists && !S_ISDIR(statbuf.st_mode) && strcmp(path, "pg_wal") != 0)
{ {
/* it's a directory in source, but not in target. Strange.. */ /* it's a directory in source, but not in target. Strange.. */
pg_fatal("\"%s\" is not a directory\n", localpath); pg_fatal("\"%s\" is not a directory\n", localpath);
...@@ -296,7 +296,7 @@ process_target_file(const char *path, file_type_t type, size_t oldsize, ...@@ -296,7 +296,7 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
/* /*
* Like in process_source_file, pretend that xlog is always a directory. * Like in process_source_file, pretend that xlog is always a directory.
*/ */
if (strcmp(path, "pg_xlog") == 0 && type == FILE_TYPE_SYMLINK) if (strcmp(path, "pg_wal") == 0 && type == FILE_TYPE_SYMLINK)
type = FILE_TYPE_DIRECTORY; type = FILE_TYPE_DIRECTORY;
key.path = (char *) path; key.path = (char *) path;
......
...@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader, ...@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
TimeLineID *pageTLI); TimeLineID *pageTLI);
/* /*
* Read WAL from the datadir/pg_xlog, starting from 'startpoint' on timeline * Read WAL from the datadir/pg_wal, starting from 'startpoint' on timeline
* index 'tliIndex' in target timeline history, until 'endpoint'. Make note of * index 'tliIndex' in target timeline history, until 'endpoint'. Make note of
* the data blocks touched by the WAL records, and return them in a page map. * the data blocks touched by the WAL records, and return them in a page map.
*/ */
......
# #
# Test pg_rewind when the target's pg_xlog directory is a symlink. # Test pg_rewind when the target's pg_wal directory is a symlink.
# #
use strict; use strict;
use warnings; use warnings;
...@@ -30,10 +30,10 @@ sub run_test ...@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir; my $test_master_datadir = $node_master->data_dir;
# turn pg_xlog into a symlink # turn pg_wal into a symlink
print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n"); print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
move("$test_master_datadir/pg_xlog", $master_xlogdir) or die; move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die; symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master(); RewindTest::start_master();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
static void check_data_dir(const char *pg_data); static void check_data_dir(ClusterInfo *cluster);
static void check_bin_dir(ClusterInfo *cluster); static void check_bin_dir(ClusterInfo *cluster);
static void validate_exec(const char *dir, const char *cmdName); static void validate_exec(const char *dir, const char *cmdName);
...@@ -220,9 +220,9 @@ verify_directories(void) ...@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n"); pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster); check_bin_dir(&old_cluster);
check_data_dir(old_cluster.pgdata); check_data_dir(&old_cluster);
check_bin_dir(&new_cluster); check_bin_dir(&new_cluster);
check_data_dir(new_cluster.pgdata); check_data_dir(&new_cluster);
} }
...@@ -252,6 +252,32 @@ win32_check_directory_write_permissions(void) ...@@ -252,6 +252,32 @@ win32_check_directory_write_permissions(void)
#endif #endif
/*
* check_single_dir()
*
* Check for the presence of a single directory in PGDATA, and fail if
* is it missing or not accessible.
*/
static void
check_single_dir(const char *pg_data, const char *subdir)
{
struct stat statBuf;
char subDirName[MAXPGPATH];
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
/* Win32 can't stat() a directory with a trailing slash. */
*subdir ? "/" : "",
subdir);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
/* /*
* check_data_dir() * check_data_dir()
* *
...@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void) ...@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void)
* *
*/ */
static void static void
check_data_dir(const char *pg_data) check_data_dir(ClusterInfo *cluster)
{ {
char subDirName[MAXPGPATH]; const char *pg_data = cluster->pgdata;
int subdirnum;
/* get old and new cluster versions */
/* start check with top-most directory */ old_cluster.major_version = get_major_server_version(&old_cluster);
const char *requiredSubdirs[] = {"", "base", "global", "pg_clog", new_cluster.major_version = get_major_server_version(&new_cluster);
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
"pg_xlog"}; check_single_dir(pg_data, "");
check_single_dir(pg_data, "base");
for (subdirnum = 0; check_single_dir(pg_data, "global");
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]); check_single_dir(pg_data, "pg_multixact");
++subdirnum) check_single_dir(pg_data, "pg_subtrans");
{ check_single_dir(pg_data, "pg_tblspc");
struct stat statBuf; check_single_dir(pg_data, "pg_twophase");
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data, /* pg_xlog has been renamed to pg_wal in post-10 cluster */
/* Win32 can't stat() a directory with a trailing slash. */ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
*requiredSubdirs[subdirnum] ? "/" : "", check_single_dir(pg_data, "pg_xlog");
requiredSubdirs[subdirnum]); else
check_single_dir(pg_data, "pg_wal");
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
} }
......
...@@ -680,7 +680,7 @@ usage(void) ...@@ -680,7 +680,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\n"); printf(" -f, --follow keep retrying after reaching end of WAL\n");
printf(" -n, --limit=N number of records to display\n"); printf(" -n, --limit=N number of records to display\n");
printf(" -p, --path=PATH directory in which to find log segment files\n"); printf(" -p, --path=PATH directory in which to find log segment files\n");
printf(" (default: ./pg_xlog)\n"); printf(" (default: ./pg_wal)\n");
printf(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n"); printf(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n");
printf(" use --rmgr=list to list valid resource manager names\n"); printf(" use --rmgr=list to list valid resource manager names\n");
printf(" -s, --start=RECPTR start reading at log position RECPTR\n"); printf(" -s, --start=RECPTR start reading at log position RECPTR\n");
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
#define PG_FLUSH_DATA_WORKS 1 #define PG_FLUSH_DATA_WORKS 1
#endif #endif
/*
* pg_xlog has been renamed to pg_wal in version 10.
*/
#define MINIMUM_VERSION_FOR_PG_WAL 100000
#ifdef PG_FLUSH_DATA_WORKS #ifdef PG_FLUSH_DATA_WORKS
static int pre_sync_fname(const char *fname, bool isdir, static int pre_sync_fname(const char *fname, bool isdir,
const char *progname); const char *progname);
...@@ -40,25 +45,31 @@ static void walkdir(const char *path, ...@@ -40,25 +45,31 @@ static void walkdir(const char *path,
/* /*
* Issue fsync recursively on PGDATA and all its contents. * Issue fsync recursively on PGDATA and all its contents.
* *
* We fsync regular files and directories wherever they are, but we * We fsync regular files and directories wherever they are, but we follow
* follow symlinks only for pg_xlog and immediately under pg_tblspc. * symlinks only for pg_wal (or pg_xlog) and immediately under pg_tblspc.
* Other symlinks are presumed to point at files we're not responsible * Other symlinks are presumed to point at files we're not responsible for
* for fsyncing, and might not have privileges to write at all. * fsyncing, and might not have privileges to write at all.
*
* serverVersion indicates the version of the server to be fsync'd.
* *
* Errors are reported but not considered fatal. * Errors are reported but not considered fatal.
*/ */
void void
fsync_pgdata(const char *pg_data, const char *progname) fsync_pgdata(const char *pg_data,
const char *progname,
int serverVersion)
{ {
bool xlog_is_symlink; bool xlog_is_symlink;
char pg_xlog[MAXPGPATH]; char pg_wal[MAXPGPATH];
char pg_tblspc[MAXPGPATH]; char pg_tblspc[MAXPGPATH];
snprintf(pg_xlog, MAXPGPATH, "%s/pg_xlog", pg_data); /* handle renaming of pg_xlog to pg_wal in post-10 clusters */
snprintf(pg_wal, MAXPGPATH, "%s/%s", pg_data,
serverVersion < MINIMUM_VERSION_FOR_PG_WAL ? "pg_xlog" : "pg_wal");
snprintf(pg_tblspc, MAXPGPATH, "%s/pg_tblspc", pg_data); snprintf(pg_tblspc, MAXPGPATH, "%s/pg_tblspc", pg_data);
/* /*
* If pg_xlog is a symlink, we'll need to recurse into it separately, * If pg_wal is a symlink, we'll need to recurse into it separately,
* because the first walkdir below will ignore it. * because the first walkdir below will ignore it.
*/ */
xlog_is_symlink = false; xlog_is_symlink = false;
...@@ -67,14 +78,14 @@ fsync_pgdata(const char *pg_data, const char *progname) ...@@ -67,14 +78,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
{ {
struct stat st; struct stat st;
if (lstat(pg_xlog, &st) < 0) if (lstat(pg_wal, &st) < 0)
fprintf(stderr, _("%s: could not stat file \"%s\": %s\n"), fprintf(stderr, _("%s: could not stat file \"%s\": %s\n"),
progname, pg_xlog, strerror(errno)); progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode)) else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true; xlog_is_symlink = true;
} }
#else #else
if (pgwin32_is_junction(pg_xlog)) if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true; xlog_is_symlink = true;
#endif #endif
...@@ -85,7 +96,7 @@ fsync_pgdata(const char *pg_data, const char *progname) ...@@ -85,7 +96,7 @@ fsync_pgdata(const char *pg_data, const char *progname)
#ifdef PG_FLUSH_DATA_WORKS #ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false, progname); walkdir(pg_data, pre_sync_fname, false, progname);
if (xlog_is_symlink) if (xlog_is_symlink)
walkdir(pg_xlog, pre_sync_fname, false, progname); walkdir(pg_wal, pre_sync_fname, false, progname);
walkdir(pg_tblspc, pre_sync_fname, true, progname); walkdir(pg_tblspc, pre_sync_fname, true, progname);
#endif #endif
...@@ -93,14 +104,14 @@ fsync_pgdata(const char *pg_data, const char *progname) ...@@ -93,14 +104,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
* Now we do the fsync()s in the same order. * Now we do the fsync()s in the same order.
* *
* The main call ignores symlinks, so in addition to specially processing * The main call ignores symlinks, so in addition to specially processing
* pg_xlog if it's a symlink, pg_tblspc has to be visited separately with * pg_wal if it's a symlink, pg_tblspc has to be visited separately with
* process_symlinks = true. Note that if there are any plain directories * process_symlinks = true. Note that if there are any plain directories
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case * in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it. * so we don't worry about optimizing it.
*/ */
walkdir(pg_data, fsync_fname, false, progname); walkdir(pg_data, fsync_fname, false, progname);
if (xlog_is_symlink) if (xlog_is_symlink)
walkdir(pg_xlog, fsync_fname, false, progname); walkdir(pg_wal, fsync_fname, false, progname);
walkdir(pg_tblspc, fsync_fname, true, progname); walkdir(pg_tblspc, fsync_fname, true, progname);
} }
......
...@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; ...@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/* /*
* The XLog directory and control file (relative to $PGDATA) * The XLog directory and control file (relative to $PGDATA)
*/ */
#define XLOGDIR "pg_xlog" #define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control" #define XLOG_CONTROL_FILE "global/pg_control"
/* /*
......
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 201610121 #define CATALOG_VERSION_NO 201610201
#endif #endif
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
extern int fsync_fname(const char *fname, bool isdir, extern int fsync_fname(const char *fname, bool isdir,
const char *progname); const char *progname);
extern void fsync_pgdata(const char *pg_data, const char *progname); extern void fsync_pgdata(const char *pg_data, const char *progname,
int serverVersion);
extern int durable_rename(const char *oldfile, const char *newfile, extern int durable_rename(const char *oldfile, const char *newfile,
const char *progname); const char *progname);
extern int fsync_parent_path(const char *fname, const char *progname); extern int fsync_parent_path(const char *fname, const char *progname);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* ---------- /* ----------
* Archiver control info. * Archiver control info.
* *
* We expect that archivable files within pg_xlog will have names between * We expect that archivable files within pg_wal will have names between
* MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters * 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 * appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended. * corresponding names with ".ready" or ".done" appended.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment