Renaming of pg_xlog and pg_clog
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journal
Another idea from Stephen
(/messages/by-id/20160826003715.GG4028@tamriel.snowman.net)
would be to put everything that is temporary and not WAL-logged into a
single place to facilitate the filtering work of backup tools.
A straight renaming would be a simple patch (including pg_upgrade
part), and if we actually do it for 10.0 it would be good to do it now
instead of in 3 months. I don't mind writing a patch for it.
Now, one of the things discussed as well was that we may want to still
keep pg_xlog, and soft-link to pg_journal or whatever-the-new-name is
to not break the existing tools. Personally, I'd prefer a hard break.
That would not be complicated to fix for any tool maintainers.
Thoughts?
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Aug 26, 2016 at 11:39:29AM +0900, Michael Paquier wrote:
Now, one of the things discussed as well was that we may want to still
keep pg_xlog, and soft-link to pg_journal or whatever-the-new-name is
to not break the existing tools. Personally, I'd prefer a hard break.
That would not be complicated to fix for any tool maintainers.
I agree on a hard break, unless we get pushback from users, and even
then, they can create the symlinks themselves.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Aug 26, 2016 at 11:55 AM, Bruce Momjian <bruce@momjian.us> wrote:
On Fri, Aug 26, 2016 at 11:39:29AM +0900, Michael Paquier wrote:
Now, one of the things discussed as well was that we may want to still
keep pg_xlog, and soft-link to pg_journal or whatever-the-new-name is
to not break the existing tools. Personally, I'd prefer a hard break.
That would not be complicated to fix for any tool maintainers.I agree on a hard break, unless we get pushback from users, and even
then, they can create the symlinks themselves.
I strongly prefer symlink approach not to break many existing tools
and scripts.
Regards,
--
Fujii Masao
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Bruce Momjian (bruce@momjian.us) wrote:
On Fri, Aug 26, 2016 at 11:39:29AM +0900, Michael Paquier wrote:
Now, one of the things discussed as well was that we may want to still
keep pg_xlog, and soft-link to pg_journal or whatever-the-new-name is
to not break the existing tools. Personally, I'd prefer a hard break.
That would not be complicated to fix for any tool maintainers.I agree on a hard break, unless we get pushback from users, and even
then, they can create the symlinks themselves.
I'm in favor of the hard break generally, but I'd like David's input on
it, to be sure we're not missing something.
Thanks!
Stephen
Re: Fujii Masao 2016-08-26 <CAHGQGwHK2yimfLvG_WQ1Vrq2h+CMzgv5u6OEmxr-cbJRO+WKWQ@mail.gmail.com>
I agree on a hard break, unless we get pushback from users, and even
then, they can create the symlinks themselves.I strongly prefer symlink approach not to break many existing tools
and scripts.
Symlinks might actually be worse than removing the directories
altogether. If your backup tool fails because the pg_xlog directory is
gone, you'll hopefully notice, but if you end up with a backup that
consists merely of a copy of a symlink named pg_xlog, you might not
notice.
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Aug 26, 2016 at 12:44 PM, Christoph Berg <myon@debian.org> wrote:
Re: Fujii Masao 2016-08-26 <CAHGQGwHK2yimfLvG_WQ1Vrq2h+
CMzgv5u6OEmxr-cbJRO+WKWQ@mail.gmail.com>I agree on a hard break, unless we get pushback from users, and even
then, they can create the symlinks themselves.I strongly prefer symlink approach not to break many existing tools
and scripts.Symlinks might actually be worse than removing the directories
altogether. If your backup tool fails because the pg_xlog directory is
gone, you'll hopefully notice, but if you end up with a backup that
consists merely of a copy of a symlink named pg_xlog, you might not
notice.
+1. It's *much* better to cause a clean break. That way people will notice
it, and can fix it (and it will be an easy fix).
An unclean break might leave people with things that look like they work,
but don't. That's a lot more dangerous.
Same reason I'm also +1 for Stephens suggestion to put all things that
should not be in a base backup into the same directory. That may break
things now, but it will simplify things down the road. And doing it at the
same time as renaming these things makes a lot of sense, because it causes
breakage that tool-builders *have* to look at, and then they will hopefully
also notice the other change.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On 26 August 2016 at 04:39, Michael Paquier <michael.paquier@gmail.com> wrote:
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journal
Don't mean to be a party pooper, but what discussion and agreement are
we referring to here?
If we are going to suggest doing something we really should summarize
the reason for doing it rather than assume it is self evident, cos it
certainly isn't.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Aug 26, 2016 at 8:31 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
On 26 August 2016 at 04:39, Michael Paquier <michael.paquier@gmail.com> wrote:
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journalDon't mean to be a party pooper, but what discussion and agreement are
we referring to here?If we are going to suggest doing something we really should summarize
the reason for doing it rather than assume it is self evident, cos it
certainly isn't.
This thread was the previous one on the matter:
/messages/by-id/CAASwCXcVGma9KgEu-ESC6u928mW67noZvnawbPUSW7R7AN9UVg@mail.gmail.com
In short, with the current names, sometimes users think that pg_xlog
and pg_clog are just logs. And so it is fine to delete them to free up
space, corrupting their cluster, because they are just *logs*.
Personally I have seen that, and based on the thread I am not the only
one.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi,
On Fri, 2016-08-26 at 21:12 +0900, Michael Paquier wrote:
In short, with the current names, sometimes users think that pg_xlog
and pg_clog are just logs. And so it is fine to delete them to free up
space, corrupting their cluster, because they are just *logs*.
...and we also have "pg_logical", that includes a "log" keyword already...
Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR
On 26-08-2016 09:25, Devrim Gündüz wrote:
On Fri, 2016-08-26 at 21:12 +0900, Michael Paquier wrote:
In short, with the current names, sometimes users think that pg_xlog
and pg_clog are just logs. And so it is fine to delete them to free up
space, corrupting their cluster, because they are just *logs*....and we also have "pg_logical", that includes a "log" keyword already...
"clog" and "xlog" is almost "log"; "logical" is not. I don't imagine
people confusing "logical" meaning "log".
--
Euler Taveira Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Euler Taveira <euler@timbira.com.br> writes:
On 26-08-2016 09:25, Devrim Gündüz wrote:
...and we also have "pg_logical", that includes a "log" keyword already...
"clog" and "xlog" is almost "log"; "logical" is not. I don't imagine
people confusing "logical" meaning "log".
Well, I dunno; people with a weak grasp of English might have an issue
there. But I never liked that directory name anyway; my problem with
it is I read "pg_logical" and think "logical what?". Naming things using
a disconnected adjective is not good, especially one with as many
potential applications as that one has. If we're up for renaming things
under PGDATA, that one is high on my hit list.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
Euler Taveira <euler@timbira.com.br> writes:
On 26-08-2016 09:25, Devrim Gündüz wrote:
...and we also have "pg_logical", that includes a "log" keyword already...
"clog" and "xlog" is almost "log"; "logical" is not. I don't imagine
people confusing "logical" meaning "log".Well, I dunno; people with a weak grasp of English might have an issue
there. But I never liked that directory name anyway; my problem with
it is I read "pg_logical" and think "logical what?". Naming things using
a disconnected adjective is not good, especially one with as many
potential applications as that one has. If we're up for renaming things
under PGDATA, that one is high on my hit list.
iirc, pg_logical also has both temporary and non-temporary data in it
too. That complicates things for backup utilities that are trying to
exclude all temporary files. If we actually move all the temp files
into their own directory (or tree), then we're changing what's in
pg_logical anyway, so renaming it seems like a good idea.
Thanks!
Stephen
On 08/26/2016 03:48 AM, Magnus Hagander wrote:
Same reason I'm also +1 for Stephens suggestion to put all things that
should not be in a base backup into the same directory. That may break
things now, but it will simplify things down the road. And doing it at
the same time as renaming these things makes a lot of sense, because it
causes breakage that tool-builders *have* to look at, and then they will
hopefully also notice the other change.
If this is done this fall, developers will have at least a year to fix
their utilities.
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/25/2016 07:39 PM, Michael Paquier wrote:
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journal
I think the use of the pg_ prefix is redundant. Just a directory called:
wal will do (for example).
In reference to pg_xlog specifically, it should be wal. It is the Write
Ahead Log, not the Journal (although I recognize they can be
synonymous). All the documentation talks about Write Ahead Log.
Sincerely,
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Aug 26, 2016 5:13 PM, "Joshua D. Drake" <jd@commandprompt.com> wrote:
On 08/25/2016 07:39 PM, Michael Paquier wrote:
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journalI think the use of the pg_ prefix is redundant. Just a directory called:
wal will do (for example).
In reference to pg_xlog specifically, it should be wal. It is the Write
Ahead Log, not the Journal (although I recognize they can be synonymous).
All the documentation talks about Write Ahead Log.
Yes, let's avoid inventing a *third* name for it, please. It's already bad
enough that we have both wal and xlog.
/Magnus
On 8/25/16 10:39 PM, Michael Paquier wrote:
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journal
If we're going to do some renaming, then I suggest we do a
mini-file-system structure under $PGDATA, like
$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/var
The names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that scheme.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Aug 26, 2016 5:54 PM, "Peter Eisentraut" <
peter.eisentraut@2ndquadrant.com> wrote:
On 8/25/16 10:39 PM, Michael Paquier wrote:
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journalIf we're going to do some renaming, then I suggest we do a
mini-file-system structure under $PGDATA, like$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/varThe names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that scheme
Interesting idea. I worry a bit that this might encourage distributions to
split it up into different places though, and I'm not sure we want to
encourage that..
/Magnus
Magnus Hagander <magnus@hagander.net> writes:
On Aug 26, 2016 5:54 PM, "Peter Eisentraut" <
peter.eisentraut@2ndquadrant.com> wrote:If we're going to do some renaming, then I suggest we do a
mini-file-system structure under $PGDATA, like$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/varThe names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that scheme
Interesting idea. I worry a bit that this might encourage distributions to
split it up into different places though, and I'm not sure we want to
encourage that..
Yeah, I'm afraid that these names are not as well standardized as Peter
probably wishes they were. Also, I'd just as soon not move/rename things
that don't really need it. If, for example, we decide to move
postgresql.conf to etc/postgresql.conf, that is going to break a metric
ton of stuff that doesn't need to get broken AFAICS.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/26/2016 09:28 AM, Tom Lane wrote:
Magnus Hagander <magnus@hagander.net> writes:
On Aug 26, 2016 5:54 PM, "Peter Eisentraut" <
peter.eisentraut@2ndquadrant.com> wrote:If we're going to do some renaming, then I suggest we do a
mini-file-system structure under $PGDATA, like$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/varThe names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that schemeInteresting idea. I worry a bit that this might encourage distributions to
split it up into different places though, and I'm not sure we want to
encourage that..Yeah, I'm afraid that these names are not as well standardized as Peter
probably wishes they were. Also, I'd just as soon not move/rename things
that don't really need it. If, for example, we decide to move
postgresql.conf to etc/postgresql.conf, that is going to break a metric
ton of stuff that doesn't need to get broken AFAICS.
I am not so sure that is accurate. Yes, Windows is an outlying but any
Unix person is going to easily understand etc log run. Further as Linux
is by far our most run platform (outside of possibly Windows) it will
feel right at home for the largest growing user base. Personally I
really like the idea of:
$PGDATA/etc/postgresql.conf
$PGDATA/log/Thu.log
$PGDATA/run/postmaster.pid
$PGDATA/var/base/16758
Although... wouldn't run be under var?
JD
regards, tom lane
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 26 August 2016 at 18:28, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Also, I'd just as soon not move/rename things that don't really need it.
+1
Let's leave everything exactly as it is now... but put a small README
in each directory to explain why files in it shouldn't be deleted to
make space.
That helps the few people who made such mistakes, but doesn't cause
massive change as a result.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/26/16 11:58 AM, Magnus Hagander wrote:
$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/varThe names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that schemeInteresting idea. I worry a bit that this might encourage distributions
to split it up into different places though, and I'm not sure we want to
encourage that..
They already do this. This would just formalize where we think
appropriate boundaries between the pieces are.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2016-08-26 11:53:21 -0400, Peter Eisentraut wrote:
On 8/25/16 10:39 PM, Michael Paquier wrote:
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journalIf we're going to do some renaming, then I suggest we do a
mini-file-system structure under $PGDATA, like$PGDATA/etc
$PGDATA/log
$PGDATA/run (lock files etc.)
$PGDATA/tmp
$PGDATA/varThe names of all the things under "var" could still be refined, but it's
much less likely that users will confuse data with configuration or
plain logs under that scheme.
Splitting of ephemeral data seems to have a benefit, the rest seems more
like rather noisy busywork to me.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/26/16 12:28 PM, Tom Lane wrote:
Also, I'd just as soon not move/rename things
that don't really need it.
I'm just as happy with not changing anything. But if we're going to
rename stuff, let's at least think about something slightly more
comprehensive. Any rename is going to break a bunch of stuff. But if
we break it in a way that reduces the need for future discussion or
changes, it would at least be a small win in the long run.
If, for example, we decide to move
postgresql.conf to etc/postgresql.conf, that is going to break a metric
ton of stuff that doesn't need to get broken AFAICS.
Sure, I'd be content with leaving those in the top-level instead of say
"etc".
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/26/16 4:02 PM, Joshua D. Drake wrote:
Although... wouldn't run be under var?
Traditionally yes, but things are changing in this area, if you consider
the top-level file system of a modern Linux distribution. One reason is
that "run" is/can be blown away at reboot. This wouldn't be an entirely
useless feature for postgres: Can you tell otherwise which of the
various pid/lock/opts files you can delete if you have killed the
processes and want to eliminate any left-over state? Is postmaster.opts
a configuration file or a state file?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2016-08-26 17:11:00 -0400, Peter Eisentraut wrote:
On 8/26/16 12:28 PM, Tom Lane wrote:
Also, I'd just as soon not move/rename things
that don't really need it.I'm just as happy with not changing anything. But if we're going to
rename stuff, let's at least think about something slightly more
comprehensive. Any rename is going to break a bunch of stuff. But if
we break it in a way that reduces the need for future discussion or
changes, it would at least be a small win in the long run.
I do think there's an order of magnitude between the impact between
moving some and moving everything. And that's going to impact
cost/benefit calculations.
Moving e.g. all ephemeral files into a (possibly configurable) directory
is going to hardly impact anyone. Renaming pg_logical into something
different (FWIW, it was originally named differently...) will hopefully
impact nobody, excepting some out of date file exclusion lists possibly.
But moving config files, and even pg_xlog (which we document to be
symlinkable somewhere else) imo is different.
The other thing is that the likelihood of getting anywhere by doing
radical one-off redesigns is approximately 0.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/26/16 5:20 PM, Andres Freund wrote:
I do think there's an order of magnitude between the impact between
moving some and moving everything. And that's going to impact
cost/benefit calculations.Moving e.g. all ephemeral files into a (possibly configurable) directory
is going to hardly impact anyone. Renaming pg_logical into something
different (FWIW, it was originally named differently...) will hopefully
impact nobody, excepting some out of date file exclusion lists possibly.But moving config files, and even pg_xlog (which we document to be
symlinkable somewhere else) imo is different.
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.
I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Aug 27, 2016 at 6:34 AM, Andres Freund <andres@anarazel.de> wrote:
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.
OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter E
As far as I can see, there is a consensus to not rename pg_xlog to
pg_journal and avoid using a third meaning, but instead use pg_wal. I
guess that now the other renaming would be pg_clog -> pg_xact. Other
opinions? Forgot you here?
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 27/08/16 20:33, Michael Paquier wrote:
On Sat, Aug 27, 2016 at 6:34 AM, Andres Freund <andres@anarazel.de> wrote:
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter EAs far as I can see, there is a consensus to not rename pg_xlog to
pg_journal and avoid using a third meaning, but instead use pg_wal. I
guess that now the other renaming would be pg_clog -> pg_xact. Other
opinions? Forgot you here?
I think if there are going to be things in pg that break software - for
good reasons, like making future usage easier at the cost an initial
sharp pain - then to do so in version '10.0.0' is very appropriate! IMHO
And better to do so in 10.0.0 (especially if closely related), rather
than 10.1.0 (or whatever the next version after that is named). So, if
other things might cause breakages, do so IN 10.0.0 - rather than hold
back - assuming that there won't be hundreds or more major breakages!!!
Cheers,
Gavin
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter E
Hm, if you read me as voting against renaming pg_xlog, that wasn't
the conclusion I meant to convey. I'm against moving/renaming the
configuration files, because I think that will break a lot of users'
scripts and habits without really buying much. But I'm for consolidating
all the files that should not be copied by backup tools into one
subdirectory, and I think that while we're doing that it would be sensible
to rename pg_xlog and pg_clog to something that doesn't sound like it's
scratch data. I'm on the fence about whether pg_logical ought to get
renamed.
As far as I can see, there is a consensus to not rename pg_xlog to
pg_journal and avoid using a third meaning, but instead use pg_wal.
Yeah, +1 for pg_wal, we do not need yet another name for that.
I guess that now the other renaming would be pg_clog -> pg_xact.
We already have pg_subtrans, so it seems like pg_trans is an obvious
suggestion. I'm not sure whether the other precedent of pg_multixact
is a stronger one than that.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Michael Paquier wrote:
On Sat, Aug 27, 2016 at 6:34 AM, Andres Freund <andres@anarazel.de> wrote:
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter E
I'm for renaming too, but I'd go with Peter E's suggestion: move pg_xlog
to something like $PGDATA/var/wal or $PGDATA/srv/wal or something like that.
--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
I'm for renaming too, but I'd go with Peter E's suggestion: move pg_xlog
to something like $PGDATA/var/wal or $PGDATA/srv/wal or something like that.
I think that would make sense if we were to relocate *everything* under
PGDATA into some FHS-like subdirectory structure. But I'm against moving
the config files for previously-stated reasons, and I doubt it makes sense
to adopt an FHS-like structure only in part.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/26/16 4:08 PM, Andres Freund wrote:
Splitting of ephemeral data seems to have a benefit, the rest seems more
like rather noisy busywork to me.
People accidentally blowing away pg_clog or pg_xlog is a pretty common
occurrence, and I don't think there's all that many tools that reference
them. I think it's well worth renaming them.
I actually like the idea of re-organizing everything too. It would be
easy to include a tool that puts symlinks in place to all the original
locations if you need that.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 29 Aug 2016 12:10 PM, "Jim Nasby" <Jim.Nasby@bluetreble.com> wrote:
On 8/26/16 4:08 PM, Andres Freund wrote:
Splitting of ephemeral data seems to have a benefit, the rest seems more
like rather noisy busywork to me.People accidentally blowing away pg_clog or pg_xlog is a pretty common
occurrence, and I don't think there's all that many tools that reference
them. I think it's well worth renaming them.
Yeah. I've seen it in BIG production users who really should have known
better.
People won't see a README in amongst 5000 xlog segments while freaking out
about the sever being down.
I don't care if it comes as part of some greater reorg or not but I'll be
really annoyed if scope creep lands up killing the original proposal to
just rename these dirs. I think that a simple rename should be done first.
Then if some greater reorg is to be done it can be done shortly after. The
only people that'll upset are folks tracking early 10.0 dev and they'll be
aware it's coming.
On Mon, Aug 29, 2016 at 2:36 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:
I don't care if it comes as part of some greater reorg or not but I'll be
really annoyed if scope creep lands up killing the original proposal to just
rename these dirs. I think that a simple rename should be done first. Then
if some greater reorg is to be done it can be done shortly after. The only
people that'll upset are folks tracking early 10.0 dev and they'll be aware
it's coming.
Okay, so let's do it. Attached are two patches:
- 0001 renames pg_clog to pg_trans. I have let clog.c with its current
name, as well as its structures. That's the mechanical patch, the ony
interesting part being in pg_upgrade.
- 0002 renames pg_xlog to pg_wal.
--
Michael
Attachments:
0001-Rename-pg_clog-to-pg_trans.patchapplication/x-patch; name=0001-Rename-pg_clog-to-pg_trans.patchDownload
From 74ff97a9520f496e0df303e777ad93d5eca054f5 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Mon, 29 Aug 2016 15:05:46 +0900
Subject: [PATCH 1/2] Rename pg_clog to pg_trans
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 +-
doc/src/sgml/catalogs.sgml | 4 +-
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++--
doc/src/sgml/ref/pg_resetxlog.sgml | 4 +-
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 ++---
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 +-
src/backend/access/transam/README | 12 +++---
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 4 +-
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 +-
src/backend/access/transam/xact.c | 18 ++++----
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 ++---
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 +-
src/backend/utils/time/tqual.c | 6 +--
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 79 +++++++++++++++++++++-------------
src/bin/pg_upgrade/pg_upgrade.c | 30 +++++++------
src/include/access/slru.h | 4 +-
28 files changed, 127 insertions(+), 102 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 0f09d82..18d4bd5 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_trans/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_trans</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 4e09e06..783d49c 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_trans</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,7 +2514,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_trans</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7c483c6..c32da94 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5816,7 +5816,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_trans</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 5148095..626e428 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15312,7 +15312,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_trans | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index 2713883..75f61cd 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -505,18 +505,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_trans</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_trans</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_trans</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_trans</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index fd9d0be..7253b40 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_trans</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_trans</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 42ebfbf..fb64305 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_trans</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1b812bd..1528a2e 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -136,6 +131,11 @@ Item
</row>
<row>
+ <entry><filename>pg_trans</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>pg_twophase</></entry>
<entry>Subdirectory containing state files for prepared transactions</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 503ea8a..fd179ec 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_trans</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 6a27ef4..39a3dc3 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6751,8 +6751,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_trans before we finish
+ * the VACUUM and perhaps truncate off the part of pg_trans he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..f941cfd 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
------------------------
+pg_trans and pg_subtrans
+------------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_trans and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_trans records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_trans and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_trans are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..a6bddd1 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_trans", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index e330105..08a0251 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_trans-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..303acf6 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_trans-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..8962c26 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,7 +3,7 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_trans-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
@@ -11,7 +11,7 @@
* opposite direction.
*
* This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_trans, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..108c1da 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_trans but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 9f55adc..2a51f67 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_trans, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2089,7 +2089,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_trans */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..2f5bf34 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,8 +1206,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_trans. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_trans update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2033,7 +2033,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_trans. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -2539,7 +2539,7 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
+ * Advertise the fact that we aborted in pg_trans (assuming that we got as
* far as assigning an XID to advertise). But if we're inside a parallel
* worker, skip this; the user backend must be the one to write the abort
* record.
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_trans. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_trans.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,7 +5389,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_trans. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5526,7 +5526,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_trans, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5542,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_trans, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index acd95aa..4333903 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8392,7 +8392,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_trans. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..a5babef 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,7 +356,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_trans if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_trans and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_trans and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_trans).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,7 +1086,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_trans is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 1a92ca1..f77aa01 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2394,7 +2394,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_trans if possible. We
* only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..e7dda01 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_trans), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..5ce3a44 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_trans.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_trans to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..c4202e5 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_trans). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_trans before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_trans until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index aad6ba5..ec06e34 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -201,7 +201,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_xlog/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -218,6 +217,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_trans",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index dd30952..5f6a6ea 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
#include <fcntl.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 validate_exec(const char *dir, const char *cmdName);
@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster);
- check_data_dir(old_cluster.pgdata);
+ check_data_dir(&old_cluster);
check_bin_dir(&new_cluster);
- check_data_dir(new_cluster.pgdata);
+ check_data_dir(&new_cluster);
}
@@ -253,6 +253,31 @@ win32_check_directory_write_permissions(void)
/*
+ * 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, getErrorText());
+ else if (!S_ISDIR(statBuf.st_mode))
+ report_status(PG_FATAL, "%s is not a directory\n",
+ subDirName);
+}
+
+/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
@@ -262,34 +287,28 @@ win32_check_directory_write_permissions(void)
*
*/
static void
-check_data_dir(const char *pg_data)
+check_data_dir(ClusterInfo *cluster)
{
- char subDirName[MAXPGPATH];
- int subdirnum;
-
- /* start check with top-most directory */
- const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
- "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
- "pg_xlog"};
-
- for (subdirnum = 0;
- subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
- ++subdirnum)
- {
- struct stat statBuf;
-
- snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
- /* Win32 can't stat() a directory with a trailing slash. */
- *requiredSubdirs[subdirnum] ? "/" : "",
- requiredSubdirs[subdirnum]);
-
- if (stat(subDirName, &statBuf) != 0)
- report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
- subDirName, getErrorText());
- else if (!S_ISDIR(statBuf.st_mode))
- report_status(PG_FATAL, "%s is not a directory\n",
- subDirName);
- }
+ const char *pg_data = cluster->pgdata;
+
+ /* get old and new cluster versions */
+ old_cluster.major_version = get_major_server_version(&old_cluster);
+ new_cluster.major_version = get_major_server_version(&new_cluster);
+
+ check_single_dir(pg_data, "");
+ check_single_dir(pg_data, "base");
+ check_single_dir(pg_data, "global");
+ check_single_dir(pg_data, "pg_multixact");
+ check_single_dir(pg_data, "pg_subtrans");
+ check_single_dir(pg_data, "pg_tblspc");
+ check_single_dir(pg_data, "pg_twophase");
+ check_single_dir(pg_data, "pg_xlog");
+
+ /* pg_clog has been renamed to pg_trans in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_trans");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index fa118e9..dd7a54b 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_trans_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_trans_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_trans_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_trans in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_trans",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_trans");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..e279d0d 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_trans, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_trans and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.9.3
0002-Rename-pg_xlog-to-pg_wal.patchapplication/x-patch; name=0002-Rename-pg_xlog-to-pg_wal.patchDownload
From 02687ad0239f3ba617b78f88cf1630c2b0886a73 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Mon, 29 Aug 2016 15:26:38 +0900
Subject: [PATCH 2/2] Rename pg_xlog to pg_wal
Additional check handling is needed in pg_upgrade regarding the clusters
worked on, except that it is a very mechanical patch.
---
doc/src/sgml/backup.sgml | 28 ++++----
doc/src/sgml/config.sgml | 6 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/high-availability.sgml | 14 ++--
doc/src/sgml/perform.sgml | 2 +-
doc/src/sgml/protocol.sgml | 6 +-
doc/src/sgml/ref/pg_resetxlog.sgml | 10 +--
doc/src/sgml/ref/pg_rewind.sgml | 4 +-
doc/src/sgml/ref/pg_xlogdump.sgml | 2 +-
doc/src/sgml/ref/pgtestfsync.sgml | 4 +-
doc/src/sgml/ref/pgupgrade.sgml | 4 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 10 +--
src/backend/access/transam/timeline.c | 4 +-
src/backend/access/transam/xlog.c | 100 +++++++++++++--------------
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/replication/README | 2 +-
src/backend/replication/basebackup.c | 20 +++---
src/backend/replication/walreceiver.c | 6 +-
src/backend/replication/walsender.c | 4 +-
src/backend/storage/file/fd.c | 16 ++---
src/bin/initdb/initdb.c | 26 +++----
src/bin/pg_basebackup/pg_basebackup.c | 16 ++---
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 6 +-
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +-
src/bin/pg_rewind/copy_fetch.c | 4 +-
src/bin/pg_rewind/filemap.c | 8 +--
src/bin/pg_rewind/parsexlog.c | 2 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 10 +--
src/bin/pg_upgrade/exec.c | 7 +-
src/bin/pg_xlogdump/pg_xlogdump.c | 2 +-
src/include/access/xlog_internal.h | 2 +-
src/include/postmaster/pgarch.h | 2 +-
34 files changed, 171 insertions(+), 166 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 18d4bd5..1fa4d0e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
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
every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the
@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
-test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
+test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
</para>
@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator
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.
- (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
transactions will be lost, but the database will remain offline until
you free some space.)
@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
operation continues even if the archiving process falls a little behind.
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
- 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
disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend.
@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty
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.
</para>
</sect2>
@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para>
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
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
reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information
@@ -1133,7 +1133,7 @@ SELECT pg_stop_backup();
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
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
were not archived before the system went down.
</para>
@@ -1156,9 +1156,9 @@ SELECT pg_stop_backup();
</listitem>
<listitem>
<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.
- 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,
being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before.
@@ -1167,7 +1167,7 @@ SELECT pg_stop_backup();
<listitem>
<para>
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
problem occurs and you have to start over.)
</para>
@@ -1249,9 +1249,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
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
- preference to files in <filename>pg_xlog/</>.
+ preference to files in <filename>pg_wal/</>.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index c32da94..dff2945 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2926,7 +2926,7 @@ include_dir 'conf.d'
<listitem>
<para>
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
replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than
@@ -2940,7 +2940,7 @@ include_dir 'conf.d'
<para>
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
<varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number
@@ -3316,7 +3316,7 @@ include_dir 'conf.d'
<para>
Specify how long the standby server should wait when WAL data is not
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
<filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 626e428..0fd06d6 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15316,7 +15316,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
- pg_xlog | 16
+ pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
pg_subtrans | 19
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 06f49db..5bedaf2 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will
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
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>
At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it
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
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
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
- 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.
</para>
@@ -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
when <command>pg_ctl promote</> is run or a trigger file is found
(<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.
</para>
</sect2>
@@ -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
required, whereas replication slots retain only the number of segments
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.
</para>
<para>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index 7bcbfa7..8d30fd1 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of
- <filename>/pg_xlog</>.
+ <filename>/pg_wal</>.
</para>
</listitem>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 68b0941..800e39d 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para>
Include the necessary WAL segments in the backup. This will include
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.
</para>
</listitem>
@@ -2074,8 +2074,8 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
- <filename>pg_xlog</>, including subdirectories. If the backup is run
- with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be
+ <filename>pg_wal</>, including subdirectories. If the backup is run
+ 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
backup to work, not the rest of the contents.
</para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index 7253b40..6226a33 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -173,22 +173,22 @@ PostgreSQL documentation
<para>
The WAL starting address should be
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
part is the <quote>timeline ID</> and should usually be kept the same.
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>
<note>
<para>
<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
<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
- <filename>pg_xlog</> have been lost entirely.
+ <filename>pg_wal</> have been lost entirely.
</para>
</note>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index fb64305..57ba80f 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -61,14 +61,14 @@ PostgreSQL documentation
<para>
<application>pg_rewind</> examines the timeline histories of the source
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
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
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
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
<application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded
diff --git a/doc/src/sgml/ref/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
index 177caab..cfb6d87 100644
--- a/doc/src/sgml/ref/pg_xlogdump.sgml
+++ b/doc/src/sgml/ref/pg_xlogdump.sgml
@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem>
<para>
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.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 6e134c7..5856356 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -57,8 +57,8 @@
<para>
Specifies the file name to write test data in.
This file should be in the same file system that the
- <filename>pg_xlog</> directory is or will be placed in.
- (<filename>pg_xlog</> contains the <acronym>WAL</> files.)
+ <filename>pg_wal</> directory is or will be placed in.
+ (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current
directory.
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9685193..4b9aab2 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster
once you start the new cluster after the upgrade. Link mode also
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
list of options.
</para>
@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para>
If you have tablespaces, you will need to run a similar
<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.
</para>
</step>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1528a2e..000f3fd 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -141,7 +141,7 @@ Item
</row>
<row>
- <entry><filename>pg_xlog</></entry>
+ <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index fd179ec..79d9986 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -557,7 +557,7 @@
</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
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,
@@ -582,7 +582,7 @@
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
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
uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">).
@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to
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.
Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records.
@@ -734,7 +734,7 @@
<para>
<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
by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally
@@ -751,7 +751,7 @@
<para>
It is advantageous if the log is located on a different disk from 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
original location in the main data directory to the new location.
</para>
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index bd91573..43436a9 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -43,7 +43,7 @@
/*
* Copies all timeline history files with id's between 'begin' and 'end'
- * from archive to pg_xlog.
+ * from archive to pg_wal.
*/
void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
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.
*/
if (fromArchive)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 4333903..6946d4a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -234,9 +234,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process.
*
* 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
- * WAL in pg_xlog.
+ * WAL in pg_wal.
*/
bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false;
@@ -697,12 +697,12 @@ typedef enum
{
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
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 */
} XLogSource;
/* 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.
@@ -3342,7 +3342,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery).
*
* 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
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
@@ -3371,7 +3371,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1;
break;
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno);
restoredFromArchive = false;
@@ -3390,7 +3390,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
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);
}
@@ -3478,10 +3478,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,
- XLOG_FROM_PG_XLOG, true);
+ XLOG_FROM_PG_WAL, true);
if (fd != -1)
{
if (!expectedTLEs)
@@ -3690,10 +3690,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
*
* 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
- * 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
* 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
* successfully replayed them, but from others we can't be sure.
*
@@ -3850,15 +3850,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.
*
* 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
- * 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
- * policy decision was made not to. It is fairly common for pg_xlog to be
+ * 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_wal to be
* a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice.
*/
@@ -3868,7 +3868,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH];
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 ||
!S_ISDIR(stat_buf.st_mode))
ereport(FATAL,
@@ -4024,11 +4024,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the
* 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
- * pg_xlog, however (!fetch_ckpt). We could recover using the WAL
- * from the archive, even if pg_xlog is completely empty, but we'd
+ * pg_wal, however (!fetch_ckpt). We could recover using the WAL
+ * 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.
* So err on the safe side and give up.
*/
@@ -4036,7 +4036,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt)
{
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;
if (StandbyModeRequested)
StandbyMode = true;
@@ -4153,7 +4153,7 @@ rescanLatestTimeLine(void)
/*
* 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);
@@ -5166,7 +5166,7 @@ readRecoveryCommandFile(void)
ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
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
{
@@ -5982,7 +5982,7 @@ StartupXLOG(void)
#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
* excluded and need to be re-created.
*/
@@ -6190,7 +6190,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file.
*
* 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.
*
* But usually we already know how far we need to replay the WAL (up
@@ -6394,7 +6394,7 @@ StartupXLOG(void)
/*
* 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
* covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL
@@ -7015,7 +7015,7 @@ StartupXLOG(void)
/*
* 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, e.g., timeline history file) from archive or pg_xlog.
+ * recovery, e.g., timeline history file) from archive or pg_wal.
*/
StandbyMode = false;
@@ -7297,7 +7297,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read
* .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,
* too.
*
@@ -9862,7 +9862,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
* first WAL segment containing the startup checkpoint has pages in
* 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
- * 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.
*
* This also ensures that we have emitted a WAL page header that has
@@ -10509,7 +10509,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
* archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with
* 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
* gets all the required WAL.
*
@@ -11099,9 +11099,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'.
*
* 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
- * pg_xlog 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
+ * streamed the record, or it can already be present in pg_wal. Checking
+ * 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_wal. That is not
* documented or recommended, though.
*
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
@@ -11131,8 +11131,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*-------
* Standby mode is implemented by a state machine:
*
- * 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just
- * pg_xlog (XLOG_FROM_XLOG)
+ * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
+ * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines
@@ -11148,7 +11148,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*-------
*/
if (!InArchiveRecovery)
- currentSource = XLOG_FROM_PG_XLOG;
+ currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE;
@@ -11167,13 +11167,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
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
* do this only after failure, so when you create the
* 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())
{
@@ -11183,7 +11183,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Not in standby mode, and we've now tried the archive
- * and pg_xlog.
+ * and pg_wal.
*/
if (!StandbyMode)
return false;
@@ -11243,7 +11243,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but
* PANIC is not good for availability either, especially
* 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
* streamed, so it's unlikely that it helps, but one can
* hope...
@@ -11304,11 +11304,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
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
- * the archive over ones in pg_xlog, so try the next file again
+ * We just successfully read a file in pg_wal. We prefer files in
+ * the archive over ones in pg_wal, so try the next file again
* from the archive first.
*/
if (InArchiveRecovery)
@@ -11329,7 +11329,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
case XLOG_FROM_ARCHIVE:
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */
if (readFile >= 0)
{
@@ -11342,7 +11342,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Try to restore the file from archive, or read an existing
- * file from pg_xlog.
+ * file from pg_wal.
*/
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
@@ -11351,7 +11351,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */
/*
- * Nope, not found in archive or pg_xlog.
+ * Nope, not found in archive or pg_wal.
*/
lastSourceFailed = true;
break;
@@ -11407,7 +11407,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history
* file if we haven't initialized timeline history
* 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
* isn't changed.
*/
@@ -11439,10 +11439,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Note that we don't "return false" immediately here.
* 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
* 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.
*/
lastSourceFailed = true;
@@ -11482,7 +11482,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* 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
* 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,
* and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it.
@@ -11497,7 +11497,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{
static XLogRecPtr lastComplaint = 0;
- if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
+ if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{
if (RecPtr == lastComplaint)
emode = DEBUG1;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d153a44..b919164 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/*
* 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
- * 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
KeepFileRestoredFromArchive(char *path, char *xlogfname)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 33383b4..01cbd90 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump
*
* 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
* 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
diff --git a/src/backend/replication/README b/src/backend/replication/README
index ad4864d..0cbb990 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart.
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.
Walreceiver sends information about replication progress to the master server
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index da9b7a6..3ffc665 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -276,7 +276,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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',
* regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in
@@ -289,11 +289,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno);
- dir = AllocateDir("pg_xlog");
+ dir = AllocateDir("pg_wal");
if (!dir)
ereport(ERROR,
- (errmsg("could not open directory \"%s\": %m", "pg_xlog")));
- while ((de = ReadDir(dir, "pg_xlog")) != NULL)
+ (errmsg("could not open directory \"%s\": %m", "pg_wal")));
+ while ((de = ReadDir(dir, "pg_wal")) != NULL)
{
/* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) &&
@@ -331,7 +331,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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.
*/
if (nWalFiles < 1)
@@ -988,15 +988,15 @@ 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
* we get permissions right.
*/
- if (strcmp(pathbuf, "./pg_xlog") == 0)
+ if (strcmp(pathbuf, "./pg_wal") == 0)
{
if (!sizeonly)
{
- /* If pg_xlog is a symlink, write it as a directory anyway */
+ /* If pg_wal is a symlink, write it as a directory anyway */
#ifndef WIN32
if (S_ISLNK(statbuf.st_mode))
#else
@@ -1012,10 +1012,10 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
* statbuf from above ...).
*/
if (!sizeonly)
- _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf);
+ _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf);
size += 512; /* Size of the header just added */
- continue; /* don't recurse into pg_xlog */
+ continue; /* don't recurse into pg_wal */
}
/* Allow symbolic links in pg_tblspc only */
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 413ee3a..d40b5e9 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new
* 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
* nudge the existing walreceiver process that's waiting, instead of launching
* a new one.
@@ -364,7 +364,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await
* 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
* on the new timeline.
*/
@@ -739,7 +739,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli)));
/*
- * Write the file to pg_xlog.
+ * Write the file to pg_wal.
*/
writeTimeLineHistoryFile(tli, content, len);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 1ea2a5c..34e4dd0 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* 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
* 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
* that's older than the switchpoint, if it's still in the same
@@ -2052,7 +2052,7 @@ retry:
*
* For example, imagine that this server is currently on timeline
* 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
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03143f1..b7ff5ef 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
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.
*/
xlog_is_symlink = false;
@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{
struct stat st;
- if (lstat("pg_xlog", &st) < 0)
+ if (lstat("pg_wal", &st) < 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
- "pg_xlog")));
+ "pg_wal")));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction("pg_xlog"))
+ if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true;
#endif
@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1);
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);
#endif
@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(".", datadir_fsync_fname, false, LOG);
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);
}
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index ec06e34..08e7338 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -200,7 +200,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
- "pg_xlog/archive_status",
+ "pg_wal/archive_status",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -2281,7 +2281,7 @@ make_postgres(FILE *cmdfd)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2291,17 +2291,17 @@ static void
fsync_pgdata(void)
{
bool xlog_is_symlink;
- char pg_xlog[MAXPGPATH];
+ char pg_wal[MAXPGPATH];
char pg_tblspc[MAXPGPATH];
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- snprintf(pg_xlog, MAXPGPATH, "%s/pg_xlog", pg_data);
+ snprintf(pg_wal, MAXPGPATH, "%s/pg_wal", 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.
*/
xlog_is_symlink = false;
@@ -2310,14 +2310,14 @@ fsync_pgdata(void)
{
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"),
- progname, pg_xlog, strerror(errno));
+ progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction(pg_xlog))
+ if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true;
#endif
@@ -2328,7 +2328,7 @@ fsync_pgdata(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false);
if (xlog_is_symlink)
- walkdir(pg_xlog, pre_sync_fname, false);
+ walkdir(pg_wal, pre_sync_fname, false);
walkdir(pg_tblspc, pre_sync_fname, true);
#endif
@@ -2336,14 +2336,14 @@ fsync_pgdata(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(pg_data, fsync_fname_ext, false);
if (xlog_is_symlink)
- walkdir(pg_xlog, fsync_fname_ext, false);
+ walkdir(pg_wal, fsync_fname_ext, false);
walkdir(pg_tblspc, fsync_fname_ext, true);
check_ok();
@@ -3087,7 +3087,7 @@ create_xlog_or_symlink(void)
char *subdirloc;
/* 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)
{
@@ -3220,7 +3220,7 @@ initialize_data_directory(void)
create_xlog_or_symlink();
- /* Create required subdirectories (other than pg_xlog) */
+ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... "));
fflush(stdout);
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 351a420..74cdac5 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -445,14 +445,14 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */
exit(1);
- snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/pg_xlog", basedir);
+ snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/pg_wal", basedir);
/*
- * Create pg_xlog/archive_status (and thus pg_xlog) so we can write to
- * basedir/pg_xlog as the directory entry in the tar file may arrive
+ * Create pg_wal/archive_status (and thus pg_wal) so we can write to
+ * basedir/pg_wal 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/pg_wal/archive_status",
basedir);
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
@@ -1249,14 +1249,14 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0)
{
/*
- * When streaming WAL, pg_xlog will have been created
+ * When streaming WAL, pg_wal will have been created
* by the wal receiver process. Also, when transaction
- * log directory location was specified, pg_xlog has
+ * log directory location was specified, pg_wal has
* already been created as a symbolic link before
* starting the actual 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")) &&
errno == EEXIST))
{
@@ -2180,7 +2180,7 @@ main(int argc, char **argv)
verify_dir_is_empty_or_create(xlog_dir);
/* form name of the place where the symlink must go */
- linkloc = psprintf("%s/pg_xlog", basedir);
+ linkloc = psprintf("%s/pg_wal", basedir);
#ifdef HAVE_SYMLINK
if (symlink(xlog_dir, linkloc) != 0)
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 6c33936..11642e4 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -52,7 +52,7 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
ok(-f "$tempdir/backup/PG_VERSION", 'backup was created');
is_deeply(
- [ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ],
+ [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ],
'no WAL files copied');
@@ -182,12 +182,12 @@ like(
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'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');
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'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');
$node->command_fails(
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 525b82ba..2b76f64 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
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
* conservative, because of xlog.c's attempts to pre-create files.
*/
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 327e7ef..d0c1586 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -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,
* 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) ||
- strcmp(path, "pg_xlog") == 0)
+ strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
#else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 9b00dc1..3905a5d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
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
* 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;
/*
@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type)
{
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.. */
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,
/*
* 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;
key.path = (char *) path;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index b53591d..23ac4e7 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
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
* the data blocks touched by the WAL records, and return them in a page map.
*/
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index bdcab56..12950ea 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -1,5 +1,5 @@
#
-# 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 warnings;
@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir;
- # turn pg_xlog into a symlink
- print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n");
- move("$test_master_datadir/pg_xlog", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die;
+ # turn pg_wal into a symlink
+ print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
+ move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
+ symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master();
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 5f6a6ea..9621d21 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -302,7 +302,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_subtrans");
check_single_dir(pg_data, "pg_tblspc");
check_single_dir(pg_data, "pg_twophase");
- check_single_dir(pg_data, "pg_xlog");
+
+ /* pg_xlog has been renamed to pg_wal in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_xlog");
+ else
+ check_single_dir(pg_data, "pg_wal");
/* pg_clog has been renamed to pg_trans in post-10 cluster */
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
index 02575eb..abc6fb9 100644
--- a/src/bin/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -656,7 +656,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\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(" (default: ./pg_xlog)\n");
+ printf(" (default: ./pg_wal)\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(" -s, --start=RECPTR start reading at log position RECPTR\n");
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 0a595cc..ceb0462 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/*
* The XLog directory and control file (relative to $PGDATA)
*/
-#define XLOGDIR "pg_xlog"
+#define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control"
/*
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index f2cbfb3..6df73c9 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -16,7 +16,7 @@
/* ----------
* 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
* appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended.
--
2.9.3
On Mon, Aug 29, 2016 at 2:45 AM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
On 8/26/16 4:08 PM, Andres Freund wrote:
Splitting of ephemeral data seems to have a benefit, the rest seems more
like rather noisy busywork to me.People accidentally blowing away pg_clog or pg_xlog is a pretty common
occurrence, and I don't think there's all that many tools that reference
them. I think it's well worth renaming them.
Pretty sure every single backup tool or script out there is referencing
pg_xlog. If it's not, then it's broken...
pg_clog is a different story of course.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On 29 August 2016 at 14:30, Michael Paquier <michael.paquier@gmail.com> wrote:
On Mon, Aug 29, 2016 at 2:36 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:I don't care if it comes as part of some greater reorg or not but I'll be
really annoyed if scope creep lands up killing the original proposal to just
rename these dirs. I think that a simple rename should be done first. Then
if some greater reorg is to be done it can be done shortly after. The only
people that'll upset are folks tracking early 10.0 dev and they'll be aware
it's coming.Okay, so let's do it. Attached are two patches:
- 0001 renames pg_clog to pg_trans. I have let clog.c with its current
name, as well as its structures. That's the mechanical patch, the ony
interesting part being in pg_upgrade.
- 0002 renames pg_xlog to pg_wal.
Is there any expectation that a 10.0 pg_basebackup should work on a
9.x server, or fail to work gracefully? There doesn't look to be any
version specific handling of the rename there.
Otherwise looks good.
Doesn't upset 'make check' or the TAP recovery suite.
Works:
src/test/regress/tmp_check/data $ ls
base pg_commit_ts pg_hba.conf pg_logical pg_notify
pg_serial pg_stat pg_subtrans pg_trans PG_VERSION
postgresql.auto.conf postmaster.opts
global pg_dynshmem pg_ident.conf pg_multixact pg_replslot
pg_snapshots pg_stat_tmp pg_tblspc pg_twophase pg_wal
postgresql.conf
It leaves pg_xlogfilename etc with original names as it IMO should.
There's no need to break more than we have to and it's still the xlog.
The documentation on backup/restore might benefit from a note saying
that pg_wal was named pg_xlog prior to 10.0 so tools intended to work
on older versions should check PG_VERSION. Though in practice most
people who write new tools will target 10.0+ and people maintaining
older tools will know, so it's not a big deal.
I don't know if the renaming in XLogFileRead of XLOG_FROM_PG_XLOG =>
XLOG_FROM_PG_WAL is really necessary, but tend to think it's good
since that define explicitly refers to the directory name, not
transaction logs in general.
The patch does not update the translations. I wonder if it's worth
doing so to save translators the hassle by sed'ing the following
lines:
- 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.")));
- (errmsg("could not open directory
\"%s\": %m", "pg_xlog")));
+ (errmsg("could not open directory
\"%s\": %m", "pg_wal")));
with
sed -i 's/\<pg_xlog\>/pg_wal/g' src/backend/po/*.po
?
src/backend/access/transam/README should probably have a note about the rename.
Looks like changes in pg_upgrade for clog are a bit more than the
mechanical changes elsewhere, but seem sensible to me. I haven't yet
done a test pg_upgrade run.
--
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 27/08/16 18:50, Tom Lane wrote:
Michael Paquier <michael.paquier@gmail.com> writes:
OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter EI'm against moving/renaming the
configuration files, because I think that will break a lot of users'
scripts and habits without really buying much.
I don't agree with this part, mainly because there is significant number
of installations (everything that uses debian/ubuntu scripts) that
already don't have configuration files inside the data directory.
On the other matters:
+1 for renaming pg_xlog to pg_wal and pg_clog to pg_xact/trans (don't
care really which one)
And +1 for renaming pg_logical to something more reasonable.
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Aug 29, 2016 at 5:28 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:
On 29 August 2016 at 14:30, Michael Paquier <michael.paquier@gmail.com> wrote:
On Mon, Aug 29, 2016 at 2:36 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:I don't care if it comes as part of some greater reorg or not but I'll be
really annoyed if scope creep lands up killing the original proposal to just
rename these dirs. I think that a simple rename should be done first. Then
if some greater reorg is to be done it can be done shortly after. The only
people that'll upset are folks tracking early 10.0 dev and they'll be aware
it's coming.Okay, so let's do it. Attached are two patches:
- 0001 renames pg_clog to pg_trans. I have let clog.c with its current
name, as well as its structures. That's the mechanical patch, the ony
interesting part being in pg_upgrade.
- 0002 renames pg_xlog to pg_wal.Is there any expectation that a 10.0 pg_basebackup should work on a
9.x server, or fail to work gracefully? There doesn't look to be any
version specific handling of the rename there.
Oops. Per the docs:
pg_basebackup works with servers of the same or an older major
version, down to 9.1. However, WAL streaming mode (-X stream) only
works with server version 9.3 and later, and tar format mode
(--format=tar) of the current version only works with server version
9.5 or later.
So we need to do a bit better than what the patch proposes, but that's
actually just tweaking the things with pg_xlog/pg_wal depending on the
version of the target server.
The patch does not update the translations. I wonder if it's worth
doing so to save translators the hassle by sed'ing the following
lines:
sed -i 's/\<pg_xlog\>/pg_wal/g' src/backend/po/*.po
?
Yes I was wondering about that... But concluded that normally the
translation updates would just do it. It is not complicated to update
if need be anyway.
src/backend/access/transam/README should probably have a note about the rename.
Good idea.
Looks like changes in pg_upgrade for clog are a bit more than the
mechanical changes elsewhere, but seem sensible to me. I haven't yet
done a test pg_upgrade run.
I have tested that FWIW using 10devel -> 10devel, 9.5 -> 10devel, 9.4
-> 10devel. There are versions of 10devel using pg_xlog and others
pg_wal if this patch is introduced. I am aware of the fact that
pg_upgrade supports upgrades for the same major version though it
seems to me that we would not want to support this scenario, which is
why it would be good to get this patch at the beginning of the dev
cycle.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 29 August 2016 at 20:28, Michael Paquier <michael.paquier@gmail.com> wrote:
On Mon, Aug 29, 2016 at 5:28 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:On 29 August 2016 at 14:30, Michael Paquier <michael.paquier@gmail.com> wrote:
On Mon, Aug 29, 2016 at 2:36 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:I don't care if it comes as part of some greater reorg or not but I'll be
really annoyed if scope creep lands up killing the original proposal to just
rename these dirs. I think that a simple rename should be done first. Then
if some greater reorg is to be done it can be done shortly after. The only
people that'll upset are folks tracking early 10.0 dev and they'll be aware
it's coming.Okay, so let's do it. Attached are two patches:
- 0001 renames pg_clog to pg_trans. I have let clog.c with its current
name, as well as its structures. That's the mechanical patch, the ony
interesting part being in pg_upgrade.
- 0002 renames pg_xlog to pg_wal.Is there any expectation that a 10.0 pg_basebackup should work on a
9.x server, or fail to work gracefully? There doesn't look to be any
version specific handling of the rename there.Oops. Per the docs:
pg_basebackup works with servers of the same or an older major
version, down to 9.1. However, WAL streaming mode (-X stream) only
works with server version 9.3 and later, and tar format mode
(--format=tar) of the current version only works with server version
9.5 or later.So we need to do a bit better than what the patch proposes, but that's
actually just tweaking the things with pg_xlog/pg_wal depending on the
version of the target server.
Cool. I'll mark as waiting on author pending that.
It'll be good to get this footgun put away.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Craig Ringer wrote:
People won't see a README in amongst 5000 xlog segments while
freaking out about the sever being down.
Maybe they're more likely to google "pg_xlog".
BTW, renaming it will not help with respect to that, as
there's a pretty good corpus on knowledge linked to that
particular keyword.
The first google results of "pg_xlog" are, for me:
- Solving pg_xlog out of disk space problem on Postgres
- PostgreSQL: Documentation: 9.1: WAL Internals
- Why is my pg_xlog directory so huge? - PostgreSQL
- Database Soup: Don't delete pg_xlog
...
That's spot-on. For each person deleting stuff in pg_xlog and then
regretting it, how many look it up in the above results and avoid
making the mistake? Will they find comparable results if the
directory is "wal" ?
Aside from that, we might also question how much of the excuse
"pg_xlog looked like it was just deletable logs" is a lie made up
after the fact, because anybody wrecking a database is not against
deflecting a bit of the blame to the software, that's human.
The truth being that they took the gamble that postgres
will somehow recover from the deletion, at the risk of possibly
loosing the latest transactions. That doesn't necessarily look
so bad when current transactions are failing anyway for lack of disk
space, users are yelling at you, and you're frantically searching for
anything to delete in the FS to come back online quickly.
Personally I'm quite skeptical of the *name* of the directory
playing that much of a role in this scenario.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/27/2016 11:11 AM, Tom Lane wrote:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
I'm for renaming too, but I'd go with Peter E's suggestion: move pg_xlog
to something like $PGDATA/var/wal or $PGDATA/srv/wal or something like that.I think that would make sense if we were to relocate *everything* under
PGDATA into some FHS-like subdirectory structure. But I'm against moving
the config files for previously-stated reasons, and I doubt it makes sense
to adopt an FHS-like structure only in part.
I think that is a very reasonable suggestion.
Also as a note to the idea that we make break things for external user
space; the next version being v10 is the exact time to do that.
JD
regards, tom lane
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/29/2016 12:04 AM, Magnus Hagander wrote:
On Mon, Aug 29, 2016 at 2:45 AM, Jim Nasby <Jim.Nasby@bluetreble.com
<mailto:Jim.Nasby@bluetreble.com>> wrote:On 8/26/16 4:08 PM, Andres Freund wrote:
Splitting of ephemeral data seems to have a benefit, the rest
seems more
like rather noisy busywork to me.People accidentally blowing away pg_clog or pg_xlog is a pretty
common occurrence, and I don't think there's all that many tools
that reference them. I think it's well worth renaming them.Pretty sure every single backup tool or script out there is referencing
pg_xlog. If it's not, then it's broken...
No, not really. Consider a filesytem backup using archiving and base
backups. It doesn't care one lick about pg_xlog. And I guarantee you
that there are tons of people running a backup like that considering the
same script would work all the way back to 8.2 (.1?).
Sincerely,
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/29/2016 06:42 AM, Daniel Verite wrote:
Aside from that, we might also question how much of the excuse
"pg_xlog looked like it was just deletable logs" is a lie made up
after the fact, because anybody wrecking a database is not against
deflecting a bit of the blame to the software, that's human.The truth being that they took the gamble that postgres
will somehow recover from the deletion, at the risk of possibly
loosing the latest transactions. That doesn't necessarily look
so bad when current transactions are failing anyway for lack of disk
space, users are yelling at you, and you're frantically searching for
anything to delete in the FS to come back online quickly.
Personally I'm quite skeptical of the *name* of the directory
playing that much of a role in this scenario.
Oh it makes perfect sense.
User who isn't a postgres/database person installs X software. X
software uses PostgreSQL and you have read on the intertubes about how
Postgres is awesome. So you install it, get everything up and running
from the README.md on Github. You walk away.
A year later, after it becomes crucial to whatever it is you do the
system crashes. You have no idea what is going on, you just set this up
on some recycled server or VM. You log in, see that all the space and
you find that you are using a ton of disk space. You look around for
anything you can delete. You find a directory called pg_xlog, it says
log, junior ignorant, don't want to be a sysadmin 101 says, "delete logs".
Boom, crushed server. Let us not forget that by far the number of
PostgreSQL users we have, have never done ANYTHING with postgres except
make it so something like Drupal can connect to it.
JD
Best regards,
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
"Joshua D. Drake" <jd@commandprompt.com> writes:
Also as a note to the idea that we make break things for external user
space; the next version being v10 is the exact time to do that.
Let's please drop this meme that "v10 is a great time to break things".
We don't want this to be any worse than any other major-version upgrade.
If we throw thirty different major incompatibilities in at once, we're
going to be hearing about how painful it was for the next decade, even if
any one of them individually would have been manageable. Or, if we make
the pain factor too high, users will simply not upgrade, and we'll be
faced with demands that we support 9.6 forever.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/27/16 4:33 AM, Michael Paquier wrote:
On Sat, Aug 27, 2016 at 6:34 AM, Andres Freund <andres@anarazel.de> wrote:
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter EAs far as I can see, there is a consensus to not rename pg_xlog to
pg_journal and avoid using a third meaning, but instead use pg_wal. I
guess that now the other renaming would be pg_clog -> pg_xact. Other
opinions? Forgot you here?
I'm definitely +1 for a hard break (internal links are a pain). Ideally
I'd would like to see:
pg_xlog -> pg_wal
pg_clog -> pg_xact
pg_logical -> pg_replgcl
pg_logical is a special case because it contains both ephemeral and
persistent files. I'd like to see the temporary files in
pg_tmp/pg_replgcl (or whatever it gets renamed to) but that means that
pg_tmp must be on the same device to get atomic renames. It would be
enough if pg_replgcl had a pgsql_tmp subdirectory so temp files are
excluded from backups with the current logic.
I'm also in favor of leaving configuration files where they are because
these are the files that are most likely to be checked/manipulated in
various user scripts (other than pg_xlog) of course.
As Stephen mentioned I would like to see purely ephemeral data moved
into its own directory. Maybe $PGDATA/pg_tmp?
pg_subtrans -> pg_tmp/pg_subxact
pg_stat_tamp -> pg_tmp/pg_stat
pg_dynshmem -> pg_tmp/pg_dynshmem (or pg_shmem?)
pg_notify -> pg_tmp/pg_notify
pg_replslot -> pg_tmp/pg_repslot
pg_serial -> pg_tmp/pg_serial
pg_snapshots -> pg_tmp/pg_snapshot
It would be helpful if we had consistent temp directory naming
everywhere so it's clear what to exclude when it is not practical to put
files in the root pg_tmp. As such I would rename pgsql_tmp to pg_tmp in
base and pg_tblspc/*/*/.
--
-David
david@pgmasters.net
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi,
On 2016-08-29 11:18:38 -0400, David Steele wrote:
pg_logical -> pg_replgcl
That seems considerably worse.
pg_replslot -> pg_tmp/pg_repslot
That's most certainly not ephemeral. Just because something isn't
generally appropriate on a standby, doesn't, by far, mean it's ephemeral.
Greetings,
Andres Freund
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
On 2016-08-29 11:18:38 -0400, David Steele wrote:
pg_replslot -> pg_tmp/pg_repslot
That's most certainly not ephemeral. Just because something isn't
generally appropriate on a standby, doesn't, by far, mean it's ephemeral.
Do we need to account for both of those concepts explicitly?
The original point here was to simplify figuring out what needed to be
copied in base backups. I'm not sure whether we really need a marker
for what's going to be flushed at restart.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/29/16 11:35 AM, Andres Freund wrote:
On 2016-08-29 11:18:38 -0400, David Steele wrote:
pg_logical -> pg_replgcl
That seems considerably worse.
Fair enough. I was just trying to throw something out there to get rid
of the "log" in logical.
pg_replslot -> pg_tmp/pg_repslot
That's most certainly not ephemeral. Just because something isn't
generally appropriate on a standby, doesn't, by far, mean it's ephemeral.
Yes, ephemeral was a poor choice of words. I really meant "can be
excluded from backups".
--
-David
david@pgmasters.net
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2016-08-29 12:07:51 -0400, David Steele wrote:
pg_replslot -> pg_tmp/pg_repslot
That's most certainly not ephemeral. Just because something isn't
generally appropriate on a standby, doesn't, by far, mean it's ephemeral.Yes, ephemeral was a poor choice of words. I really meant "can be
excluded from backups".
Then it most certainly can't be called pg_tmp, that'll just invite
people to rm -rf it. And then they'll be screwed.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/29/2016 08:07 AM, Tom Lane wrote:
"Joshua D. Drake" <jd@commandprompt.com> writes:
Also as a note to the idea that we make break things for external user
space; the next version being v10 is the exact time to do that.Let's please drop this meme that "v10 is a great time to break things".
We don't want this to be any worse than any other major-version upgrade.
The moment you break backward compatibility, it will be worse. We are
talking about breaking backward compatibility. So let's just accept it
as it is, there is a mentality about a major jump. A major jump
(9.6->10) is *the* perfect time to make world changing, changes.
If we throw thirty different major incompatibilities in at once, we're
going to be hearing about how painful it was for the next decade, even if
any one of them individually would have been manageable. Or, if we make
the pain factor too high, users will simply not upgrade, and we'll be
faced with demands that we support 9.6 forever.
Whiners always find a reason to whine.
Let's be on two feet here. I am not saying we should jump to using json
notation for our next release. I am simply stating that any largish
(even if it is a small patch) changes to expected behavior should be
done with care. We have a window because no matter how much you yell, I
yell, Magnus yells, or anybody else yells; the telling story will be,
"10.0 is a huge jump from 9.6". Most people *WOULD NOT CARE* if we only
changed one thing. They care that we jumped 4 releases. That type of
communication implies BIG CHANGES.
Whether you like it or not. Whether I like it or not.
Sincerely,
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Aug 27, 2016 at 5:33 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Sat, Aug 27, 2016 at 6:34 AM, Andres Freund <andres@anarazel.de> wrote:
On 2016-08-26 17:31:14 -0400, Peter Eisentraut wrote:
I agree with all that. But the subject line is specifically about
moving pg_xlog. So if your opinion is that we shouldn't move pg_xlog,
then that is noted. But if we were to move it, we can think about a
good place to move it to.I think it's probably worth moving pg_xlog, because the benefit also
includes preventing a few users from shooting themselves somewhere
vital. That's imo much less the case for some of the other moves. But I
still don't think think a largescale reorganization is a good idea,
it'll just stall and nothing will happen.OK, so let's focus only on the renaming mentioned in $subject. So far
as I can see on this thread, here are the opinions of people who
clearly gave one:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
- Rename them, hard break not OK: Fujii-san (perhaps do nothing?)
- Do nothing: Simon (add a README), Tom, Peter E
I vote for "do nothing".
First of all, I can't have much hope for that renaming the directories really
prevents "careless" users from wrongly deleting the important files.
Regards,
--
Fujii Masao
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Aug 27, 2016 at 2:03 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
- Rename them, hard break is OK: Michael P, Bruce, Stephen (depends on
David's input), Magnus
I'm in favor of this. But I don't like Peter's proposal to use a more
complicated structure. As for the new names, how about pg_wal and
pg_xact? I don't think "pg_trans" is as good; is it transactional or
transient or transport or transitive or what?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Joshua D. Drake wrote:
You log in, see that all the space and you find that you are using a
ton of disk space. You look around for anything you can delete. You
find a directory called pg_xlog, it says log, junior ignorant, don't
want to be a sysadmin 101 says, "delete logs".
Yes, it happens. I don't deny the problem, but I'm wondering
about the wishful thinking we're possibly falling into here
concerning the solution.
Let's imagine that pg_xlog is named wal instead.
How does that help our user with the disk space problem?
Does that point to a path of resolution? I don't see it.
What do we think that user's next move will be?
After all, WAL means Write Ahead *Log*.
On the other hand, by decommissioning pg_xlog as a name,
that makes it obsolete in all presentations, tutorials, docs
that refer to that directory, and there are many of them.
There are years of confusion ahead with questions like
"where is that pg_xlog directory that I'm supposed to
monitor, or move into a different partition, etc...",
for a benefit that remains to be seen.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 08/29/2016 10:00 AM, Daniel Verite wrote:
Let's imagine that pg_xlog is named wal instead.
How does that help our user with the disk space problem?
Does that point to a path of resolution? I don't see it.
What do we think that user's next move will be?
After all, WAL means Write Ahead *Log*.
If, they look it up (which they would likely have to) they will see it
isn't removable. :D That is the point I am making. If it is called xlog
the brain says "logs". If it says wal the brain says, "What is wal?"
At that point they have to look it up and then if they still delete it;
well that is what emergency rates are for :P
Sincerely,
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Aug 26, 2016 at 05:14:36PM +0200, Magnus Hagander wrote:
On Aug 26, 2016 5:13 PM, "Joshua D. Drake" <jd@commandprompt.com> wrote:
On 08/25/2016 07:39 PM, Michael Paquier wrote:
Hi all,
I am relaunching $subject as 10 development will begin soon. As far as
I know, there is agreement that we can do something here. Among the
different proposals I have found:
- pg_clog renamed to pg_commit_status, pg_xact or pg_commit
- pg_xlog renamed to pg_xjournal, pg_wal or pg_journalI think the use of the pg_ prefix is redundant. Just a directory called: wal
will do (for example).
In reference to pg_xlog specifically, it should be wal. It is the Write Ahead
Log, not the Journal (although I recognize they can be synonymous). All the
documentation talks about Write Ahead Log.Yes, let's avoid inventing a *third* name for it, please. It's already bad
enough that we have both wal and xlog.
As far as removing 'pg_', consider that many users place pg_xlog on a
different device, so using "wal" would not be clear it was related to
Postgres. Perhaps we can have initdb --xlogdir use pg_wal, and maybe
document this suggestion.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/27/16 1:11 PM, Tom Lane wrote:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
I'm for renaming too, but I'd go with Peter E's suggestion: move pg_xlog
to something like $PGDATA/var/wal or $PGDATA/srv/wal or something like that.I think that would make sense if we were to relocate *everything* under
PGDATA into some FHS-like subdirectory structure. But I'm against moving
the config files for previously-stated reasons, and I doubt it makes sense
to adopt an FHS-like structure only in part.
What if we left symlinks for the config files? Or perhaps even better,
provide a tool that will create them for people that actually need them.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2016-08-29 19:27:29 -0500, Jim Nasby wrote:
On 8/27/16 1:11 PM, Tom Lane wrote:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
I'm for renaming too, but I'd go with Peter E's suggestion: move pg_xlog
to something like $PGDATA/var/wal or $PGDATA/srv/wal or something like that.I think that would make sense if we were to relocate *everything* under
PGDATA into some FHS-like subdirectory structure. But I'm against moving
the config files for previously-stated reasons, and I doubt it makes sense
to adopt an FHS-like structure only in part.What if we left symlinks for the config files? Or perhaps even better,
provide a tool that will create them for people that actually need
them.
See the thread around
http://archives.postgresql.org/message-id/20160826104446.n3cif4m7modslkrs%40msg.df7cb.de
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/29/16 12:54 PM, Robert Haas wrote:
As for the new names, how about pg_wal and
pg_xact? I don't think "pg_trans" is as good; is it transactional or
transient or transport or transitive or what?
pg_transaction_status? (or pg_xact_status if you want to keep it short)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 8/28/16 8:45 PM, Jim Nasby wrote:
People accidentally blowing away pg_clog or pg_xlog is a pretty common
occurrence, and I don't think there's all that many tools that reference
them. I think it's well worth renaming them.
I think a related problem is that the default log directory is called
"pg_log", which is very similar to those other two. There is no quick
way to tell their meaning apart.
I would consider changing the default from "pg_log" to "log". Then we'd
also be at the point where we can say, everything starting with "pg_" is
internal, don't touch it.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Aug 29, 2016 at 9:39 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:
Cool. I'll mark as waiting on author pending that.
It'll be good to get this footgun put away.
OK, so done. I have put the renaming of pg_xlog to pg_wal on top patch
stack as that's the one making no discussion it seems: a lot of people
like pg_wal. I have added as well handling for the renaming in
pg_basebackup by using PQserverVersion. One thing to note is that a
connection needs to be made to the target server *before* creating the
soft link of pg_xlog/pg_wal because we need to know the version of the
target server. pg_upgrade is handled as well. And that's all in 0001.
Patch 0002 does pg_clog -> pg_trans, "trans" standing for
"transaction". Switching to pg_trans_status or pg_xact_status is not
that complicated to change anyway...
--
Michael
Attachments:
0002-Rename-pg_clog-to-pg_trans.patchapplication/x-patch; name=0002-Rename-pg_clog-to-pg_trans.patchDownload
From 9806c07cbb5bd31946b48274dde8b5db65aa6169 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Mon, 29 Aug 2016 15:05:46 +0900
Subject: [PATCH 2/2] Rename pg_clog to pg_trans
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 ++--
doc/src/sgml/catalogs.sgml | 4 ++--
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++++----
doc/src/sgml/ref/pg_resetxlog.sgml | 4 ++--
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 +++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/README | 12 ++++++------
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 4 ++--
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 ++--
src/backend/access/transam/xact.c | 18 +++++++++---------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 +++++-----
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 ++--
src/backend/utils/time/tqual.c | 6 +++---
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++++------------
src/include/access/slru.h | 4 ++--
28 files changed, 84 insertions(+), 72 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 074a6b0..1fa4d0e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_trans/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_trans</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 4e09e06..783d49c 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_trans</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,7 +2514,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_trans</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 8e0bccc..dff2945 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5816,7 +5816,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_trans</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 79eace3..0fd06d6 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15312,7 +15312,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_trans | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index 2713883..75f61cd 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -505,18 +505,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_trans</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_trans</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_trans</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_trans</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..6226a33 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_trans</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_trans</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..57ba80f 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_trans</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..000f3fd 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -136,6 +131,11 @@ Item
</row>
<row>
+ <entry><filename>pg_trans</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>pg_twophase</></entry>
<entry>Subdirectory containing state files for prepared transactions</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index bfc9a02..79d9986 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_trans</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 6a27ef4..39a3dc3 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6751,8 +6751,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_trans before we finish
+ * the VACUUM and perhaps truncate off the part of pg_trans he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..f941cfd 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
------------------------
+pg_trans and pg_subtrans
+------------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_trans and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_trans records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_trans and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_trans are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..a6bddd1 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_trans", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index e330105..08a0251 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_trans-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..303acf6 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_trans-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..8962c26 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,7 +3,7 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_trans-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
@@ -11,7 +11,7 @@
* opposite direction.
*
* This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_trans, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..108c1da 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_trans but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 9f55adc..2a51f67 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_trans, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2089,7 +2089,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_trans */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..2f5bf34 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,8 +1206,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_trans. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_trans update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2033,7 +2033,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_trans. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -2539,7 +2539,7 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
+ * Advertise the fact that we aborted in pg_trans (assuming that we got as
* far as assigning an XID to advertise). But if we're inside a parallel
* worker, skip this; the user backend must be the one to write the abort
* record.
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_trans. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_trans.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,7 +5389,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_trans. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5526,7 +5526,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_trans, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5542,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_trans, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 46dc15a..6946d4a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8392,7 +8392,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_trans. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..a5babef 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,7 +356,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_trans if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_trans and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_trans and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_trans).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,7 +1086,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_trans is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 1a92ca1..f77aa01 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2394,7 +2394,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_trans if possible. We
* only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..e7dda01 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_trans), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..5ce3a44 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_trans.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_trans to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..c4202e5 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_trans). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_trans before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_trans until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 77b0760..08e7338 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -201,7 +201,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -218,6 +217,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_trans",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 16f9f09..55834b8 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_trans in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_trans");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index fa118e9..dd7a54b 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_trans_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_trans_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_trans_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_trans in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_trans",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_trans");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..e279d0d 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_trans, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_trans and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.9.3
0001-Rename-pg_xlog-to-pg_wal.patchapplication/x-patch; name=0001-Rename-pg_xlog-to-pg_wal.patchDownload
From 1bd7db0fbbc5822177e05fb6349a9586b36a732c Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 30 Aug 2016 10:53:00 +0900
Subject: [PATCH 1/2] Rename pg_xlog to pg_wal
Additional check handling is needed in pg_upgrade regarding the clusters
worked on, except that it is a very mechanical patch. As pg_basebackup
needs to support servers down to 9.1, special handling is needed depending
on the version of the target server as a consequence of this renaming:
- Soft links need to be generated using pg_xlog or pg_wal.
- stream mode needs to have its output in the correct place.
This has as direct consequence to need a connection to target server before
generating a soft link, which is a bit earlier than before this renaming.
---
doc/src/sgml/backup.sgml | 28 ++++----
doc/src/sgml/config.sgml | 6 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/high-availability.sgml | 14 ++--
doc/src/sgml/perform.sgml | 2 +-
doc/src/sgml/protocol.sgml | 6 +-
doc/src/sgml/ref/pg_resetxlog.sgml | 10 +--
doc/src/sgml/ref/pg_rewind.sgml | 4 +-
doc/src/sgml/ref/pg_xlogdump.sgml | 2 +-
doc/src/sgml/ref/pgtestfsync.sgml | 4 +-
doc/src/sgml/ref/pgupgrade.sgml | 4 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 10 +--
src/backend/access/transam/timeline.c | 4 +-
src/backend/access/transam/xlog.c | 100 +++++++++++++--------------
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/replication/README | 2 +-
src/backend/replication/basebackup.c | 20 +++---
src/backend/replication/walreceiver.c | 6 +-
src/backend/replication/walsender.c | 4 +-
src/backend/storage/file/fd.c | 16 ++---
src/bin/initdb/initdb.c | 26 +++----
src/bin/pg_basebackup/pg_basebackup.c | 64 ++++++++++-------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 6 +-
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +-
src/bin/pg_rewind/copy_fetch.c | 4 +-
src/bin/pg_rewind/filemap.c | 8 +--
src/bin/pg_rewind/parsexlog.c | 2 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 10 +--
src/bin/pg_upgrade/exec.c | 79 +++++++++++++--------
src/bin/pg_xlogdump/pg_xlogdump.c | 2 +-
src/include/access/xlog_internal.h | 2 +-
src/include/postmaster/pgarch.h | 2 +-
34 files changed, 245 insertions(+), 212 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 0f09d82..074a6b0 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
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
every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the
@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
-test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
+test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
</para>
@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator
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.
- (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
transactions will be lost, but the database will remain offline until
you free some space.)
@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
operation continues even if the archiving process falls a little behind.
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
- 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
disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend.
@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty
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.
</para>
</sect2>
@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para>
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
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
reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information
@@ -1133,7 +1133,7 @@ SELECT pg_stop_backup();
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
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
were not archived before the system went down.
</para>
@@ -1156,9 +1156,9 @@ SELECT pg_stop_backup();
</listitem>
<listitem>
<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.
- 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,
being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before.
@@ -1167,7 +1167,7 @@ SELECT pg_stop_backup();
<listitem>
<para>
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
problem occurs and you have to start over.)
</para>
@@ -1249,9 +1249,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
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
- preference to files in <filename>pg_xlog/</>.
+ preference to files in <filename>pg_wal/</>.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 7c483c6..8e0bccc 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2926,7 +2926,7 @@ include_dir 'conf.d'
<listitem>
<para>
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
replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than
@@ -2940,7 +2940,7 @@ include_dir 'conf.d'
<para>
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
<varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number
@@ -3316,7 +3316,7 @@ include_dir 'conf.d'
<para>
Specify how long the standby server should wait when WAL data is not
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
<filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 5148095..79eace3 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15316,7 +15316,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
- pg_xlog | 16
+ pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
pg_subtrans | 19
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 06f49db..5bedaf2 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will
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
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>
At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it
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
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
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
- 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.
</para>
@@ -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
when <command>pg_ctl promote</> is run or a trigger file is found
(<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.
</para>
</sect2>
@@ -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
required, whereas replication slots retain only the number of segments
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.
</para>
<para>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index 7bcbfa7..8d30fd1 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of
- <filename>/pg_xlog</>.
+ <filename>/pg_wal</>.
</para>
</listitem>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 68b0941..800e39d 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para>
Include the necessary WAL segments in the backup. This will include
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.
</para>
</listitem>
@@ -2074,8 +2074,8 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
- <filename>pg_xlog</>, including subdirectories. If the backup is run
- with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be
+ <filename>pg_wal</>, including subdirectories. If the backup is run
+ 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
backup to work, not the rest of the contents.
</para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index fd9d0be..c949c5e 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -173,22 +173,22 @@ PostgreSQL documentation
<para>
The WAL starting address should be
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
part is the <quote>timeline ID</> and should usually be kept the same.
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>
<note>
<para>
<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
<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
- <filename>pg_xlog</> have been lost entirely.
+ <filename>pg_wal</> have been lost entirely.
</para>
</note>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 42ebfbf..371c4a4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -61,14 +61,14 @@ PostgreSQL documentation
<para>
<application>pg_rewind</> examines the timeline histories of the source
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
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
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
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
<application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded
diff --git a/doc/src/sgml/ref/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
index 177caab..cfb6d87 100644
--- a/doc/src/sgml/ref/pg_xlogdump.sgml
+++ b/doc/src/sgml/ref/pg_xlogdump.sgml
@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem>
<para>
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.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 6e134c7..5856356 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -57,8 +57,8 @@
<para>
Specifies the file name to write test data in.
This file should be in the same file system that the
- <filename>pg_xlog</> directory is or will be placed in.
- (<filename>pg_xlog</> contains the <acronym>WAL</> files.)
+ <filename>pg_wal</> directory is or will be placed in.
+ (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current
directory.
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9685193..4b9aab2 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster
once you start the new cluster after the upgrade. Link mode also
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
list of options.
</para>
@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para>
If you have tablespaces, you will need to run a similar
<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.
</para>
</step>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1b812bd..fddb69b 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -141,7 +141,7 @@ Item
</row>
<row>
- <entry><filename>pg_xlog</></entry>
+ <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 503ea8a..bfc9a02 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -557,7 +557,7 @@
</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
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,
@@ -582,7 +582,7 @@
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
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
uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">).
@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to
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.
Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records.
@@ -734,7 +734,7 @@
<para>
<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
by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally
@@ -751,7 +751,7 @@
<para>
It is advantageous if the log is located on a different disk from 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
original location in the main data directory to the new location.
</para>
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index bd91573..43436a9 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -43,7 +43,7 @@
/*
* Copies all timeline history files with id's between 'begin' and 'end'
- * from archive to pg_xlog.
+ * from archive to pg_wal.
*/
void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
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.
*/
if (fromArchive)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index acd95aa..46dc15a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -234,9 +234,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process.
*
* 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
- * WAL in pg_xlog.
+ * WAL in pg_wal.
*/
bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false;
@@ -697,12 +697,12 @@ typedef enum
{
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
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 */
} XLogSource;
/* 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.
@@ -3342,7 +3342,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery).
*
* 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
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
@@ -3371,7 +3371,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1;
break;
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno);
restoredFromArchive = false;
@@ -3390,7 +3390,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
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);
}
@@ -3478,10 +3478,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,
- XLOG_FROM_PG_XLOG, true);
+ XLOG_FROM_PG_WAL, true);
if (fd != -1)
{
if (!expectedTLEs)
@@ -3690,10 +3690,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
*
* 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
- * 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
* 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
* successfully replayed them, but from others we can't be sure.
*
@@ -3850,15 +3850,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.
*
* 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
- * 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
- * policy decision was made not to. It is fairly common for pg_xlog to be
+ * 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_wal to be
* a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice.
*/
@@ -3868,7 +3868,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH];
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 ||
!S_ISDIR(stat_buf.st_mode))
ereport(FATAL,
@@ -4024,11 +4024,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the
* 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
- * pg_xlog, however (!fetch_ckpt). We could recover using the WAL
- * from the archive, even if pg_xlog is completely empty, but we'd
+ * pg_wal, however (!fetch_ckpt). We could recover using the WAL
+ * 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.
* So err on the safe side and give up.
*/
@@ -4036,7 +4036,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt)
{
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;
if (StandbyModeRequested)
StandbyMode = true;
@@ -4153,7 +4153,7 @@ rescanLatestTimeLine(void)
/*
* 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);
@@ -5166,7 +5166,7 @@ readRecoveryCommandFile(void)
ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
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
{
@@ -5982,7 +5982,7 @@ StartupXLOG(void)
#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
* excluded and need to be re-created.
*/
@@ -6190,7 +6190,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file.
*
* 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.
*
* But usually we already know how far we need to replay the WAL (up
@@ -6394,7 +6394,7 @@ StartupXLOG(void)
/*
* 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
* covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL
@@ -7015,7 +7015,7 @@ StartupXLOG(void)
/*
* 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, e.g., timeline history file) from archive or pg_xlog.
+ * recovery, e.g., timeline history file) from archive or pg_wal.
*/
StandbyMode = false;
@@ -7297,7 +7297,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read
* .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,
* too.
*
@@ -9862,7 +9862,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
* first WAL segment containing the startup checkpoint has pages in
* 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
- * 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.
*
* This also ensures that we have emitted a WAL page header that has
@@ -10509,7 +10509,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
* archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with
* 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
* gets all the required WAL.
*
@@ -11099,9 +11099,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'.
*
* 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
- * pg_xlog 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
+ * streamed the record, or it can already be present in pg_wal. Checking
+ * 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_wal. That is not
* documented or recommended, though.
*
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
@@ -11131,8 +11131,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*-------
* Standby mode is implemented by a state machine:
*
- * 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just
- * pg_xlog (XLOG_FROM_XLOG)
+ * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
+ * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines
@@ -11148,7 +11148,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*-------
*/
if (!InArchiveRecovery)
- currentSource = XLOG_FROM_PG_XLOG;
+ currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE;
@@ -11167,13 +11167,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
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
* do this only after failure, so when you create the
* 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())
{
@@ -11183,7 +11183,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Not in standby mode, and we've now tried the archive
- * and pg_xlog.
+ * and pg_wal.
*/
if (!StandbyMode)
return false;
@@ -11243,7 +11243,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but
* PANIC is not good for availability either, especially
* 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
* streamed, so it's unlikely that it helps, but one can
* hope...
@@ -11304,11 +11304,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
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
- * the archive over ones in pg_xlog, so try the next file again
+ * We just successfully read a file in pg_wal. We prefer files in
+ * the archive over ones in pg_wal, so try the next file again
* from the archive first.
*/
if (InArchiveRecovery)
@@ -11329,7 +11329,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
case XLOG_FROM_ARCHIVE:
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */
if (readFile >= 0)
{
@@ -11342,7 +11342,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Try to restore the file from archive, or read an existing
- * file from pg_xlog.
+ * file from pg_wal.
*/
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
@@ -11351,7 +11351,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */
/*
- * Nope, not found in archive or pg_xlog.
+ * Nope, not found in archive or pg_wal.
*/
lastSourceFailed = true;
break;
@@ -11407,7 +11407,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history
* file if we haven't initialized timeline history
* 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
* isn't changed.
*/
@@ -11439,10 +11439,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Note that we don't "return false" immediately here.
* 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
* 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.
*/
lastSourceFailed = true;
@@ -11482,7 +11482,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* 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
* 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,
* and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it.
@@ -11497,7 +11497,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{
static XLogRecPtr lastComplaint = 0;
- if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
+ if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{
if (RecPtr == lastComplaint)
emode = DEBUG1;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d153a44..b919164 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/*
* 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
- * 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
KeepFileRestoredFromArchive(char *path, char *xlogfname)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 33383b4..01cbd90 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump
*
* 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
* 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
diff --git a/src/backend/replication/README b/src/backend/replication/README
index ad4864d..0cbb990 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart.
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.
Walreceiver sends information about replication progress to the master server
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index da9b7a6..3ffc665 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -276,7 +276,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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',
* regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in
@@ -289,11 +289,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno);
- dir = AllocateDir("pg_xlog");
+ dir = AllocateDir("pg_wal");
if (!dir)
ereport(ERROR,
- (errmsg("could not open directory \"%s\": %m", "pg_xlog")));
- while ((de = ReadDir(dir, "pg_xlog")) != NULL)
+ (errmsg("could not open directory \"%s\": %m", "pg_wal")));
+ while ((de = ReadDir(dir, "pg_wal")) != NULL)
{
/* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) &&
@@ -331,7 +331,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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.
*/
if (nWalFiles < 1)
@@ -988,15 +988,15 @@ 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
* we get permissions right.
*/
- if (strcmp(pathbuf, "./pg_xlog") == 0)
+ if (strcmp(pathbuf, "./pg_wal") == 0)
{
if (!sizeonly)
{
- /* If pg_xlog is a symlink, write it as a directory anyway */
+ /* If pg_wal is a symlink, write it as a directory anyway */
#ifndef WIN32
if (S_ISLNK(statbuf.st_mode))
#else
@@ -1012,10 +1012,10 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
* statbuf from above ...).
*/
if (!sizeonly)
- _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf);
+ _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf);
size += 512; /* Size of the header just added */
- continue; /* don't recurse into pg_xlog */
+ continue; /* don't recurse into pg_wal */
}
/* Allow symbolic links in pg_tblspc only */
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 413ee3a..d40b5e9 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new
* 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
* nudge the existing walreceiver process that's waiting, instead of launching
* a new one.
@@ -364,7 +364,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await
* 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
* on the new timeline.
*/
@@ -739,7 +739,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli)));
/*
- * Write the file to pg_xlog.
+ * Write the file to pg_wal.
*/
writeTimeLineHistoryFile(tli, content, len);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 1ea2a5c..34e4dd0 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* 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
* 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
* that's older than the switchpoint, if it's still in the same
@@ -2052,7 +2052,7 @@ retry:
*
* For example, imagine that this server is currently on timeline
* 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
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03143f1..b7ff5ef 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
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.
*/
xlog_is_symlink = false;
@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{
struct stat st;
- if (lstat("pg_xlog", &st) < 0)
+ if (lstat("pg_wal", &st) < 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
- "pg_xlog")));
+ "pg_wal")));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction("pg_xlog"))
+ if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true;
#endif
@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1);
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);
#endif
@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(".", datadir_fsync_fname, false, LOG);
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);
}
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index aad6ba5..77b0760 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -200,7 +200,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
- "pg_xlog/archive_status",
+ "pg_wal/archive_status",
"pg_clog",
"pg_commit_ts",
"pg_dynshmem",
@@ -2281,7 +2281,7 @@ make_postgres(FILE *cmdfd)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2291,17 +2291,17 @@ static void
fsync_pgdata(void)
{
bool xlog_is_symlink;
- char pg_xlog[MAXPGPATH];
+ char pg_wal[MAXPGPATH];
char pg_tblspc[MAXPGPATH];
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- snprintf(pg_xlog, MAXPGPATH, "%s/pg_xlog", pg_data);
+ snprintf(pg_wal, MAXPGPATH, "%s/pg_wal", 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.
*/
xlog_is_symlink = false;
@@ -2310,14 +2310,14 @@ fsync_pgdata(void)
{
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"),
- progname, pg_xlog, strerror(errno));
+ progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction(pg_xlog))
+ if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true;
#endif
@@ -2328,7 +2328,7 @@ fsync_pgdata(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false);
if (xlog_is_symlink)
- walkdir(pg_xlog, pre_sync_fname, false);
+ walkdir(pg_wal, pre_sync_fname, false);
walkdir(pg_tblspc, pre_sync_fname, true);
#endif
@@ -2336,14 +2336,14 @@ fsync_pgdata(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(pg_data, fsync_fname_ext, false);
if (xlog_is_symlink)
- walkdir(pg_xlog, fsync_fname_ext, false);
+ walkdir(pg_wal, fsync_fname_ext, false);
walkdir(pg_tblspc, fsync_fname_ext, true);
check_ok();
@@ -3087,7 +3087,7 @@ create_xlog_or_symlink(void)
char *subdirloc;
/* 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)
{
@@ -3220,7 +3220,7 @@ initialize_data_directory(void)
create_xlog_or_symlink();
- /* Create required subdirectories (other than pg_xlog) */
+ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... "));
fflush(stdout);
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 351a420..9401a9f 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -411,6 +411,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
uint32 hi,
lo;
char statusdir[MAXPGPATH];
+ int serverMajor;
param = pg_malloc0(sizeof(logstreamer_param));
param->timeline = timeline;
@@ -445,15 +446,21 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */
exit(1);
- snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/pg_xlog", basedir);
+ serverMajor = PQserverVersion(conn) / 100;
+
+ /* In post-10 cluster, pg_xlog has been renamed to pg_wal */
+ snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/%s",
+ basedir, serverMajor < 1000 ? "pg_xlog" : "pg_wal");
/*
- * Create pg_xlog/archive_status (and thus pg_xlog) so we can write to
- * basedir/pg_xlog as the directory entry in the tar file may arrive
- * later.
+ * Create pg_wal/archive_status or pg_xlog/archive_status (and thus
+ * pg_wal or pg_xlog) depending on the target server so we can write to
+ * 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",
- basedir);
+ snprintf(statusdir, sizeof(statusdir), "%s/%s/archive_status",
+ basedir,
+ serverMajor < 1000 ? "pg_xlog" : "pg_wal");
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
{
@@ -1249,15 +1256,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0)
{
/*
- * When streaming WAL, pg_xlog will have been created
- * by the wal receiver process. Also, when transaction
- * log directory location was specified, pg_xlog has
- * already been created as a symbolic link before
- * starting the actual backup. So just ignore creation
- * failures on related directories.
+ * When streaming WAL, pg_wal (or pg_xlog for pre-9.6
+ * clusters) will have been created by the wal receiver
+ * process. Also, when transaction log directory location
+ * was specified, pg_wal (or pg_xlog) has already been
+ * created as a symbolic link before starting the actual
+ * backup. So just ignore creation failures on related
+ * directories.
*/
- if (!((pg_str_endswith(filename, "/pg_xlog") ||
- pg_str_endswith(filename, "/archive_status")) &&
+ if (!((pg_str_endswith(filename, "/pg_wal") ||
+ pg_str_endswith(filename, "/pg_xlog")||
+ pg_str_endswith(filename, "/archive_status")) &&
errno == EEXIST))
{
fprintf(stderr,
@@ -1542,13 +1551,7 @@ BaseBackup(void)
maxServerMajor;
int serverMajor;
- /*
- * Connect in replication mode to the server
- */
- conn = GetConnection();
- if (!conn)
- /* Error message already written in GetConnection() */
- exit(1);
+ Assert(conn != NULL);
/*
* Check server version. BASE_BACKUP command was introduced in 9.1, so we
@@ -2172,26 +2175,37 @@ main(int argc, char **argv)
if (format == 'p' || strcmp(basedir, "-") != 0)
verify_dir_is_empty_or_create(basedir);
+ /* connection in replication mode to server */
+ conn = GetConnection();
+ if (!conn)
+ /* Error message already written in GetConnection() */
+ exit(1);
+
/* Create transaction log symlink, if required */
if (strcmp(xlog_dir, "") != 0)
{
char *linkloc;
+ int serverMajor = PQserverVersion(conn) / 100;
verify_dir_is_empty_or_create(xlog_dir);
- /* 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,
+ serverMajor < 1000 ? "pg_xlog" : "pg_wal");
#ifdef HAVE_SYMLINK
if (symlink(xlog_dir, linkloc) != 0)
{
fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"),
progname, linkloc, strerror(errno));
- exit(1);
+ disconnect_and_exit(1);
}
#else
fprintf(stderr, _("%s: symlinks are not supported on this platform\n"));
- exit(1);
+ disconnect_and_exit(1);
#endif
free(linkloc);
}
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 6c33936..11642e4 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -52,7 +52,7 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
ok(-f "$tempdir/backup/PG_VERSION", 'backup was created');
is_deeply(
- [ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ],
+ [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ],
'no WAL files copied');
@@ -182,12 +182,12 @@ like(
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'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');
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'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');
$node->command_fails(
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 525b82ba..2b76f64 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
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
* conservative, because of xlog.c's attempts to pre-create files.
*/
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 327e7ef..d0c1586 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -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,
* 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) ||
- strcmp(path, "pg_xlog") == 0)
+ strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
#else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 9b00dc1..3905a5d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
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
* 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;
/*
@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type)
{
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.. */
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,
/*
* 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;
key.path = (char *) path;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index b53591d..23ac4e7 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
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
* the data blocks touched by the WAL records, and return them in a page map.
*/
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index bdcab56..12950ea 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -1,5 +1,5 @@
#
-# 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 warnings;
@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir;
- # turn pg_xlog into a symlink
- print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n");
- move("$test_master_datadir/pg_xlog", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die;
+ # turn pg_wal into a symlink
+ print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
+ move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
+ symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master();
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index dd30952..16f9f09 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
#include <fcntl.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 validate_exec(const char *dir, const char *cmdName);
@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster);
- check_data_dir(old_cluster.pgdata);
+ check_data_dir(&old_cluster);
check_bin_dir(&new_cluster);
- check_data_dir(new_cluster.pgdata);
+ check_data_dir(&new_cluster);
}
@@ -253,6 +253,32 @@ win32_check_directory_write_permissions(void)
/*
+ * 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, getErrorText());
+ else if (!S_ISDIR(statBuf.st_mode))
+ report_status(PG_FATAL, "%s is not a directory\n",
+ subDirName);
+}
+
+
+/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void)
*
*/
static void
-check_data_dir(const char *pg_data)
+check_data_dir(ClusterInfo *cluster)
{
- char subDirName[MAXPGPATH];
- int subdirnum;
-
- /* start check with top-most directory */
- const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
- "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
- "pg_xlog"};
-
- for (subdirnum = 0;
- subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
- ++subdirnum)
- {
- struct stat statBuf;
-
- snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
- /* Win32 can't stat() a directory with a trailing slash. */
- *requiredSubdirs[subdirnum] ? "/" : "",
- requiredSubdirs[subdirnum]);
-
- if (stat(subDirName, &statBuf) != 0)
- report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
- subDirName, getErrorText());
- else if (!S_ISDIR(statBuf.st_mode))
- report_status(PG_FATAL, "%s is not a directory\n",
- subDirName);
- }
+ const char *pg_data = cluster->pgdata;
+
+ /* get old and new cluster versions */
+ old_cluster.major_version = get_major_server_version(&old_cluster);
+ new_cluster.major_version = get_major_server_version(&new_cluster);
+
+ check_single_dir(pg_data, "");
+ check_single_dir(pg_data, "base");
+ check_single_dir(pg_data, "global");
+ check_single_dir(pg_data, "pg_multixact");
+ check_single_dir(pg_data, "pg_subtrans");
+ check_single_dir(pg_data, "pg_tblspc");
+ check_single_dir(pg_data, "pg_twophase");
+
+ /* pg_xlog has been renamed to pg_wal in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_xlog");
+ else
+ check_single_dir(pg_data, "pg_wal");
}
diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
index 02575eb..abc6fb9 100644
--- a/src/bin/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -656,7 +656,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\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(" (default: ./pg_xlog)\n");
+ printf(" (default: ./pg_wal)\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(" -s, --start=RECPTR start reading at log position RECPTR\n");
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 0a595cc..ceb0462 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/*
* The XLog directory and control file (relative to $PGDATA)
*/
-#define XLOGDIR "pg_xlog"
+#define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control"
/*
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index f2cbfb3..6df73c9 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -16,7 +16,7 @@
/* ----------
* 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
* appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended.
--
2.9.3
On 8/29/16 7:34 PM, Andres Freund wrote:
What if we left symlinks for the config files? Or perhaps even better,
provide a tool that will create them for people that actually need
them.See the thread around
http://archives.postgresql.org/message-id/20160826104446.n3cif4m7modslkrs%40msg.df7cb.de
Right, but I was referring only to the config files. AFAIK it should be
safe for those to be symlinks.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Aug 30, 2016 at 11:04 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Mon, Aug 29, 2016 at 9:39 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:Cool. I'll mark as waiting on author pending that.
It'll be good to get this footgun put away.
OK, so done. I have put the renaming of pg_xlog to pg_wal on top patch
stack as that's the one making no discussion it seems: a lot of people
like pg_wal. I have added as well handling for the renaming in
pg_basebackup by using PQserverVersion. One thing to note is that a
connection needs to be made to the target server *before* creating the
soft link of pg_xlog/pg_wal because we need to know the version of the
target server. pg_upgrade is handled as well. And that's all in 0001.Patch 0002 does pg_clog -> pg_trans, "trans" standing for
"transaction". Switching to pg_trans_status or pg_xact_status is not
that complicated to change anyway...
Any input to offer for those patches? If there is nothing happening, I
guess that the best move is just to move it to next CF. At least I can
see that the flow would be to get those renamings done.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Sep 29, 2016 at 9:17 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Tue, Aug 30, 2016 at 11:04 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:On Mon, Aug 29, 2016 at 9:39 PM, Craig Ringer
<craig.ringer@2ndquadrant.com> wrote:Cool. I'll mark as waiting on author pending that.
It'll be good to get this footgun put away.
OK, so done. I have put the renaming of pg_xlog to pg_wal on top patch
stack as that's the one making no discussion it seems: a lot of people
like pg_wal. I have added as well handling for the renaming in
pg_basebackup by using PQserverVersion. One thing to note is that a
connection needs to be made to the target server *before* creating the
soft link of pg_xlog/pg_wal because we need to know the version of the
target server. pg_upgrade is handled as well. And that's all in 0001.Patch 0002 does pg_clog -> pg_trans, "trans" standing for
"transaction". Switching to pg_trans_status or pg_xact_status is not
that complicated to change anyway...Any input to offer for those patches? If there is nothing happening, I
guess that the best move is just to move it to next CF. At least I can
see that the flow would be to get those renamings done.
+1 for pg_xlog -> pg_wal.
Of the existing suggestions, would like to add my vote for the
following renames, matching pg_multixact:
pg_clog -> pg_xact
pg_subtrans -> pg_subxact
If longer names are on the table, I would consider expanding all three of those:
pg_clog -> pg_transaction
pg_subtrans -> pg_subtransaction
pg_multixact -> pg_multitransaction
They sound eminently non-deletable.
--
Thomas Munro
http://www.enterprisedb.com
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Sep 30, 2016 at 1:32 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
+1 for pg_xlog -> pg_wal.
This is clearly the winner here and...
Of the existing suggestions, would like to add my vote for the
following renames, matching pg_multixact:pg_clog -> pg_xact
pg_subtrans -> pg_subxactIf longer names are on the table, I would consider expanding all three of those:
pg_clog -> pg_transaction
This one sounds like the consensus by what I am reading upthread.
pg_subtrans -> pg_subtransaction
pg_multixact -> pg_multitransactionThey sound eminently non-deletable.
Well the original complain was that users tend to remove the entries
that include *log. I am not sure if it is worth worrying about doing
that much.
Anyway, those patches have rotten because of the commits of yesterday
for initdb and basebackup.c (stuff I wrote and/or reviewed actually).
So attached is a rebased set. 0001 does the work for pg_wal, 0002 for
pg_transaction.
As there have been no reviews at code level, I am moving that to the next CF.
--
Michael
Attachments:
0001-Rename-pg_xlog-to-pg_wal.patchtext/x-diff; charset=US-ASCII; name=0001-Rename-pg_xlog-to-pg_wal.patchDownload
From 0a7ae9826184ffa2d4d599a855d6b0caffc069ae Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 30 Sep 2016 14:22:32 +0900
Subject: [PATCH 1/2] Rename pg_xlog to pg_wal
Additional check handling is needed in pg_upgrade regarding the clusters
worked on, except that it is a very mechanical patch. As pg_basebackup
needs to support servers down to 9.1, special handling is needed depending
on the version of the target server as a consequence of this renaming:
- Soft links need to be generated using pg_xlog or pg_wal.
- stream mode needs to have its output in the correct place.
This has as direct consequence to need a connection to target server before
generating a soft link, which is a bit earlier than before this renaming.
---
doc/src/sgml/backup.sgml | 28 ++++----
doc/src/sgml/config.sgml | 6 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/high-availability.sgml | 14 ++--
doc/src/sgml/perform.sgml | 2 +-
doc/src/sgml/protocol.sgml | 6 +-
doc/src/sgml/ref/pg_resetxlog.sgml | 10 +--
doc/src/sgml/ref/pg_rewind.sgml | 4 +-
doc/src/sgml/ref/pg_xlogdump.sgml | 2 +-
doc/src/sgml/ref/pgtestfsync.sgml | 4 +-
doc/src/sgml/ref/pgupgrade.sgml | 4 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 10 +--
src/backend/access/transam/timeline.c | 4 +-
src/backend/access/transam/xlog.c | 100 +++++++++++++--------------
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/replication/README | 2 +-
src/backend/replication/basebackup.c | 20 +++---
src/backend/replication/walreceiver.c | 6 +-
src/backend/replication/walsender.c | 4 +-
src/backend/storage/file/fd.c | 16 ++---
src/bin/initdb/initdb.c | 8 +--
src/bin/pg_basebackup/pg_basebackup.c | 64 ++++++++++-------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 8 +--
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +-
src/bin/pg_rewind/copy_fetch.c | 4 +-
src/bin/pg_rewind/filemap.c | 8 +--
src/bin/pg_rewind/parsexlog.c | 2 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 10 +--
src/bin/pg_upgrade/exec.c | 79 +++++++++++++--------
src/bin/pg_xlogdump/pg_xlogdump.c | 2 +-
src/common/file_utils.c | 20 +++---
src/include/access/xlog_internal.h | 2 +-
src/include/postmaster/pgarch.h | 2 +-
35 files changed, 246 insertions(+), 215 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 95d0ff3..6eaed1e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
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
every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the
@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
-test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
+test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
</para>
@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator
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.
- (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
transactions will be lost, but the database will remain offline until
you free some space.)
@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
operation continues even if the archiving process falls a little behind.
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
- 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
disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend.
@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty
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.
</para>
</sect2>
@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para>
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
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
reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information
@@ -1149,7 +1149,7 @@ SELECT pg_stop_backup();
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
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
were not archived before the system went down.
</para>
@@ -1172,9 +1172,9 @@ SELECT pg_stop_backup();
</listitem>
<listitem>
<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.
- 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,
being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before.
@@ -1183,7 +1183,7 @@ SELECT pg_stop_backup();
<listitem>
<para>
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
problem occurs and you have to start over.)
</para>
@@ -1265,9 +1265,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
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
- preference to files in <filename>pg_xlog/</>.
+ preference to files in <filename>pg_wal/</>.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index e826c19..1bb501c 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2932,7 +2932,7 @@ include_dir 'conf.d'
<listitem>
<para>
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
replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than
@@ -2946,7 +2946,7 @@ include_dir 'conf.d'
<para>
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
<varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number
@@ -3322,7 +3322,7 @@ include_dir 'conf.d'
<para>
Specify how long the standby server should wait when WAL data is not
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
<filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a588350..2e64cc4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15327,7 +15327,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
- pg_xlog | 16
+ pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
pg_subtrans | 19
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 06f49db..5bedaf2 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will
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
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>
At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it
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
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
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
- 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.
</para>
@@ -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
when <command>pg_ctl promote</> is run or a trigger file is found
(<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.
</para>
</sect2>
@@ -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
required, whereas replication slots retain only the number of segments
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.
</para>
<para>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index 7bcbfa7..8d30fd1 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of
- <filename>/pg_xlog</>.
+ <filename>/pg_wal</>.
</para>
</listitem>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 3384e73..50cf527 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para>
Include the necessary WAL segments in the backup. This will include
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.
</para>
</listitem>
@@ -2076,8 +2076,8 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
- <filename>pg_xlog</>, including subdirectories. If the backup is run
- with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be
+ <filename>pg_wal</>, including subdirectories. If the backup is run
+ 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
backup to work, not the rest of the contents.
</para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index fd9d0be..c949c5e 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -173,22 +173,22 @@ PostgreSQL documentation
<para>
The WAL starting address should be
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
part is the <quote>timeline ID</> and should usually be kept the same.
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>
<note>
<para>
<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
<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
- <filename>pg_xlog</> have been lost entirely.
+ <filename>pg_wal</> have been lost entirely.
</para>
</note>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 42ebfbf..371c4a4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -61,14 +61,14 @@ PostgreSQL documentation
<para>
<application>pg_rewind</> examines the timeline histories of the source
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
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
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
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
<application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded
diff --git a/doc/src/sgml/ref/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
index 177caab..cfb6d87 100644
--- a/doc/src/sgml/ref/pg_xlogdump.sgml
+++ b/doc/src/sgml/ref/pg_xlogdump.sgml
@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem>
<para>
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.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 6e134c7..5856356 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -57,8 +57,8 @@
<para>
Specifies the file name to write test data in.
This file should be in the same file system that the
- <filename>pg_xlog</> directory is or will be placed in.
- (<filename>pg_xlog</> contains the <acronym>WAL</> files.)
+ <filename>pg_wal</> directory is or will be placed in.
+ (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current
directory.
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9685193..4b9aab2 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster
once you start the new cluster after the upgrade. Link mode also
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
list of options.
</para>
@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para>
If you have tablespaces, you will need to run a similar
<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.
</para>
</step>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1b812bd..fddb69b 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -141,7 +141,7 @@ Item
</row>
<row>
- <entry><filename>pg_xlog</></entry>
+ <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index fe3b588..346aa76 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -557,7 +557,7 @@
</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
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,
@@ -582,7 +582,7 @@
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
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
uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">).
@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to
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.
Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records.
@@ -750,7 +750,7 @@
<para>
<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
by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally
@@ -767,7 +767,7 @@
<para>
It is advantageous if the log is located on a different disk from 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
original location in the main data directory to the new location.
</para>
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index bd91573..43436a9 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -43,7 +43,7 @@
/*
* Copies all timeline history files with id's between 'begin' and 'end'
- * from archive to pg_xlog.
+ * from archive to pg_wal.
*/
void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
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.
*/
if (fromArchive)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c1b9a97..48c18e8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -235,9 +235,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process.
*
* 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
- * WAL in pg_xlog.
+ * WAL in pg_wal.
*/
bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false;
@@ -700,12 +700,12 @@ typedef enum
{
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
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 */
} XLogSource;
/* 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.
@@ -3345,7 +3345,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery).
*
* 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
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
@@ -3374,7 +3374,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1;
break;
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno);
restoredFromArchive = false;
@@ -3393,7 +3393,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
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);
}
@@ -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,
- XLOG_FROM_PG_XLOG, true);
+ XLOG_FROM_PG_WAL, true);
if (fd != -1)
{
if (!expectedTLEs)
@@ -3693,10 +3693,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
*
* 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
- * 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
* 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
* successfully replayed them, but from others we can't be sure.
*
@@ -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.
*
* 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
- * 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
- * policy decision was made not to. It is fairly common for pg_xlog to be
+ * 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_wal to be
* a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice.
*/
@@ -3871,7 +3871,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH];
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 ||
!S_ISDIR(stat_buf.st_mode))
ereport(FATAL,
@@ -4027,11 +4027,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the
* 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
- * pg_xlog, however (!fetch_ckpt). We could recover using the WAL
- * from the archive, even if pg_xlog is completely empty, but we'd
+ * pg_wal, however (!fetch_ckpt). We could recover using the WAL
+ * 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.
* So err on the safe side and give up.
*/
@@ -4039,7 +4039,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt)
{
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;
if (StandbyModeRequested)
StandbyMode = true;
@@ -4156,7 +4156,7 @@ rescanLatestTimeLine(void)
/*
* 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);
@@ -5189,7 +5189,7 @@ readRecoveryCommandFile(void)
ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
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
{
@@ -6055,7 +6055,7 @@ StartupXLOG(void)
#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
* excluded and need to be re-created.
*/
@@ -6268,7 +6268,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file.
*
* 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.
*
* But usually we already know how far we need to replay the WAL (up
@@ -6472,7 +6472,7 @@ StartupXLOG(void)
/*
* 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
* covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL
@@ -7093,7 +7093,7 @@ StartupXLOG(void)
/*
* 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, e.g., timeline history file) from archive or pg_xlog.
+ * recovery, e.g., timeline history file) from archive or pg_wal.
*/
StandbyMode = false;
@@ -7381,7 +7381,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read
* .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,
* too.
*
@@ -9957,7 +9957,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
* first WAL segment containing the startup checkpoint has pages in
* 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
- * 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.
*
* This also ensures that we have emitted a WAL page header that has
@@ -10604,7 +10604,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
* archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with
* 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
* gets all the required WAL.
*
@@ -11194,9 +11194,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'.
*
* 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
- * pg_xlog 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
+ * streamed the record, or it can already be present in pg_wal. Checking
+ * 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_wal. That is not
* documented or recommended, though.
*
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
@@ -11226,8 +11226,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*-------
* Standby mode is implemented by a state machine:
*
- * 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just
- * pg_xlog (XLOG_FROM_XLOG)
+ * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
+ * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines
@@ -11243,7 +11243,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*-------
*/
if (!InArchiveRecovery)
- currentSource = XLOG_FROM_PG_XLOG;
+ currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE;
@@ -11262,13 +11262,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
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
* do this only after failure, so when you create the
* 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())
{
@@ -11278,7 +11278,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Not in standby mode, and we've now tried the archive
- * and pg_xlog.
+ * and pg_wal.
*/
if (!StandbyMode)
return false;
@@ -11338,7 +11338,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but
* PANIC is not good for availability either, especially
* 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
* streamed, so it's unlikely that it helps, but one can
* hope...
@@ -11399,11 +11399,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
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
- * the archive over ones in pg_xlog, so try the next file again
+ * We just successfully read a file in pg_wal. We prefer files in
+ * the archive over ones in pg_wal, so try the next file again
* from the archive first.
*/
if (InArchiveRecovery)
@@ -11424,7 +11424,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
case XLOG_FROM_ARCHIVE:
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */
if (readFile >= 0)
{
@@ -11437,7 +11437,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Try to restore the file from archive, or read an existing
- * file from pg_xlog.
+ * file from pg_wal.
*/
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
@@ -11446,7 +11446,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */
/*
- * Nope, not found in archive or pg_xlog.
+ * Nope, not found in archive or pg_wal.
*/
lastSourceFailed = true;
break;
@@ -11502,7 +11502,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history
* file if we haven't initialized timeline history
* 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
* isn't changed.
*/
@@ -11534,10 +11534,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Note that we don't "return false" immediately here.
* 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
* 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.
*/
lastSourceFailed = true;
@@ -11577,7 +11577,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* 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
* 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,
* and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it.
@@ -11592,7 +11592,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{
static XLogRecPtr lastComplaint = 0;
- if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
+ if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{
if (RecPtr == lastComplaint)
emode = DEBUG1;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d153a44..b919164 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/*
* 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
- * 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
KeepFileRestoredFromArchive(char *path, char *xlogfname)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 33383b4..01cbd90 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump
*
* 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
* 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
diff --git a/src/backend/replication/README b/src/backend/replication/README
index ad4864d..0cbb990 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart.
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.
Walreceiver sends information about replication progress to the master server
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 1eabaef..6dd47ce 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -346,7 +346,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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',
* regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in
@@ -359,11 +359,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno);
- dir = AllocateDir("pg_xlog");
+ dir = AllocateDir("pg_wal");
if (!dir)
ereport(ERROR,
- (errmsg("could not open directory \"%s\": %m", "pg_xlog")));
- while ((de = ReadDir(dir, "pg_xlog")) != NULL)
+ (errmsg("could not open directory \"%s\": %m", "pg_wal")));
+ while ((de = ReadDir(dir, "pg_wal")) != NULL)
{
/* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) &&
@@ -401,7 +401,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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.
*/
if (nWalFiles < 1)
@@ -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
* 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);
/*
* Also send archive_status directory (by hackishly reusing
* statbuf from above ...).
*/
- size += _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf,
+ size += _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf,
sizeonly);
- continue; /* don't recurse into pg_xlog */
+ continue; /* don't recurse into pg_wal */
}
/* Allow symbolic links in pg_tblspc only */
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 413ee3a..d40b5e9 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new
* 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
* nudge the existing walreceiver process that's waiting, instead of launching
* a new one.
@@ -364,7 +364,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await
* 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
* on the new timeline.
*/
@@ -739,7 +739,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli)));
/*
- * Write the file to pg_xlog.
+ * Write the file to pg_wal.
*/
writeTimeLineHistoryFile(tli, content, len);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index c7743da..dcbb289 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* 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
* 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
* that's older than the switchpoint, if it's still in the same
@@ -2055,7 +2055,7 @@ retry:
*
* For example, imagine that this server is currently on timeline
* 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
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03143f1..b7ff5ef 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
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.
*/
xlog_is_symlink = false;
@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{
struct stat st;
- if (lstat("pg_xlog", &st) < 0)
+ if (lstat("pg_wal", &st) < 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
- "pg_xlog")));
+ "pg_wal")));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction("pg_xlog"))
+ if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true;
#endif
@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1);
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);
#endif
@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(".", datadir_fsync_fname, false, LOG);
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);
}
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e52e67d..e256bcb 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -195,7 +195,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
- "pg_xlog/archive_status",
+ "pg_wal/archive_status",
"pg_clog",
"pg_commit_ts",
"pg_dynshmem",
@@ -2091,8 +2091,6 @@ make_postgres(FILE *cmdfd)
PG_CMD_PUTS(*line);
}
-
-
/*
* signal handler in case we are interrupted.
*
@@ -2830,7 +2828,7 @@ create_xlog_or_symlink(void)
char *subdirloc;
/* 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)
{
@@ -2963,7 +2961,7 @@ initialize_data_directory(void)
create_xlog_or_symlink();
- /* Create required subdirectories (other than pg_xlog) */
+ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... "));
fflush(stdout);
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 0f5d9d6..229f558 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -492,6 +492,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
uint32 hi,
lo;
char statusdir[MAXPGPATH];
+ int serverMajor;
param = pg_malloc0(sizeof(logstreamer_param));
param->timeline = timeline;
@@ -526,15 +527,21 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */
exit(1);
- snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/pg_xlog", basedir);
+ serverMajor = PQserverVersion(conn) / 100;
+
+ /* In post-10 cluster, pg_xlog has been renamed to pg_wal */
+ snprintf(param->xlogdir, sizeof(param->xlogdir), "%s/%s",
+ basedir, serverMajor < 1000 ? "pg_xlog" : "pg_wal");
/*
- * Create pg_xlog/archive_status (and thus pg_xlog) so we can write to
- * basedir/pg_xlog as the directory entry in the tar file may arrive
- * later.
+ * Create pg_wal/archive_status or pg_xlog/archive_status (and thus
+ * pg_wal or pg_xlog) depending on the target server so we can write to
+ * 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",
- basedir);
+ snprintf(statusdir, sizeof(statusdir), "%s/%s/archive_status",
+ basedir,
+ serverMajor < 1000 ? "pg_xlog" : "pg_wal");
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
{
@@ -1338,15 +1345,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0)
{
/*
- * When streaming WAL, pg_xlog will have been created
- * by the wal receiver process. Also, when transaction
- * log directory location was specified, pg_xlog has
- * already been created as a symbolic link before
- * starting the actual backup. So just ignore creation
- * failures on related directories.
+ * When streaming WAL, pg_wal (or pg_xlog for pre-9.6
+ * clusters) will have been created by the wal receiver
+ * process. Also, when transaction log directory location
+ * was specified, pg_wal (or pg_xlog) has already been
+ * created as a symbolic link before starting the actual
+ * backup. So just ignore creation failures on related
+ * directories.
*/
- if (!((pg_str_endswith(filename, "/pg_xlog") ||
- pg_str_endswith(filename, "/archive_status")) &&
+ if (!((pg_str_endswith(filename, "/pg_wal") ||
+ pg_str_endswith(filename, "/pg_xlog")||
+ pg_str_endswith(filename, "/archive_status")) &&
errno == EEXIST))
{
fprintf(stderr,
@@ -1636,13 +1645,7 @@ BaseBackup(void)
maxServerMajor;
int serverMajor;
- /*
- * Connect in replication mode to the server
- */
- conn = GetConnection();
- if (!conn)
- /* Error message already written in GetConnection() */
- exit(1);
+ Assert(conn != NULL);
/*
* Check server version. BASE_BACKUP command was introduced in 9.1, so we
@@ -2296,26 +2299,37 @@ main(int argc, char **argv)
if (format == 'p' || strcmp(basedir, "-") != 0)
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 */
if (strcmp(xlog_dir, "") != 0)
{
char *linkloc;
+ int serverMajor = PQserverVersion(conn) / 100;
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,
+ serverMajor < 1000 ? "pg_xlog" : "pg_wal");
#ifdef HAVE_SYMLINK
if (symlink(xlog_dir, linkloc) != 0)
{
fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"),
progname, linkloc, strerror(errno));
- exit(1);
+ disconnect_and_exit(1);
}
#else
fprintf(stderr, _("%s: symlinks are not supported on this platform\n"));
- exit(1);
+ disconnect_and_exit(1);
#endif
free(linkloc);
}
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index a52bd4e..c8abbeb 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -67,9 +67,9 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
'pg_basebackup runs');
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(
- [ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ],
+ [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ],
'no WAL files copied');
@@ -230,12 +230,12 @@ like(
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'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');
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'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');
$node->command_fails(
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 525b82ba..2b76f64 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
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
* conservative, because of xlog.c's attempts to pre-create files.
*/
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 327e7ef..d0c1586 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -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,
* 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) ||
- strcmp(path, "pg_xlog") == 0)
+ strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
#else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 9b00dc1..3905a5d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
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
* 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;
/*
@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type)
{
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.. */
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,
/*
* 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;
key.path = (char *) path;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index b53591d..23ac4e7 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
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
* the data blocks touched by the WAL records, and return them in a page map.
*/
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index bdcab56..12950ea 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -1,5 +1,5 @@
#
-# 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 warnings;
@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir;
- # turn pg_xlog into a symlink
- print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n");
- move("$test_master_datadir/pg_xlog", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die;
+ # turn pg_wal into a symlink
+ print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
+ move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
+ symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master();
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index dd30952..16f9f09 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
#include <fcntl.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 validate_exec(const char *dir, const char *cmdName);
@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster);
- check_data_dir(old_cluster.pgdata);
+ check_data_dir(&old_cluster);
check_bin_dir(&new_cluster);
- check_data_dir(new_cluster.pgdata);
+ check_data_dir(&new_cluster);
}
@@ -253,6 +253,32 @@ win32_check_directory_write_permissions(void)
/*
+ * 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, getErrorText());
+ else if (!S_ISDIR(statBuf.st_mode))
+ report_status(PG_FATAL, "%s is not a directory\n",
+ subDirName);
+}
+
+
+/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void)
*
*/
static void
-check_data_dir(const char *pg_data)
+check_data_dir(ClusterInfo *cluster)
{
- char subDirName[MAXPGPATH];
- int subdirnum;
-
- /* start check with top-most directory */
- const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
- "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
- "pg_xlog"};
-
- for (subdirnum = 0;
- subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
- ++subdirnum)
- {
- struct stat statBuf;
-
- snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
- /* Win32 can't stat() a directory with a trailing slash. */
- *requiredSubdirs[subdirnum] ? "/" : "",
- requiredSubdirs[subdirnum]);
-
- if (stat(subDirName, &statBuf) != 0)
- report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
- subDirName, getErrorText());
- else if (!S_ISDIR(statBuf.st_mode))
- report_status(PG_FATAL, "%s is not a directory\n",
- subDirName);
- }
+ const char *pg_data = cluster->pgdata;
+
+ /* get old and new cluster versions */
+ old_cluster.major_version = get_major_server_version(&old_cluster);
+ new_cluster.major_version = get_major_server_version(&new_cluster);
+
+ check_single_dir(pg_data, "");
+ check_single_dir(pg_data, "base");
+ check_single_dir(pg_data, "global");
+ check_single_dir(pg_data, "pg_multixact");
+ check_single_dir(pg_data, "pg_subtrans");
+ check_single_dir(pg_data, "pg_tblspc");
+ check_single_dir(pg_data, "pg_twophase");
+
+ /* pg_xlog has been renamed to pg_wal in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_xlog");
+ else
+ check_single_dir(pg_data, "pg_wal");
}
diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
index 02575eb..abc6fb9 100644
--- a/src/bin/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -656,7 +656,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\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(" (default: ./pg_xlog)\n");
+ printf(" (default: ./pg_wal)\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(" -s, --start=RECPTR start reading at log position RECPTR\n");
diff --git a/src/common/file_utils.c b/src/common/file_utils.c
index 1d85564..fe2d238 100644
--- a/src/common/file_utils.c
+++ b/src/common/file_utils.c
@@ -41,7 +41,7 @@ static void walkdir(const char *path,
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -51,14 +51,14 @@ void
fsync_pgdata(const char *pg_data, const char *progname)
{
bool xlog_is_symlink;
- char pg_xlog[MAXPGPATH];
+ char pg_wal[MAXPGPATH];
char pg_tblspc[MAXPGPATH];
- snprintf(pg_xlog, MAXPGPATH, "%s/pg_xlog", pg_data);
+ snprintf(pg_wal, MAXPGPATH, "%s/pg_wal", 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.
*/
xlog_is_symlink = false;
@@ -67,14 +67,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
{
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"),
- progname, pg_xlog, strerror(errno));
+ progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction(pg_xlog))
+ if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true;
#endif
@@ -85,7 +85,7 @@ fsync_pgdata(const char *pg_data, const char *progname)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false, progname);
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);
#endif
@@ -93,14 +93,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(pg_data, fsync_fname, false, progname);
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);
}
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 0a595cc..ceb0462 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/*
* The XLog directory and control file (relative to $PGDATA)
*/
-#define XLOGDIR "pg_xlog"
+#define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control"
/*
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index f2cbfb3..6df73c9 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -16,7 +16,7 @@
/* ----------
* 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
* appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended.
--
2.10.0
0002-Rename-pg_clog-to-pg_transaction.patchtext/x-diff; charset=US-ASCII; name=0002-Rename-pg_clog-to-pg_transaction.patchDownload
From 448bc915890b215a07ac70afd4b037594feabe41 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 30 Sep 2016 14:42:27 +0900
Subject: [PATCH 2/2] Rename pg_clog to pg_transaction
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 6 +++---
doc/src/sgml/catalogs.sgml | 6 +++---
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 12 +++++------
doc/src/sgml/ref/pg_resetxlog.sgml | 6 +++---
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 ++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 10 ++++-----
src/backend/access/transam/README | 20 +++++++++---------
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 4 ++--
src/backend/access/transam/multixact.c | 8 +++----
src/backend/access/transam/subtrans.c | 18 ++++++++--------
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/xact.c | 38 ++++++++++++++++++++--------------
src/backend/access/transam/xlog.c | 6 +++---
src/backend/commands/vacuum.c | 14 ++++++-------
src/backend/postmaster/autovacuum.c | 4 ++--
src/backend/storage/buffer/README | 4 ++--
src/backend/storage/ipc/procarray.c | 5 +++--
src/backend/utils/time/tqual.c | 29 +++++++++++++-------------
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++-----------
src/include/access/slru.h | 12 +++++------
28 files changed, 144 insertions(+), 124 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..eb4f962 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
- all transactions. A table file is only usable with this
+ <filename>pg_transaction/*</filename>, which contain the commit status
+ of all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_transaction</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 29738b0..77b395e 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_transaction</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,8 +2514,8 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
- It is the minimum of the per-table
+ transaction ID wraparound or to allow <literal>pg_transaction</> to be
+ shrunk. It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
</row>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 1bb501c..b0b7215 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5822,7 +5822,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_transaction</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2e64cc4..a9d2ec4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15323,7 +15323,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_transaction | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e0..c741a9b 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
- will take more space, because it must store the commit status of all
- transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
+ is that the <filename>pg_transaction</> subdirectory of the database
+ cluster will take more space, because it must store the commit status of
+ all transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_transaction</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_transaction</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_transaction</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..67b048b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
- adding one,
+ file name in the directory <filename>pg_transaction</> under the data
+ directory, adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_transaction</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..34ef4f1 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_transaction</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..61d15d4 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -136,6 +131,11 @@ Item
</row>
<row>
+ <entry><filename>pg_transaction</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>pg_twophase</></entry>
<entry>Subdirectory containing state files for prepared transactions</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa76..aac0a8d 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_transaction</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b019bc1..075d06a 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,11 +6762,11 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
- * exclusive lock ensures no other backend is in process of checking the
- * tuple status. Also, getting exclusive lock makes it safe to adjust the
- * infomask bits.
+ * conceivably not finish checking the XID against pg_transaction before we
+ * finish the VACUUM and perhaps truncate off the part of pg_transaction he
+ * needs. Getting exclusive lock ensures no other backend is in process of
+ * checking the tuple status. Also, getting exclusive lock makes it safe to
+ * adjust the infomask bits.
*
* NB: All code in here must be safe to execute during crash recovery!
*/
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..4a41263 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
------------------------
+pg_transaction and pg_subtrans
+------------------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
-information. There is a limited number of pages of each kept in memory, so
-in many cases there is no need to actually read from disk. However, if
-there's a long running transaction or a backend sitting idle with an open
+pg_transaction and pg_subtrans are permanent (on-disk) storage of transaction
+related information. There is a limited number of pages of each kept in
+memory, so in many cases there is no need to actually read from disk. However,
+if there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_trans records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,10 +381,10 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_transaction and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+for pg_transaction are implemented in transam.c, while the low-level functions
+are in clog.c. pg_subtrans is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..c7a3cbb 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_transaction", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index a8d275f..4a48f76 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,8 +3,8 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
- * for each transaction.
+ * This module is a pg_transaction-like system that stores the commit
+ * timestamp for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
* CommitTs page is initialized to zeroes. Also, one XLOG record is
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..aa8e07e 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,10 +3,10 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
- * MultiXactMember for each MultiXactId. It is a fundamental part of the
- * shared-row-lock implementation. Each MultiXactMember is comprised of a
- * TransactionId and a set of flag bits. The name is a bit historical:
+ * The pg_multixact manager is a pg_transaction-like manager that stores an
+ * array of MultiXactMember for each MultiXactId. It is a fundamental part
+ * of the shared-row-lock implementation. Each MultiXactMember is comprised
+ * of a TransactionId and a set of flag bits. The name is a bit historical:
* originally, a MultiXactId consisted of more than one TransactionId (except
* in rare corner cases), hence "multi". Nowadays, however, it's perfectly
* legitimate to have MultiXactIds that only include a single Xid.
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..d96a487 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,17 +3,17 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
- * transaction Id for each transaction. It is a fundamental part of the
- * nested transactions implementation. A main transaction has a parent
- * of InvalidTransactionId, and each subtransaction has its immediate parent.
- * The tree can easily be walked from child to parent, but not in the
- * opposite direction.
+ * The pg_subtrans manager is a pg_transaction-like manager that stores
+ * the parent transaction Id for each transaction. It is a fundamental
+ * part of the nested transactions implementation. A main transaction has
+ * a parent of InvalidTransactionId, and each subtransaction has its
+ * immediate parent. The tree can easily be walked from child to parent,
+ * but not in the opposite direction.
*
* This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
- * no need to preserve data over a crash and restart.
+ * are completely different from pg_transaction, because we only need to
+ * remember pg_subtrans information for currently-open transactions. Thus,
+ * there is no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
* data across crashes. During database startup, we simply force the
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..8a41c7f 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_transaction but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604..52de336 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,8 +1379,8 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
- * TransactionIdIsInProgress will stop saying the prepared xact is in
+ * pg_transaction, then remove its PGPROC from the global ProcArray (which
+ * means TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
*/
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_transaction */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..817b323 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,10 +1206,10 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
- * disk, leading to loss of the transaction commit if the system
- * crashes a little later.
+ * pg_transaction. Without this, it is possible for the checkpoint
+ * to set REDO after the XLOG record but fail to flush the pg_trans
+ * update to disk, leading to loss of the transaction commit if the
+ * system crashes a little later.
*
* Note: we could, but don't bother to, set this flag in
* RecordTransactionAbort. That's because loss of a transaction abort
@@ -2033,8 +2033,8 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
- * durably commit.
+ * We need to mark our XIDs as committed in pg_transaction. This is
+ * where we durably commit.
*/
latestXid = RecordTransactionCommit();
}
@@ -2539,10 +2539,10 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
- * far as assigning an XID to advertise). But if we're inside a parallel
- * worker, skip this; the user backend must be the one to write the abort
- * record.
+ * Advertise the fact that we aborted in pg_transaction (assuming that we
+ * got as far as assigning an XID to advertise). But if we're inside a
+ * parallel worker, skip this; the user backend must be the one to write
+ * the abort record.
*/
if (!is_parallel_worker)
latestXid = RecordTransactionAbort(false);
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_transaction. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_transaction.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,8 +5389,8 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
- * protocol during recovery to provide information on database
+ * Mark the transaction committed in pg_transaction. We use async
+ * commit protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
* this commit record. This ensures that if we crash we don't see hint
@@ -5526,7 +5526,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5545,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 48c18e8..2262ae0 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8487,9 +8487,9 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
- * we wait till he's out of his commit critical section before proceeding.
- * See notes in RecordTransactionCommit().
+ * that our flushing had better include the xact's update of
+ * pg_transaction. So we wait till he's out of his commit critical
+ * section before proceeding. See notes in RecordTransactionCommit().
*
* Because we've already released the insertion locks, this test is a bit
* fuzzy: it is possible that we will wait for xacts we didn't really need
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..5c61d1a 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,8 +356,8 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
- * (autovacuum.c does this for itself.)
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
}
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_transaction and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_transaction and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_transaction).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,8 +1086,8 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
- * as it could be.
+ * worst possible outcome is that pg_transaction is not truncated as
+ * aggressively as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 1a92ca1..31fcd51 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2394,8 +2394,8 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
- * only need to do this once, not after each table.
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. We only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..94da258 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,8 +63,8 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
-great harm is done if they get reset to zero by conflicting updates.
+(they cache the results of transaction status lookups in pg_transaction),
+so no great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
an exclusive buffer lock (and it must also be WAL-logged).
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..dd5c79a 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_transaction.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,8 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_transaction to see if it's been
+ * aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..fbf9c6c 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,23 +13,24 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
- * just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
- * MyPgXact->xid in the PGXACT array. That fixes that problem, but it
- * also means there is a window where TransactionIdIsInProgress and
- * TransactionIdDidCommit will both return true. If we check only
- * TransactionIdDidCommit, we could consider a tuple committed when a
- * later GetSnapshotData call will still think the originating transaction
- * is in progress, which leads to application-level inconsistency. The
- * upshot is that we gotta check TransactionIdIsInProgress first in all
- * code paths, except for a few cases where we are looking at
- * subtransactions of our own main transaction and so there can't be any
- * race condition.
+ * pg_transaction). Otherwise we have a race condition: we might decide
+ * that a just-committed transaction crashed, because none of the tests
+ * succeed. xact.c is careful to record commit/abort in pg_transaction
+ * before it unsets MyPgXact->xid in the PGXACT array. That fixes that
+ * problem, but it also means there is a window where
+ * TransactionIdIsInProgress and TransactionIdDidCommit will both return
+ * true. If we check only TransactionIdDidCommit, we could consider a
+ * tuple committed when a later GetSnapshotData call will still think
+ * the originating transaction is in progress, which leads to
+ * application-level inconsistency. The upshot is that we gotta check
+ * TransactionIdIsInProgress first in all code paths, except for a few
+ * cases where we are looking at subtransactions of our own main
+ * transaction and so there can't be any race condition.
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_transaction until after deciding that the xact is no longer
+ * in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e256bcb..b724c2d 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_transaction",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 16f9f09..fe63edb 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_transaction in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_transaction");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index fa118e9..1c67f10 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_trans_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_trans_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_trans_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_trans in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..001817f 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,10 +76,10 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
- * has lsn_groups_per_page entries per buffer slot, each containing the
- * highest LSN known for a contiguous group of SLRU entries on that slot's
- * page.
+ * for pg_transaction, false for multixact, pg_subtrans, pg_notify).
+ * group_lsn[] has lsn_groups_per_page entries per buffer slot, each
+ * containing the highest LSN known for a contiguous group of SLRU entries
+ * on that slot's page.
*/
XLogRecPtr *group_lsn;
int lsn_groups_per_page;
@@ -120,8 +120,8 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * This flag tells whether to fsync writes (true for pg_transaction and
+ * multixact stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.10.0
On Fri, Sep 30, 2016 at 1:45 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
As there have been no reviews at code level, I am moving that to the next CF.
Code review of 0001:
I think the tests for PQserverVersion(conn) / 100 >= 1000 are strange.
I submit that either PQserverVersion(conn) >= 100000 or
PQserverVersion(conn) / 10000 >= 10 is an easier-to-understand test.
I vote for the first style. So in pg_basebackup.c I'd do:
#define MINIMUM_VERSION_FOR_PG_WAL 100000
...
int version = PQserverVersion(conn);
...
if (version >= MINIMUM_VERSION_FOR_PG_WAL)
/* do whatever */
Also, for this sort of thing:
+ if (!conn)
+ /* Error message already written in GetConnection() */
+ exit(1);
...because of the comment, I'd add braces around this.
Tom changed the error-reporting framework for pg_upgrade in
f002ed2b8e45286fe73a36e119cba2016ea0de19, so you'll need to do some
rebasing over that. I haven't checked what the new conventions are,
but obviously you'll want to try to be consistent with them.
Other than those minor nitpicks, I think this looks OK. I'm not sure
we have consensus on 0002, but 0001 seems to be popular with far more
people than not.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Re: Michael Paquier 2016-09-30 <CAB7nPqR=SZNo_=B1ukwCiNn7aWDcw_dV0z-LG4ys9WF1N4a=uQ@mail.gmail.com>
"pg_trans" is used in two places:
-pg_clog records the commit status for each transaction that has been assigned +pg_trans records the commit status for each transaction that has been assigned
- /* copy old commit logs to new data dir */ - copy_subdir_files("pg_clog"); + /* + * Copy old commit logs to new data dir. pg_clog has been renamed to + * pg_trans in post-10 clusters.
(Fwiw, I'd prefer something shorter than the imho clumsy
pg_transaction. "pg_xact" sounded very fine for me, it also combines
nicely with pg_subxact and the existing pg_multixact.)
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
I think the tests for PQserverVersion(conn) / 100 >= 1000 are strange.
I submit that either PQserverVersion(conn) >= 100000 or
PQserverVersion(conn) / 10000 >= 10 is an easier-to-understand test.
I vote for the first style.
+1, that's the way most existing tests of this sort are written.
(Right at the moment, there's kind of a lot of zeroes there, but
once we get to version 11 it'll be less bad.)
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Oct 3, 2016 at 10:00 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Fri, Sep 30, 2016 at 1:45 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:As there have been no reviews at code level, I am moving that to the next CF.
Code review of 0001:
I think the tests for PQserverVersion(conn) / 100 >= 1000 are strange.
I submit that either PQserverVersion(conn) >= 100000 or
PQserverVersion(conn) / 10000 >= 10 is an easier-to-understand test.
I vote for the first style. So in pg_basebackup.c I'd do:#define MINIMUM_VERSION_FOR_PG_WAL 100000
...
int version = PQserverVersion(conn);
...
if (version >= MINIMUM_VERSION_FOR_PG_WAL)
/* do whatever */
I have adopted the existing style of BaseBackup() in last versions,
but I don't mind as well doing the way you suggest, without changing
the stuff in BaseBackup() though, we'd still want a pg_basebackup
compiled with 10.1 to work with 10.2 or newer minor versions of 10.
Also, for this sort of thing:
+ if (!conn) + /* Error message already written in GetConnection() */ + exit(1);...because of the comment, I'd add braces around this.
Fixed. That was done without brackets on HEAD, but you are right that
is not PG-like. (There are other places in src/bin/pg_basebackup doing
the same thing, but I have not modified them to not create more diff
noise).
Tom changed the error-reporting framework for pg_upgrade in
f002ed2b8e45286fe73a36e119cba2016ea0de19, so you'll need to do some
rebasing over that. I haven't checked what the new conventions are,
but obviously you'll want to try to be consistent with them.
strerror(errno) needs to be used instead of getErrorText() in the
context of this patch.
Other than those minor nitpicks, I think this looks OK. I'm not sure
we have consensus on 0002, but 0001 seems to be popular with far more
people than not.
Yes, pg_wal is fine as new name in replacement of pg_xlog. Now for the
pg_clog...
Re: Michael Paquier 2016-09-30
<CAB7nPqR=SZNo_=B1ukwCiNn7aWDcw_dV0z-LG4ys9WF1N4a=uQ@mail.gmail.com>
"pg_trans" is used in two places: -pg_clog records the commit status for each transaction that has been assigned +pg_trans records the commit status for each transaction that has been assigned
- /* copy old commit logs to new data dir */ - copy_subdir_files("pg_clog"); + /* + * Copy old commit logs to new data dir. pg_clog has been renamed to + * pg_trans in post-10 clusters.
(Fwiw, I'd prefer something shorter than the imho clumsy
pg_transaction. "pg_xact" sounded very fine for me, it also combines
nicely with pg_subxact and the existing pg_multixact.)
Thanks, fixed those.
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.
Attached is a new patch set. I have re-done tests with pg_upgrade with
9.5 -> HEAD and 9.6 -> HEAD, and pg_basebackup for symlink handling.
Actually in the latter case I have found a bug in 0001 introduced by
bc34223b because fsync_pgdata() is not aware of the version of the
server it is trying to fsync(). I think that the better way to address
that is to extend fsync_pgdata in file_utils.c with the server version
to fsync() like attached.
--
Michael
Attachments:
0001-Rename-pg_xlog-to-pg_wal.patchapplication/x-download; name=0001-Rename-pg_xlog-to-pg_wal.patchDownload
From fda247ab502f4163217d44997d2c7acd5c0c2208 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 4 Oct 2016 14:38:05 +0900
Subject: [PATCH 1/2] Rename pg_xlog to pg_wal
Additional check handling is needed in pg_upgrade regarding the clusters
worked on, except that it is a very mechanical patch. As pg_basebackup
needs to support servers down to 9.1, special handling is needed depending
on the version of the target server as a consequence of this renaming:
- Soft links need to be generated using pg_xlog or pg_wal.
- stream mode needs to have its output in the correct place.
This has as direct consequence to need a connection to target server before
generating a soft link, which is a bit earlier than before this renaming.
---
doc/src/sgml/backup.sgml | 28 ++++----
doc/src/sgml/config.sgml | 6 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/high-availability.sgml | 14 ++--
doc/src/sgml/perform.sgml | 2 +-
doc/src/sgml/protocol.sgml | 6 +-
doc/src/sgml/ref/pg_resetxlog.sgml | 10 +--
doc/src/sgml/ref/pg_rewind.sgml | 4 +-
doc/src/sgml/ref/pg_xlogdump.sgml | 2 +-
doc/src/sgml/ref/pgtestfsync.sgml | 4 +-
doc/src/sgml/ref/pgupgrade.sgml | 4 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 10 +--
src/backend/access/transam/timeline.c | 4 +-
src/backend/access/transam/xlog.c | 100 +++++++++++++--------------
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/replication/README | 2 +-
src/backend/replication/basebackup.c | 20 +++---
src/backend/replication/walreceiver.c | 6 +-
src/backend/replication/walsender.c | 4 +-
src/backend/storage/file/fd.c | 16 ++---
src/bin/initdb/initdb.c | 12 ++--
src/bin/pg_basebackup/pg_basebackup.c | 80 +++++++++++++--------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 8 +--
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +-
src/bin/pg_rewind/copy_fetch.c | 4 +-
src/bin/pg_rewind/filemap.c | 8 +--
src/bin/pg_rewind/parsexlog.c | 2 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 10 +--
src/bin/pg_upgrade/exec.c | 79 +++++++++++++--------
src/bin/pg_xlogdump/pg_xlogdump.c | 2 +-
src/common/file_utils.c | 39 +++++++----
src/include/access/xlog_internal.h | 2 +-
src/include/common/file_utils.h | 3 +-
src/include/postmaster/pgarch.h | 2 +-
36 files changed, 278 insertions(+), 225 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 95d0ff3..6eaed1e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
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
every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the
@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
-test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
+test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
</para>
@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator
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.
- (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
transactions will be lost, but the database will remain offline until
you free some space.)
@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
operation continues even if the archiving process falls a little behind.
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
- 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
disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend.
@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty
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.
</para>
</sect2>
@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para>
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
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
reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information
@@ -1149,7 +1149,7 @@ SELECT pg_stop_backup();
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
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
were not archived before the system went down.
</para>
@@ -1172,9 +1172,9 @@ SELECT pg_stop_backup();
</listitem>
<listitem>
<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.
- 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,
being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before.
@@ -1183,7 +1183,7 @@ SELECT pg_stop_backup();
<listitem>
<para>
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
problem occurs and you have to start over.)
</para>
@@ -1265,9 +1265,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
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
- preference to files in <filename>pg_xlog/</>.
+ preference to files in <filename>pg_wal/</>.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index e826c19..1bb501c 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2932,7 +2932,7 @@ include_dir 'conf.d'
<listitem>
<para>
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
replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than
@@ -2946,7 +2946,7 @@ include_dir 'conf.d'
<para>
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
<varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number
@@ -3322,7 +3322,7 @@ include_dir 'conf.d'
<para>
Specify how long the standby server should wait when WAL data is not
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
<filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a588350..2e64cc4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15327,7 +15327,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
- pg_xlog | 16
+ pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
pg_subtrans | 19
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 06f49db..5bedaf2 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will
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
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>
At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it
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
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
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
- 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.
</para>
@@ -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
when <command>pg_ctl promote</> is run or a trigger file is found
(<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.
</para>
</sect2>
@@ -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
required, whereas replication slots retain only the number of segments
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.
</para>
<para>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index 7bcbfa7..8d30fd1 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of
- <filename>/pg_xlog</>.
+ <filename>/pg_wal</>.
</para>
</listitem>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 3384e73..50cf527 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para>
Include the necessary WAL segments in the backup. This will include
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.
</para>
</listitem>
@@ -2076,8 +2076,8 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
- <filename>pg_xlog</>, including subdirectories. If the backup is run
- with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be
+ <filename>pg_wal</>, including subdirectories. If the backup is run
+ 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
backup to work, not the rest of the contents.
</para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index fd9d0be..c949c5e 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -173,22 +173,22 @@ PostgreSQL documentation
<para>
The WAL starting address should be
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
part is the <quote>timeline ID</> and should usually be kept the same.
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>
<note>
<para>
<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
<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
- <filename>pg_xlog</> have been lost entirely.
+ <filename>pg_wal</> have been lost entirely.
</para>
</note>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 42ebfbf..371c4a4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -61,14 +61,14 @@ PostgreSQL documentation
<para>
<application>pg_rewind</> examines the timeline histories of the source
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
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
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
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
<application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded
diff --git a/doc/src/sgml/ref/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
index 177caab..cfb6d87 100644
--- a/doc/src/sgml/ref/pg_xlogdump.sgml
+++ b/doc/src/sgml/ref/pg_xlogdump.sgml
@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem>
<para>
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.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 6e134c7..5856356 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -57,8 +57,8 @@
<para>
Specifies the file name to write test data in.
This file should be in the same file system that the
- <filename>pg_xlog</> directory is or will be placed in.
- (<filename>pg_xlog</> contains the <acronym>WAL</> files.)
+ <filename>pg_wal</> directory is or will be placed in.
+ (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current
directory.
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9685193..4b9aab2 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster
once you start the new cluster after the upgrade. Link mode also
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
list of options.
</para>
@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para>
If you have tablespaces, you will need to run a similar
<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.
</para>
</step>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1b812bd..fddb69b 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -141,7 +141,7 @@ Item
</row>
<row>
- <entry><filename>pg_xlog</></entry>
+ <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index fe3b588..346aa76 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -557,7 +557,7 @@
</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
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,
@@ -582,7 +582,7 @@
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
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
uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">).
@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to
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.
Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records.
@@ -750,7 +750,7 @@
<para>
<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
by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally
@@ -767,7 +767,7 @@
<para>
It is advantageous if the log is located on a different disk from 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
original location in the main data directory to the new location.
</para>
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index bd91573..43436a9 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -43,7 +43,7 @@
/*
* Copies all timeline history files with id's between 'begin' and 'end'
- * from archive to pg_xlog.
+ * from archive to pg_wal.
*/
void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
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.
*/
if (fromArchive)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c1b9a97..48c18e8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -235,9 +235,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process.
*
* 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
- * WAL in pg_xlog.
+ * WAL in pg_wal.
*/
bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false;
@@ -700,12 +700,12 @@ typedef enum
{
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
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 */
} XLogSource;
/* 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.
@@ -3345,7 +3345,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery).
*
* 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
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
@@ -3374,7 +3374,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1;
break;
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno);
restoredFromArchive = false;
@@ -3393,7 +3393,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
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);
}
@@ -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,
- XLOG_FROM_PG_XLOG, true);
+ XLOG_FROM_PG_WAL, true);
if (fd != -1)
{
if (!expectedTLEs)
@@ -3693,10 +3693,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
*
* 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
- * 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
* 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
* successfully replayed them, but from others we can't be sure.
*
@@ -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.
*
* 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
- * 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
- * policy decision was made not to. It is fairly common for pg_xlog to be
+ * 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_wal to be
* a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice.
*/
@@ -3871,7 +3871,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH];
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 ||
!S_ISDIR(stat_buf.st_mode))
ereport(FATAL,
@@ -4027,11 +4027,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the
* 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
- * pg_xlog, however (!fetch_ckpt). We could recover using the WAL
- * from the archive, even if pg_xlog is completely empty, but we'd
+ * pg_wal, however (!fetch_ckpt). We could recover using the WAL
+ * 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.
* So err on the safe side and give up.
*/
@@ -4039,7 +4039,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt)
{
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;
if (StandbyModeRequested)
StandbyMode = true;
@@ -4156,7 +4156,7 @@ rescanLatestTimeLine(void)
/*
* 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);
@@ -5189,7 +5189,7 @@ readRecoveryCommandFile(void)
ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
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
{
@@ -6055,7 +6055,7 @@ StartupXLOG(void)
#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
* excluded and need to be re-created.
*/
@@ -6268,7 +6268,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file.
*
* 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.
*
* But usually we already know how far we need to replay the WAL (up
@@ -6472,7 +6472,7 @@ StartupXLOG(void)
/*
* 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
* covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL
@@ -7093,7 +7093,7 @@ StartupXLOG(void)
/*
* 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, e.g., timeline history file) from archive or pg_xlog.
+ * recovery, e.g., timeline history file) from archive or pg_wal.
*/
StandbyMode = false;
@@ -7381,7 +7381,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read
* .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,
* too.
*
@@ -9957,7 +9957,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
* first WAL segment containing the startup checkpoint has pages in
* 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
- * 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.
*
* This also ensures that we have emitted a WAL page header that has
@@ -10604,7 +10604,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
* archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with
* 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
* gets all the required WAL.
*
@@ -11194,9 +11194,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'.
*
* 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
- * pg_xlog 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
+ * streamed the record, or it can already be present in pg_wal. Checking
+ * 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_wal. That is not
* documented or recommended, though.
*
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
@@ -11226,8 +11226,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*-------
* Standby mode is implemented by a state machine:
*
- * 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just
- * pg_xlog (XLOG_FROM_XLOG)
+ * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
+ * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines
@@ -11243,7 +11243,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*-------
*/
if (!InArchiveRecovery)
- currentSource = XLOG_FROM_PG_XLOG;
+ currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE;
@@ -11262,13 +11262,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
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
* do this only after failure, so when you create the
* 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())
{
@@ -11278,7 +11278,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Not in standby mode, and we've now tried the archive
- * and pg_xlog.
+ * and pg_wal.
*/
if (!StandbyMode)
return false;
@@ -11338,7 +11338,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but
* PANIC is not good for availability either, especially
* 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
* streamed, so it's unlikely that it helps, but one can
* hope...
@@ -11399,11 +11399,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
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
- * the archive over ones in pg_xlog, so try the next file again
+ * We just successfully read a file in pg_wal. We prefer files in
+ * the archive over ones in pg_wal, so try the next file again
* from the archive first.
*/
if (InArchiveRecovery)
@@ -11424,7 +11424,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
case XLOG_FROM_ARCHIVE:
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */
if (readFile >= 0)
{
@@ -11437,7 +11437,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Try to restore the file from archive, or read an existing
- * file from pg_xlog.
+ * file from pg_wal.
*/
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
@@ -11446,7 +11446,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */
/*
- * Nope, not found in archive or pg_xlog.
+ * Nope, not found in archive or pg_wal.
*/
lastSourceFailed = true;
break;
@@ -11502,7 +11502,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history
* file if we haven't initialized timeline history
* 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
* isn't changed.
*/
@@ -11534,10 +11534,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Note that we don't "return false" immediately here.
* 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
* 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.
*/
lastSourceFailed = true;
@@ -11577,7 +11577,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* 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
* 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,
* and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it.
@@ -11592,7 +11592,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{
static XLogRecPtr lastComplaint = 0;
- if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
+ if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{
if (RecPtr == lastComplaint)
emode = DEBUG1;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d153a44..b919164 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/*
* 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
- * 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
KeepFileRestoredFromArchive(char *path, char *xlogfname)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 33383b4..01cbd90 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump
*
* 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
* 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
diff --git a/src/backend/replication/README b/src/backend/replication/README
index ad4864d..0cbb990 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart.
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.
Walreceiver sends information about replication progress to the master server
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 1eabaef..6dd47ce 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -346,7 +346,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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',
* regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in
@@ -359,11 +359,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno);
- dir = AllocateDir("pg_xlog");
+ dir = AllocateDir("pg_wal");
if (!dir)
ereport(ERROR,
- (errmsg("could not open directory \"%s\": %m", "pg_xlog")));
- while ((de = ReadDir(dir, "pg_xlog")) != NULL)
+ (errmsg("could not open directory \"%s\": %m", "pg_wal")));
+ while ((de = ReadDir(dir, "pg_wal")) != NULL)
{
/* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) &&
@@ -401,7 +401,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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.
*/
if (nWalFiles < 1)
@@ -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
* 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);
/*
* Also send archive_status directory (by hackishly reusing
* statbuf from above ...).
*/
- size += _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf,
+ size += _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf,
sizeonly);
- continue; /* don't recurse into pg_xlog */
+ continue; /* don't recurse into pg_wal */
}
/* Allow symbolic links in pg_tblspc only */
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 413ee3a..d40b5e9 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new
* 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
* nudge the existing walreceiver process that's waiting, instead of launching
* a new one.
@@ -364,7 +364,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await
* 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
* on the new timeline.
*/
@@ -739,7 +739,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli)));
/*
- * Write the file to pg_xlog.
+ * Write the file to pg_wal.
*/
writeTimeLineHistoryFile(tli, content, len);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index c7743da..dcbb289 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* 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
* 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
* that's older than the switchpoint, if it's still in the same
@@ -2055,7 +2055,7 @@ retry:
*
* For example, imagine that this server is currently on timeline
* 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
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03143f1..b7ff5ef 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
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.
*/
xlog_is_symlink = false;
@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{
struct stat st;
- if (lstat("pg_xlog", &st) < 0)
+ if (lstat("pg_wal", &st) < 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
- "pg_xlog")));
+ "pg_wal")));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction("pg_xlog"))
+ if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true;
#endif
@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1);
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);
#endif
@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(".", datadir_fsync_fname, false, LOG);
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);
}
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e52e67d..385e808 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -195,7 +195,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
- "pg_xlog/archive_status",
+ "pg_wal/archive_status",
"pg_clog",
"pg_commit_ts",
"pg_dynshmem",
@@ -2091,8 +2091,6 @@ make_postgres(FILE *cmdfd)
PG_CMD_PUTS(*line);
}
-
-
/*
* signal handler in case we are interrupted.
*
@@ -2830,7 +2828,7 @@ create_xlog_or_symlink(void)
char *subdirloc;
/* 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)
{
@@ -2963,7 +2961,7 @@ initialize_data_directory(void)
create_xlog_or_symlink();
- /* Create required subdirectories (other than pg_xlog) */
+ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... "));
fflush(stdout);
@@ -3258,7 +3256,7 @@ main(int argc, char *argv[])
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- fsync_pgdata(pg_data, progname);
+ fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok();
return 0;
}
@@ -3324,7 +3322,7 @@ main(int argc, char *argv[])
{
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- fsync_pgdata(pg_data, progname);
+ fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok();
}
else
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 0f5d9d6..6b2a01f 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -55,6 +55,12 @@ typedef struct TablespaceList
TablespaceListCell *tail;
} 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 */
static char *basedir = NULL;
static TablespaceList tablespace_dirs = {NULL, NULL};
@@ -526,15 +532,22 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */
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
- * basedir/pg_xlog as the directory entry in the tar file may arrive
- * later.
+ * Create pg_wal/archive_status or pg_xlog/archive_status (and thus
+ * pg_wal or pg_xlog) depending on the target server so we can write to
+ * 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",
- basedir);
+ snprintf(statusdir, sizeof(statusdir), "%s/%s/archive_status",
+ basedir,
+ PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
+ "pg_xlog" : "pg_wal");
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
{
@@ -1338,15 +1351,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0)
{
/*
- * When streaming WAL, pg_xlog will have been created
- * by the wal receiver process. Also, when transaction
- * log directory location was specified, pg_xlog has
- * already been created as a symbolic link before
- * starting the actual backup. So just ignore creation
- * failures on related directories.
+ * When streaming WAL, pg_wal (or pg_xlog for pre-9.6
+ * clusters) will have been created by the wal receiver
+ * process. Also, when transaction log directory location
+ * was specified, pg_wal (or pg_xlog) has already been
+ * created as a symbolic link before starting the actual
+ * backup. So just ignore creation failures on related
+ * directories.
*/
- if (!((pg_str_endswith(filename, "/pg_xlog") ||
- pg_str_endswith(filename, "/archive_status")) &&
+ if (!((pg_str_endswith(filename, "/pg_wal") ||
+ pg_str_endswith(filename, "/pg_xlog")||
+ pg_str_endswith(filename, "/archive_status")) &&
errno == EEXIST))
{
fprintf(stderr,
@@ -1634,15 +1649,10 @@ BaseBackup(void)
char xlogend[64];
int minServerMajor,
maxServerMajor;
- int serverMajor;
+ int serverVersion,
+ serverMajor;
- /*
- * Connect in replication mode to the server
- */
- conn = GetConnection();
- if (!conn)
- /* Error message already written in GetConnection() */
- exit(1);
+ Assert(conn != NULL);
/*
* Check server version. BASE_BACKUP command was introduced in 9.1, so we
@@ -1650,7 +1660,8 @@ BaseBackup(void)
*/
minServerMajor = 901;
maxServerMajor = PG_VERSION_NUM / 100;
- serverMajor = PQserverVersion(conn) / 100;
+ serverVersion = PQserverVersion(conn);
+ serverMajor = serverVersion / 100;
if (serverMajor < minServerMajor || serverMajor > maxServerMajor)
{
const char *serverver = PQparameterStatus(conn, "server_version");
@@ -1979,7 +1990,7 @@ BaseBackup(void)
}
else
{
- (void) fsync_pgdata(basedir, progname);
+ (void) fsync_pgdata(basedir, progname, serverVersion);
}
}
@@ -2296,6 +2307,14 @@ main(int argc, char **argv)
if (format == 'p' || strcmp(basedir, "-") != 0)
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 */
if (strcmp(xlog_dir, "") != 0)
{
@@ -2303,19 +2322,24 @@ main(int argc, char **argv)
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
if (symlink(xlog_dir, linkloc) != 0)
{
fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"),
progname, linkloc, strerror(errno));
- exit(1);
+ disconnect_and_exit(1);
}
#else
fprintf(stderr, _("%s: symlinks are not supported on this platform\n"));
- exit(1);
+ disconnect_and_exit(1);
#endif
free(linkloc);
}
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index a52bd4e..c8abbeb 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -67,9 +67,9 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
'pg_basebackup runs');
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(
- [ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ],
+ [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ],
'no WAL files copied');
@@ -230,12 +230,12 @@ like(
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'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');
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'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');
$node->command_fails(
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 525b82ba..2b76f64 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
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
* conservative, because of xlog.c's attempts to pre-create files.
*/
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 327e7ef..d0c1586 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -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,
* 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) ||
- strcmp(path, "pg_xlog") == 0)
+ strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
#else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 9b00dc1..3905a5d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
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
* 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;
/*
@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type)
{
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.. */
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,
/*
* 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;
key.path = (char *) path;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index b53591d..23ac4e7 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
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
* the data blocks touched by the WAL records, and return them in a page map.
*/
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index bdcab56..12950ea 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -1,5 +1,5 @@
#
-# 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 warnings;
@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir;
- # turn pg_xlog into a symlink
- print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n");
- move("$test_master_datadir/pg_xlog", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die;
+ # turn pg_wal into a symlink
+ print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
+ move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
+ symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master();
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 6d04e56..55a6f0d 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
#include <fcntl.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 validate_exec(const char *dir, const char *cmdName);
@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster);
- check_data_dir(old_cluster.pgdata);
+ check_data_dir(&old_cluster);
check_bin_dir(&new_cluster);
- check_data_dir(new_cluster.pgdata);
+ check_data_dir(&new_cluster);
}
@@ -253,6 +253,32 @@ win32_check_directory_write_permissions(void)
/*
+ * 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()
*
* This function validates the given cluster directory - we search for a
@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void)
*
*/
static void
-check_data_dir(const char *pg_data)
+check_data_dir(ClusterInfo *cluster)
{
- char subDirName[MAXPGPATH];
- int subdirnum;
-
- /* start check with top-most directory */
- const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
- "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
- "pg_xlog"};
-
- for (subdirnum = 0;
- subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
- ++subdirnum)
- {
- struct stat statBuf;
-
- snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
- /* Win32 can't stat() a directory with a trailing slash. */
- *requiredSubdirs[subdirnum] ? "/" : "",
- requiredSubdirs[subdirnum]);
-
- 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);
- }
+ const char *pg_data = cluster->pgdata;
+
+ /* get old and new cluster versions */
+ old_cluster.major_version = get_major_server_version(&old_cluster);
+ new_cluster.major_version = get_major_server_version(&new_cluster);
+
+ check_single_dir(pg_data, "");
+ check_single_dir(pg_data, "base");
+ check_single_dir(pg_data, "global");
+ check_single_dir(pg_data, "pg_multixact");
+ check_single_dir(pg_data, "pg_subtrans");
+ check_single_dir(pg_data, "pg_tblspc");
+ check_single_dir(pg_data, "pg_twophase");
+
+ /* pg_xlog has been renamed to pg_wal in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_xlog");
+ else
+ check_single_dir(pg_data, "pg_wal");
}
diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
index 9ad9321..7490398 100644
--- a/src/bin/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -680,7 +680,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\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(" (default: ./pg_xlog)\n");
+ printf(" (default: ./pg_wal)\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(" -s, --start=RECPTR start reading at log position RECPTR\n");
diff --git a/src/common/file_utils.c b/src/common/file_utils.c
index 1855e23..2fdb469 100644
--- a/src/common/file_utils.c
+++ b/src/common/file_utils.c
@@ -29,6 +29,11 @@
#define PG_FLUSH_DATA_WORKS 1
#endif
+/*
+ * pg_xlog has been renamed to pg_wal in version 10.
+ */
+#define MINIMUM_VERSION_FOR_PG_WAL 100000
+
#ifdef PG_FLUSH_DATA_WORKS
static int pre_sync_fname(const char *fname, bool isdir,
const char *progname);
@@ -40,25 +45,31 @@ static void walkdir(const char *path,
/*
* Issue fsync recursively on PGDATA and all its contents.
*
- * We fsync regular files and directories wherever they are, but we
- * follow symlinks only for pg_xlog and immediately under pg_tblspc.
- * Other symlinks are presumed to point at files we're not responsible
- * for fsyncing, and might not have privileges to write at all.
+ * We fsync regular files and directories wherever they are, but we follow
+ * 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 for
+ * 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.
*/
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;
- char pg_xlog[MAXPGPATH];
+ char pg_wal[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);
/*
- * 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.
*/
xlog_is_symlink = false;
@@ -67,14 +78,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
{
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"),
- progname, pg_xlog, strerror(errno));
+ progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction(pg_xlog))
+ if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true;
#endif
@@ -85,7 +96,7 @@ fsync_pgdata(const char *pg_data, const char *progname)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false, progname);
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);
#endif
@@ -93,14 +104,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(pg_data, fsync_fname, false, progname);
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);
}
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 0a595cc..ceb0462 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/*
* The XLog directory and control file (relative to $PGDATA)
*/
-#define XLOGDIR "pg_xlog"
+#define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control"
/*
diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h
index 1cb263d..b83c398 100644
--- a/src/include/common/file_utils.h
+++ b/src/include/common/file_utils.h
@@ -17,7 +17,8 @@
extern int fsync_fname(const char *fname, bool isdir,
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,
const char *progname);
extern int fsync_parent_path(const char *fname, const char *progname);
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index f2cbfb3..6df73c9 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -16,7 +16,7 @@
/* ----------
* 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
* appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended.
--
2.10.0
0002-Rename-pg_clog-to-pg_transaction.patchapplication/x-download; name=0002-Rename-pg_clog-to-pg_transaction.patchDownload
From 0d30ef662a52b6b02496a6618c0457d6d6773992 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 4 Oct 2016 14:41:15 +0900
Subject: [PATCH 2/2] Rename pg_clog to pg_transaction
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 6 +++---
doc/src/sgml/catalogs.sgml | 6 +++---
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 12 +++++------
doc/src/sgml/ref/pg_resetxlog.sgml | 6 +++---
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 ++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 10 ++++-----
src/backend/access/transam/README | 22 ++++++++++----------
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 4 ++--
src/backend/access/transam/multixact.c | 8 +++----
src/backend/access/transam/subtrans.c | 18 ++++++++--------
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/xact.c | 38 ++++++++++++++++++++--------------
src/backend/access/transam/xlog.c | 6 +++---
src/backend/commands/vacuum.c | 14 ++++++-------
src/backend/postmaster/autovacuum.c | 4 ++--
src/backend/storage/buffer/README | 4 ++--
src/backend/storage/ipc/procarray.c | 5 +++--
src/backend/utils/time/tqual.c | 29 +++++++++++++-------------
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++-----------
src/include/access/slru.h | 12 +++++------
28 files changed, 145 insertions(+), 125 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..eb4f962 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
- all transactions. A table file is only usable with this
+ <filename>pg_transaction/*</filename>, which contain the commit status
+ of all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_transaction</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 29738b0..77b395e 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_transaction</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,8 +2514,8 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
- It is the minimum of the per-table
+ transaction ID wraparound or to allow <literal>pg_transaction</> to be
+ shrunk. It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
</row>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 1bb501c..b0b7215 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5822,7 +5822,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_transaction</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2e64cc4..a9d2ec4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15323,7 +15323,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_transaction | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e0..c741a9b 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
- will take more space, because it must store the commit status of all
- transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
+ is that the <filename>pg_transaction</> subdirectory of the database
+ cluster will take more space, because it must store the commit status of
+ all transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_transaction</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_transaction</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_transaction</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..67b048b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
- adding one,
+ file name in the directory <filename>pg_transaction</> under the data
+ directory, adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_transaction</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..34ef4f1 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_transaction</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..61d15d4 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -136,6 +131,11 @@ Item
</row>
<row>
+ <entry><filename>pg_transaction</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>pg_twophase</></entry>
<entry>Subdirectory containing state files for prepared transactions</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa76..aac0a8d 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_transaction</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b019bc1..075d06a 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,11 +6762,11 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
- * exclusive lock ensures no other backend is in process of checking the
- * tuple status. Also, getting exclusive lock makes it safe to adjust the
- * infomask bits.
+ * conceivably not finish checking the XID against pg_transaction before we
+ * finish the VACUUM and perhaps truncate off the part of pg_transaction he
+ * needs. Getting exclusive lock ensures no other backend is in process of
+ * checking the tuple status. Also, getting exclusive lock makes it safe to
+ * adjust the infomask bits.
*
* NB: All code in here must be safe to execute during crash recovery!
*/
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..36bcde9 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,18 +331,18 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
------------------------
+pg_transaction and pg_subtrans
+------------------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
-information. There is a limited number of pages of each kept in memory, so
-in many cases there is no need to actually read from disk. However, if
-there's a long running transaction or a backend sitting idle with an open
+pg_transaction and pg_subtrans are permanent (on-disk) storage of transaction
+related information. There is a limited number of pages of each kept in
+memory, so in many cases there is no need to actually read from disk. However,
+if there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
-an XID. A transaction can be in progress, committed, aborted, or
+pg_transaction records the commit status for each transaction that has been
+assigned an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
necessary to update a subtransaction's transaction status to subcommit, so we
@@ -381,10 +381,10 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_transaction and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+for pg_transaction are implemented in transam.c, while the low-level functions
+are in clog.c. pg_subtrans is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..c7a3cbb 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_transaction", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index a8d275f..4a48f76 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,8 +3,8 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
- * for each transaction.
+ * This module is a pg_transaction-like system that stores the commit
+ * timestamp for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
* CommitTs page is initialized to zeroes. Also, one XLOG record is
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..aa8e07e 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,10 +3,10 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
- * MultiXactMember for each MultiXactId. It is a fundamental part of the
- * shared-row-lock implementation. Each MultiXactMember is comprised of a
- * TransactionId and a set of flag bits. The name is a bit historical:
+ * The pg_multixact manager is a pg_transaction-like manager that stores an
+ * array of MultiXactMember for each MultiXactId. It is a fundamental part
+ * of the shared-row-lock implementation. Each MultiXactMember is comprised
+ * of a TransactionId and a set of flag bits. The name is a bit historical:
* originally, a MultiXactId consisted of more than one TransactionId (except
* in rare corner cases), hence "multi". Nowadays, however, it's perfectly
* legitimate to have MultiXactIds that only include a single Xid.
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..d96a487 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,17 +3,17 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
- * transaction Id for each transaction. It is a fundamental part of the
- * nested transactions implementation. A main transaction has a parent
- * of InvalidTransactionId, and each subtransaction has its immediate parent.
- * The tree can easily be walked from child to parent, but not in the
- * opposite direction.
+ * The pg_subtrans manager is a pg_transaction-like manager that stores
+ * the parent transaction Id for each transaction. It is a fundamental
+ * part of the nested transactions implementation. A main transaction has
+ * a parent of InvalidTransactionId, and each subtransaction has its
+ * immediate parent. The tree can easily be walked from child to parent,
+ * but not in the opposite direction.
*
* This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
- * no need to preserve data over a crash and restart.
+ * are completely different from pg_transaction, because we only need to
+ * remember pg_subtrans information for currently-open transactions. Thus,
+ * there is no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
* data across crashes. During database startup, we simply force the
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..8a41c7f 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_transaction but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604..52de336 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,8 +1379,8 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
- * TransactionIdIsInProgress will stop saying the prepared xact is in
+ * pg_transaction, then remove its PGPROC from the global ProcArray (which
+ * means TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
*/
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_transaction */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..817b323 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,10 +1206,10 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
- * disk, leading to loss of the transaction commit if the system
- * crashes a little later.
+ * pg_transaction. Without this, it is possible for the checkpoint
+ * to set REDO after the XLOG record but fail to flush the pg_trans
+ * update to disk, leading to loss of the transaction commit if the
+ * system crashes a little later.
*
* Note: we could, but don't bother to, set this flag in
* RecordTransactionAbort. That's because loss of a transaction abort
@@ -2033,8 +2033,8 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
- * durably commit.
+ * We need to mark our XIDs as committed in pg_transaction. This is
+ * where we durably commit.
*/
latestXid = RecordTransactionCommit();
}
@@ -2539,10 +2539,10 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
- * far as assigning an XID to advertise). But if we're inside a parallel
- * worker, skip this; the user backend must be the one to write the abort
- * record.
+ * Advertise the fact that we aborted in pg_transaction (assuming that we
+ * got as far as assigning an XID to advertise). But if we're inside a
+ * parallel worker, skip this; the user backend must be the one to write
+ * the abort record.
*/
if (!is_parallel_worker)
latestXid = RecordTransactionAbort(false);
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_transaction. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_transaction.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,8 +5389,8 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
- * protocol during recovery to provide information on database
+ * Mark the transaction committed in pg_transaction. We use async
+ * commit protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
* this commit record. This ensures that if we crash we don't see hint
@@ -5526,7 +5526,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5545,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 48c18e8..2262ae0 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8487,9 +8487,9 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
- * we wait till he's out of his commit critical section before proceeding.
- * See notes in RecordTransactionCommit().
+ * that our flushing had better include the xact's update of
+ * pg_transaction. So we wait till he's out of his commit critical
+ * section before proceeding. See notes in RecordTransactionCommit().
*
* Because we've already released the insertion locks, this test is a bit
* fuzzy: it is possible that we will wait for xacts we didn't really need
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..5c61d1a 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,8 +356,8 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
- * (autovacuum.c does this for itself.)
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
}
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_transaction and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_transaction and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_transaction).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,8 +1086,8 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
- * as it could be.
+ * worst possible outcome is that pg_transaction is not truncated as
+ * aggressively as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 1a92ca1..31fcd51 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2394,8 +2394,8 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
- * only need to do this once, not after each table.
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. We only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..94da258 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,8 +63,8 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
-great harm is done if they get reset to zero by conflicting updates.
+(they cache the results of transaction status lookups in pg_transaction),
+so no great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
an exclusive buffer lock (and it must also be WAL-logged).
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..dd5c79a 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_transaction.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,8 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_transaction to see if it's been
+ * aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..fbf9c6c 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,23 +13,24 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
- * just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
- * MyPgXact->xid in the PGXACT array. That fixes that problem, but it
- * also means there is a window where TransactionIdIsInProgress and
- * TransactionIdDidCommit will both return true. If we check only
- * TransactionIdDidCommit, we could consider a tuple committed when a
- * later GetSnapshotData call will still think the originating transaction
- * is in progress, which leads to application-level inconsistency. The
- * upshot is that we gotta check TransactionIdIsInProgress first in all
- * code paths, except for a few cases where we are looking at
- * subtransactions of our own main transaction and so there can't be any
- * race condition.
+ * pg_transaction). Otherwise we have a race condition: we might decide
+ * that a just-committed transaction crashed, because none of the tests
+ * succeed. xact.c is careful to record commit/abort in pg_transaction
+ * before it unsets MyPgXact->xid in the PGXACT array. That fixes that
+ * problem, but it also means there is a window where
+ * TransactionIdIsInProgress and TransactionIdDidCommit will both return
+ * true. If we check only TransactionIdDidCommit, we could consider a
+ * tuple committed when a later GetSnapshotData call will still think
+ * the originating transaction is in progress, which leads to
+ * application-level inconsistency. The upshot is that we gotta check
+ * TransactionIdIsInProgress first in all code paths, except for a few
+ * cases where we are looking at subtransactions of our own main
+ * transaction and so there can't be any race condition.
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_transaction until after deciding that the xact is no longer
+ * in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 385e808..974f11a 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_transaction",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 55a6f0d..a3a0a0f 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_transaction in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_transaction");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 90c0720..04704c2 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_trans_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_trans_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_trans_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_transaction in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..001817f 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,10 +76,10 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
- * has lsn_groups_per_page entries per buffer slot, each containing the
- * highest LSN known for a contiguous group of SLRU entries on that slot's
- * page.
+ * for pg_transaction, false for multixact, pg_subtrans, pg_notify).
+ * group_lsn[] has lsn_groups_per_page entries per buffer slot, each
+ * containing the highest LSN known for a contiguous group of SLRU entries
+ * on that slot's page.
*/
XLogRecPtr *group_lsn;
int lsn_groups_per_page;
@@ -120,8 +120,8 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * This flag tells whether to fsync writes (true for pg_transaction and
+ * multixact stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.10.0
On 10/4/16 1:48 AM, Michael Paquier wrote:
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.
Christoph also prefers pg_xact [1]/messages/by-id/20161003141959.qhvd6roesj4kpgww@msg.df7cb.de.
--
-David
david@pgmasters.net
[1]: /messages/by-id/20161003141959.qhvd6roesj4kpgww@msg.df7cb.de
/messages/by-id/20161003141959.qhvd6roesj4kpgww@msg.df7cb.de
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Oct 4, 2016 at 1:48 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
Yes, pg_wal is fine as new name in replacement of pg_xlog. Now for the
pg_clog...
Of course the irony here is that "WAL" stands for "Write Ahead Log".
So we're renaming a directly that has "log" in the name (pg_xlog) to a
directory that has an "l" in the name which stands for "log" (pg_wal).
Whee!
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 10/4/16 1:48 AM, Michael Paquier wrote:
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.
I think this would all be a lot easier if we just moved all the pg_*
directories one directory down. We did this with "global" many years
ago and it worked out well. We didn't actually have to change the file
names, the top-level directory became cleaner, and no one was messing
around with the files anymore. Adjusting external tools also becomes
easier. There is so much lore out there about clog and xlog; it would
be annoying to break with that.
I can see a reason for not doing that with pg_xlog, because that is a
bit of an external interface, with initdb -X and such, and pg_wal is a
pretty good alternative name. But no one deals with these other
directories directly, so just move them out of the way.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
On 10/4/16 1:48 AM, Michael Paquier wrote:
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.
I think this would all be a lot easier if we just moved all the pg_*
directories one directory down.
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.
The relocation aspect was meant to address another problem, which
is making it easier to distinguish which parts of the tree should
be copied by tools like pg_basebackup. But that's not what Michael
is asking for votes on.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* David Steele (david@pgmasters.net) wrote:
On 10/4/16 1:48 AM, Michael Paquier wrote:
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.Christoph also prefers pg_xact [1].
Since we're asking for votes, I also prefer pg_xact over the other
options listed here.
Thanks!
Stephen
On Thu, Oct 13, 2016 at 12:31 AM, Stephen Frost <sfrost@snowman.net> wrote:
* David Steele (david@pgmasters.net) wrote:
On 10/4/16 1:48 AM, Michael Paquier wrote:
So this is still open for votes. Here are the candidates and who
voiced for what:
- pg_transaction: Michael P, Thomas M. => Current 0002 is doing that.
- pg_xact: David S, Robert
- pg_trans: Tom
- pg_transaction_status: Peter E.Christoph also prefers pg_xact [1].
Since we're asking for votes, I also prefer pg_xact over the other
options listed here.
OK. I can live with that as well. Attached are three patches. The
pg_xlog -> pg_wal move, the pg_clog -> pg_transaction move, and the
pg_clog -> pg_xact move. Only one survivor to be chosen among the last
two ones.
--
Michael
Attachments:
0001-Rename-pg_xlog-to-pg_wal.patchtext/plain; charset=US-ASCII; name=0001-Rename-pg_xlog-to-pg_wal.patchDownload
From 79d665f1bda7944cae7631b9aeb6870fe1df67cd Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 4 Oct 2016 14:38:05 +0900
Subject: [PATCH 1/2] Rename pg_xlog to pg_wal
Additional check handling is needed in pg_upgrade regarding the clusters
worked on, except that it is a very mechanical patch. As pg_basebackup
needs to support servers down to 9.1, special handling is needed depending
on the version of the target server as a consequence of this renaming:
- Soft links need to be generated using pg_xlog or pg_wal.
- stream mode needs to have its output in the correct place.
This has as direct consequence to need a connection to target server before
generating a soft link, which is a bit earlier than before this renaming.
---
doc/src/sgml/backup.sgml | 28 ++++----
doc/src/sgml/config.sgml | 6 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/high-availability.sgml | 14 ++--
doc/src/sgml/perform.sgml | 2 +-
doc/src/sgml/protocol.sgml | 6 +-
doc/src/sgml/ref/pg_resetxlog.sgml | 10 +--
doc/src/sgml/ref/pg_rewind.sgml | 4 +-
doc/src/sgml/ref/pg_xlogdump.sgml | 2 +-
doc/src/sgml/ref/pgtestfsync.sgml | 4 +-
doc/src/sgml/ref/pgupgrade.sgml | 4 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 10 +--
src/backend/access/transam/timeline.c | 4 +-
src/backend/access/transam/xlog.c | 100 +++++++++++++--------------
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/replication/README | 2 +-
src/backend/replication/basebackup.c | 20 +++---
src/backend/replication/walreceiver.c | 6 +-
src/backend/replication/walsender.c | 4 +-
src/backend/storage/file/fd.c | 16 ++---
src/bin/initdb/initdb.c | 12 ++--
src/bin/pg_basebackup/pg_basebackup.c | 80 +++++++++++++--------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 8 +--
src/bin/pg_resetxlog/pg_resetxlog.c | 2 +-
src/bin/pg_rewind/copy_fetch.c | 4 +-
src/bin/pg_rewind/filemap.c | 8 +--
src/bin/pg_rewind/parsexlog.c | 2 +-
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl | 10 +--
src/bin/pg_upgrade/exec.c | 79 +++++++++++++--------
src/bin/pg_xlogdump/pg_xlogdump.c | 2 +-
src/common/file_utils.c | 39 +++++++----
src/include/access/xlog_internal.h | 2 +-
src/include/common/file_utils.h | 3 +-
src/include/postmaster/pgarch.h | 2 +-
36 files changed, 278 insertions(+), 225 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 95d0ff3..6eaed1e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -472,7 +472,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
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
every change made to the database's data files. This log exists
primarily for crash-safety purposes: if the system crashes, the
@@ -616,7 +616,7 @@ archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
<literal>%p</> and <literal>%f</> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
-test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
+test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
</para>
@@ -668,9 +668,9 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
fills, nothing further can be archived until the tape is swapped.
You should ensure that any error condition or request to a human operator
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.
- (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
transactions will be lost, but the database will remain offline until
you free some space.)
@@ -682,7 +682,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
operation continues even if the archiving process falls a little behind.
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
- 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
disk space. You are advised to monitor the archiving process to ensure that
it is working as you intend.
@@ -743,7 +743,7 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_xlog/
configuration file reload. If you wish to temporarily stop archiving,
one way to do it is to set <varname>archive_command</> to the empty
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.
</para>
</sect2>
@@ -1062,10 +1062,10 @@ SELECT pg_stop_backup();
<para>
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
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
reasons. You might also want to exclude <filename>postmaster.pid</>
and <filename>postmaster.opts</>, which record information
@@ -1149,7 +1149,7 @@ SELECT pg_stop_backup();
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
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
were not archived before the system went down.
</para>
@@ -1172,9 +1172,9 @@ SELECT pg_stop_backup();
</listitem>
<listitem>
<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.
- 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,
being careful to ensure that you re-establish it as a symbolic link
if you had it set up that way before.
@@ -1183,7 +1183,7 @@ SELECT pg_stop_backup();
<listitem>
<para>
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
problem occurs and you have to start over.)
</para>
@@ -1265,9 +1265,9 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
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
- preference to files in <filename>pg_xlog/</>.
+ preference to files in <filename>pg_wal/</>.
</para>
<para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index e826c19..1bb501c 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2932,7 +2932,7 @@ include_dir 'conf.d'
<listitem>
<para>
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
replication. Each segment is normally 16 megabytes. If a standby
server connected to the sending server falls behind by more than
@@ -2946,7 +2946,7 @@ include_dir 'conf.d'
<para>
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
<varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, so the number
@@ -3322,7 +3322,7 @@ include_dir 'conf.d'
<para>
Specify how long the standby server should wait when WAL data is not
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
<filename>postgresql.conf</> file or on the server command line.
The default value is 5 seconds. Units are milliseconds if not specified.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a588350..2e64cc4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15327,7 +15327,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
- pg_xlog | 16
+ pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
pg_subtrans | 19
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 06f49db..5bedaf2 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -594,24 +594,24 @@ protocol to make nodes agree on a serializable transactional order.
(see <xref linkend="restore-command">) or directly from the master
over a TCP connection (streaming replication). The standby server will
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
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>
At startup, the standby begins by restoring all WAL available in the
archive location, calling <varname>restore_command</>. Once it
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
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
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
- 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.
</para>
@@ -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
when <command>pg_ctl promote</> is run or a trigger file is found
(<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.
</para>
</sect2>
@@ -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
required, whereas replication slots retain only the number of segments
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.
</para>
<para>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index 7bcbfa7..8d30fd1 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -1612,7 +1612,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
Increase <xref linkend="guc-max-wal-size"> and <xref
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
of checkpoints, but increases the storage requirements of
- <filename>/pg_xlog</>.
+ <filename>/pg_wal</>.
</para>
</listitem>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 3384e73..50cf527 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1947,7 +1947,7 @@ The commands accepted in walsender mode are:
<para>
Include the necessary WAL segments in the backup. This will include
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.
</para>
</listitem>
@@ -2076,8 +2076,8 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
- <filename>pg_xlog</>, including subdirectories. If the backup is run
- with WAL files included, a synthesized version of <filename>pg_xlog</filename> will be
+ <filename>pg_wal</>, including subdirectories. If the backup is run
+ 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
backup to work, not the rest of the contents.
</para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index fd9d0be..c949c5e 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -173,22 +173,22 @@ PostgreSQL documentation
<para>
The WAL starting address should be
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
part is the <quote>timeline ID</> and should usually be kept the same.
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>
<note>
<para>
<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
<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
- <filename>pg_xlog</> have been lost entirely.
+ <filename>pg_wal</> have been lost entirely.
</para>
</note>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 42ebfbf..371c4a4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -61,14 +61,14 @@ PostgreSQL documentation
<para>
<application>pg_rewind</> examines the timeline histories of the source
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
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
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
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
<application>pg_rewind</> is not limited to failover, e.g. a standby
server can be promoted, run some write transactions, and then rewinded
diff --git a/doc/src/sgml/ref/pg_xlogdump.sgml b/doc/src/sgml/ref/pg_xlogdump.sgml
index 177caab..cfb6d87 100644
--- a/doc/src/sgml/ref/pg_xlogdump.sgml
+++ b/doc/src/sgml/ref/pg_xlogdump.sgml
@@ -118,7 +118,7 @@ PostgreSQL documentation
<listitem>
<para>
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.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 6e134c7..5856356 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -57,8 +57,8 @@
<para>
Specifies the file name to write test data in.
This file should be in the same file system that the
- <filename>pg_xlog</> directory is or will be placed in.
- (<filename>pg_xlog</> contains the <acronym>WAL</> files.)
+ <filename>pg_wal</> directory is or will be placed in.
+ (<filename>pg_wal</> contains the <acronym>WAL</> files.)
The default is <filename>pg_test_fsync.out</> in the current
directory.
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9685193..4b9aab2 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -345,7 +345,7 @@ NET STOP postgresql-9.0
your old cluster
once you start the new cluster after the upgrade. Link mode also
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
list of options.
</para>
@@ -508,7 +508,7 @@ rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_d
<para>
If you have tablespaces, you will need to run a similar
<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.
</para>
</step>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 1b812bd..fddb69b 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -141,7 +141,7 @@ Item
</row>
<row>
- <entry><filename>pg_xlog</></entry>
+ <entry><filename>pg_wal</></entry>
<entry>Subdirectory containing WAL (Write Ahead Log) files</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index fe3b588..346aa76 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -557,7 +557,7 @@
</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
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,
@@ -582,7 +582,7 @@
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
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
uses a replication slot will have the same effect (see
<xref linkend="streaming-replication-slots">).
@@ -594,7 +594,7 @@
which are similar to checkpoints in normal operation: the server forces
all its state to disk, updates the <filename>pg_control</> file to
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.
Restartpoints can't be performed more frequently than checkpoints in the
master because restartpoints can only be performed at checkpoint records.
@@ -750,7 +750,7 @@
<para>
<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
by altering the <option>--with-wal-segsize</> configure option when
building the server). Each segment is divided into pages, normally
@@ -767,7 +767,7 @@
<para>
It is advantageous if the log is located on a different disk from 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
original location in the main data directory to the new location.
</para>
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c
index bd91573..43436a9 100644
--- a/src/backend/access/transam/timeline.c
+++ b/src/backend/access/transam/timeline.c
@@ -43,7 +43,7 @@
/*
* Copies all timeline history files with id's between 'begin' and 'end'
- * from archive to pg_xlog.
+ * from archive to pg_wal.
*/
void
restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
@@ -191,7 +191,7 @@ readTimeLineHistory(TimeLineID targetTLI)
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.
*/
if (fromArchive)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 08c87f9..4fda179 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -235,9 +235,9 @@ static int LocalXLogInsertAllowed = -1;
* valid in the startup process.
*
* 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
- * WAL in pg_xlog.
+ * WAL in pg_wal.
*/
bool ArchiveRecoveryRequested = false;
bool InArchiveRecovery = false;
@@ -700,12 +700,12 @@ typedef enum
{
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
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 */
} XLogSource;
/* 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.
@@ -3345,7 +3345,7 @@ XLogFileOpen(XLogSegNo segno)
* Open a logfile segment for reading (during recovery).
*
* 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
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
@@ -3374,7 +3374,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
return -1;
break;
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
case XLOG_FROM_STREAM:
XLogFilePath(path, tli, segno);
restoredFromArchive = false;
@@ -3393,7 +3393,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
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);
}
@@ -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,
- XLOG_FROM_PG_XLOG, true);
+ XLOG_FROM_PG_WAL, true);
if (fd != -1)
{
if (!expectedTLEs)
@@ -3693,10 +3693,10 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
*
* 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
- * 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
* 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
* successfully replayed them, but from others we can't be sure.
*
@@ -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.
*
* 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
- * 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
- * policy decision was made not to. It is fairly common for pg_xlog to be
+ * 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_wal to be
* a symlink, and if that was the DBA's intent then automatically making a
* plain directory would result in degraded performance with no notice.
*/
@@ -3871,7 +3871,7 @@ ValidateXLOGDirectoryStructure(void)
char path[MAXPGPATH];
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 ||
!S_ISDIR(stat_buf.st_mode))
ereport(FATAL,
@@ -4027,11 +4027,11 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
* If archive recovery was requested, but we were still doing
* crash recovery, switch to archive recovery and retry using the
* 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
- * pg_xlog, however (!fetch_ckpt). We could recover using the WAL
- * from the archive, even if pg_xlog is completely empty, but we'd
+ * pg_wal, however (!fetch_ckpt). We could recover using the WAL
+ * 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.
* So err on the safe side and give up.
*/
@@ -4039,7 +4039,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode,
!fetching_ckpt)
{
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;
if (StandbyModeRequested)
StandbyMode = true;
@@ -4156,7 +4156,7 @@ rescanLatestTimeLine(void)
/*
* 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);
@@ -5189,7 +5189,7 @@ readRecoveryCommandFile(void)
ereport(WARNING,
(errmsg("recovery command file \"%s\" specified neither primary_conninfo nor restore_command",
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
{
@@ -6056,7 +6056,7 @@ StartupXLOG(void)
#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
* excluded and need to be re-created.
*/
@@ -6269,7 +6269,7 @@ StartupXLOG(void)
* and put it into archive recovery by creating a recovery.conf file.
*
* 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.
*
* But usually we already know how far we need to replay the WAL (up
@@ -6473,7 +6473,7 @@ StartupXLOG(void)
/*
* 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
* covers all the previous timelines in the history too - a cascading
* standby server might be interested in them. Or, if you archive the WAL
@@ -7094,7 +7094,7 @@ StartupXLOG(void)
/*
* 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, e.g., timeline history file) from archive or pg_xlog.
+ * recovery, e.g., timeline history file) from archive or pg_wal.
*/
StandbyMode = false;
@@ -7382,7 +7382,7 @@ StartupXLOG(void)
* As a compromise, we rename the last segment with the .partial
* suffix, and archive it. Archive recovery will never try to read
* .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,
* too.
*
@@ -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
* 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
- * 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.
*
* 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)
* archived before returning. If archiving isn't enabled, the required WAL
* needs to be transported via streaming replication (hopefully with
* 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
* gets all the required WAL.
*
@@ -11195,9 +11195,9 @@ next_record_is_invalid:
* Open the WAL segment containing WAL position 'RecPtr'.
*
* 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
- * pg_xlog 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
+ * streamed the record, or it can already be present in pg_wal. Checking
+ * 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_wal. That is not
* documented or recommended, though.
*
* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should
@@ -11227,8 +11227,8 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*-------
* Standby mode is implemented by a state machine:
*
- * 1. Read from either archive or pg_xlog (XLOG_FROM_ARCHIVE), or just
- * pg_xlog (XLOG_FROM_XLOG)
+ * 1. Read from either archive or pg_wal (XLOG_FROM_ARCHIVE), or just
+ * pg_wal (XLOG_FROM_PG_WAL)
* 2. Check trigger file
* 3. Read from primary server via walreceiver (XLOG_FROM_STREAM)
* 4. Rescan timelines
@@ -11244,7 +11244,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*-------
*/
if (!InArchiveRecovery)
- currentSource = XLOG_FROM_PG_XLOG;
+ currentSource = XLOG_FROM_PG_WAL;
else if (currentSource == 0)
currentSource = XLOG_FROM_ARCHIVE;
@@ -11263,13 +11263,13 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
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
* do this only after failure, so when you create the
* 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())
{
@@ -11279,7 +11279,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Not in standby mode, and we've now tried the archive
- * and pg_xlog.
+ * and pg_wal.
*/
if (!StandbyMode)
return false;
@@ -11339,7 +11339,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* little chance that the problem will just go away, but
* PANIC is not good for availability either, especially
* 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
* streamed, so it's unlikely that it helps, but one can
* hope...
@@ -11400,11 +11400,11 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
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
- * the archive over ones in pg_xlog, so try the next file again
+ * We just successfully read a file in pg_wal. We prefer files in
+ * the archive over ones in pg_wal, so try the next file again
* from the archive first.
*/
if (InArchiveRecovery)
@@ -11425,7 +11425,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
switch (currentSource)
{
case XLOG_FROM_ARCHIVE:
- case XLOG_FROM_PG_XLOG:
+ case XLOG_FROM_PG_WAL:
/* Close any old file we might have open. */
if (readFile >= 0)
{
@@ -11438,7 +11438,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Try to restore the file from archive, or read an existing
- * file from pg_xlog.
+ * file from pg_wal.
*/
readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2,
currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY :
@@ -11447,7 +11447,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
return true; /* success! */
/*
- * Nope, not found in archive or pg_xlog.
+ * Nope, not found in archive or pg_wal.
*/
lastSourceFailed = true;
break;
@@ -11503,7 +11503,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* not open already. Also read the timeline history
* file if we haven't initialized timeline history
* 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
* isn't changed.
*/
@@ -11535,10 +11535,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
/*
* Note that we don't "return false" immediately here.
* 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
* 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.
*/
lastSourceFailed = true;
@@ -11578,7 +11578,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
* 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
* 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,
* and we should never hit the end of WAL because we stop and wait for more WAL
* to arrive before replaying it.
@@ -11593,7 +11593,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
{
static XLogRecPtr lastComplaint = 0;
- if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
+ if (readSource == XLOG_FROM_PG_WAL && emode == LOG)
{
if (RecPtr == lastComplaint)
emode = DEBUG1;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d153a44..b919164 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -421,7 +421,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
/*
* 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
- * 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
KeepFileRestoredFromArchive(char *path, char *xlogfname)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 33383b4..01cbd90 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -128,7 +128,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
* pg_stop_backup: finish taking an on-line backup dump
*
* 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
* 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
diff --git a/src/backend/replication/README b/src/backend/replication/README
index ad4864d..0cbb990 100644
--- a/src/backend/replication/README
+++ b/src/backend/replication/README
@@ -54,7 +54,7 @@ and WalRcvData->slotname, and initializes the starting point in
WalRcvData->receiveStart.
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.
Walreceiver sends information about replication progress to the master server
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index fa75930..ffc7e58 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -346,7 +346,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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',
* regardless of the timeline the file is stamped with. If there are
* some spurious WAL files belonging to timelines that don't belong in
@@ -359,11 +359,11 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
XLByteToPrevSeg(endptr, endsegno);
XLogFileName(lastoff, ThisTimeLineID, endsegno);
- dir = AllocateDir("pg_xlog");
+ dir = AllocateDir("pg_wal");
if (!dir)
ereport(ERROR,
- (errmsg("could not open directory \"%s\": %m", "pg_xlog")));
- while ((de = ReadDir(dir, "pg_xlog")) != NULL)
+ (errmsg("could not open directory \"%s\": %m", "pg_wal")));
+ while ((de = ReadDir(dir, "pg_wal")) != NULL)
{
/* Does it look like a WAL segment, and is it in the range? */
if (IsXLogFileName(de->d_name) &&
@@ -401,7 +401,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
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.
*/
if (nWalFiles < 1)
@@ -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
* 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);
/*
* Also send archive_status directory (by hackishly reusing
* statbuf from above ...).
*/
- size += _tarWriteHeader("./pg_xlog/archive_status", NULL, &statbuf,
+ size += _tarWriteHeader("./pg_wal/archive_status", NULL, &statbuf,
sizeonly);
- continue; /* don't recurse into pg_xlog */
+ continue; /* don't recurse into pg_wal */
}
/* Allow symbolic links in pg_tblspc only */
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index eed6eff..2bb3dce 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -18,7 +18,7 @@
* If the primary server ends streaming, but doesn't disconnect, walreceiver
* goes into "waiting" mode, and waits for the startup process to give new
* 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
* nudge the existing walreceiver process that's waiting, instead of launching
* a new one.
@@ -365,7 +365,7 @@ WalReceiverMain(void)
* we've already reached the end of the old timeline, the server will
* finish the streaming immediately, and we will go back to await
* 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
* on the new timeline.
*/
@@ -742,7 +742,7 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
tli)));
/*
- * Write the file to pg_xlog.
+ * Write the file to pg_wal.
*/
writeTimeLineHistoryFile(tli, content, len);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 0f3ced2..bc5e508 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -586,7 +586,7 @@ StartReplication(StartReplicationCmd *cmd)
* 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
* 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
* that's older than the switchpoint, if it's still in the same
@@ -2058,7 +2058,7 @@ retry:
*
* For example, imagine that this server is currently on timeline
* 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
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03143f1..b7ff5ef 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2787,7 +2787,7 @@ looks_like_temp_rel_name(const char *name)
* Issue fsync recursively on PGDATA and all its contents.
*
* 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
* for fsyncing, and might not have privileges to write at all.
*
@@ -2811,7 +2811,7 @@ SyncDataDirectory(void)
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.
*/
xlog_is_symlink = false;
@@ -2820,16 +2820,16 @@ SyncDataDirectory(void)
{
struct stat st;
- if (lstat("pg_xlog", &st) < 0)
+ if (lstat("pg_wal", &st) < 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m",
- "pg_xlog")));
+ "pg_wal")));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction("pg_xlog"))
+ if (pgwin32_is_junction("pg_wal"))
xlog_is_symlink = true;
#endif
@@ -2841,7 +2841,7 @@ SyncDataDirectory(void)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(".", pre_sync_fname, false, DEBUG1);
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);
#endif
@@ -2849,14 +2849,14 @@ SyncDataDirectory(void)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(".", datadir_fsync_fname, false, LOG);
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);
}
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e52e67d..385e808 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -195,7 +195,7 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
- "pg_xlog/archive_status",
+ "pg_wal/archive_status",
"pg_clog",
"pg_commit_ts",
"pg_dynshmem",
@@ -2091,8 +2091,6 @@ make_postgres(FILE *cmdfd)
PG_CMD_PUTS(*line);
}
-
-
/*
* signal handler in case we are interrupted.
*
@@ -2830,7 +2828,7 @@ create_xlog_or_symlink(void)
char *subdirloc;
/* 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)
{
@@ -2963,7 +2961,7 @@ initialize_data_directory(void)
create_xlog_or_symlink();
- /* Create required subdirectories (other than pg_xlog) */
+ /* Create required subdirectories (other than pg_wal) */
printf(_("creating subdirectories ... "));
fflush(stdout);
@@ -3258,7 +3256,7 @@ main(int argc, char *argv[])
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- fsync_pgdata(pg_data, progname);
+ fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok();
return 0;
}
@@ -3324,7 +3322,7 @@ main(int argc, char *argv[])
{
fputs(_("syncing data to disk ... "), stdout);
fflush(stdout);
- fsync_pgdata(pg_data, progname);
+ fsync_pgdata(pg_data, progname, PG_VERSION_NUM);
check_ok();
}
else
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 0f5d9d6..6b2a01f 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -55,6 +55,12 @@ typedef struct TablespaceList
TablespaceListCell *tail;
} 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 */
static char *basedir = NULL;
static TablespaceList tablespace_dirs = {NULL, NULL};
@@ -526,15 +532,22 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
/* Error message already written in GetConnection() */
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
- * basedir/pg_xlog as the directory entry in the tar file may arrive
- * later.
+ * Create pg_wal/archive_status or pg_xlog/archive_status (and thus
+ * pg_wal or pg_xlog) depending on the target server so we can write to
+ * 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",
- basedir);
+ snprintf(statusdir, sizeof(statusdir), "%s/%s/archive_status",
+ basedir,
+ PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ?
+ "pg_xlog" : "pg_wal");
if (pg_mkdir_p(statusdir, S_IRWXU) != 0 && errno != EEXIST)
{
@@ -1338,15 +1351,17 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
if (mkdir(filename, S_IRWXU) != 0)
{
/*
- * When streaming WAL, pg_xlog will have been created
- * by the wal receiver process. Also, when transaction
- * log directory location was specified, pg_xlog has
- * already been created as a symbolic link before
- * starting the actual backup. So just ignore creation
- * failures on related directories.
+ * When streaming WAL, pg_wal (or pg_xlog for pre-9.6
+ * clusters) will have been created by the wal receiver
+ * process. Also, when transaction log directory location
+ * was specified, pg_wal (or pg_xlog) has already been
+ * created as a symbolic link before starting the actual
+ * backup. So just ignore creation failures on related
+ * directories.
*/
- if (!((pg_str_endswith(filename, "/pg_xlog") ||
- pg_str_endswith(filename, "/archive_status")) &&
+ if (!((pg_str_endswith(filename, "/pg_wal") ||
+ pg_str_endswith(filename, "/pg_xlog")||
+ pg_str_endswith(filename, "/archive_status")) &&
errno == EEXIST))
{
fprintf(stderr,
@@ -1634,15 +1649,10 @@ BaseBackup(void)
char xlogend[64];
int minServerMajor,
maxServerMajor;
- int serverMajor;
+ int serverVersion,
+ serverMajor;
- /*
- * Connect in replication mode to the server
- */
- conn = GetConnection();
- if (!conn)
- /* Error message already written in GetConnection() */
- exit(1);
+ Assert(conn != NULL);
/*
* Check server version. BASE_BACKUP command was introduced in 9.1, so we
@@ -1650,7 +1660,8 @@ BaseBackup(void)
*/
minServerMajor = 901;
maxServerMajor = PG_VERSION_NUM / 100;
- serverMajor = PQserverVersion(conn) / 100;
+ serverVersion = PQserverVersion(conn);
+ serverMajor = serverVersion / 100;
if (serverMajor < minServerMajor || serverMajor > maxServerMajor)
{
const char *serverver = PQparameterStatus(conn, "server_version");
@@ -1979,7 +1990,7 @@ BaseBackup(void)
}
else
{
- (void) fsync_pgdata(basedir, progname);
+ (void) fsync_pgdata(basedir, progname, serverVersion);
}
}
@@ -2296,6 +2307,14 @@ main(int argc, char **argv)
if (format == 'p' || strcmp(basedir, "-") != 0)
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 */
if (strcmp(xlog_dir, "") != 0)
{
@@ -2303,19 +2322,24 @@ main(int argc, char **argv)
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
if (symlink(xlog_dir, linkloc) != 0)
{
fprintf(stderr, _("%s: could not create symbolic link \"%s\": %s\n"),
progname, linkloc, strerror(errno));
- exit(1);
+ disconnect_and_exit(1);
}
#else
fprintf(stderr, _("%s: symlinks are not supported on this platform\n"));
- exit(1);
+ disconnect_and_exit(1);
#endif
free(linkloc);
}
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index a52bd4e..c8abbeb 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -67,9 +67,9 @@ $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ],
'pg_basebackup runs');
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(
- [ sort(slurp_dir("$tempdir/backup/pg_xlog/")) ],
+ [ sort(slurp_dir("$tempdir/backup/pg_wal/")) ],
[ sort qw(. .. archive_status) ],
'no WAL files copied');
@@ -230,12 +230,12 @@ like(
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxf", '-X', 'fetch' ],
'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');
$node->command_ok(
[ 'pg_basebackup', '-D', "$tempdir/backupxs", '-X', 'stream' ],
'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');
$node->command_fails(
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 525b82ba..2b76f64 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -890,7 +890,7 @@ FindEndOfXLOG(void)
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
* conservative, because of xlog.c's attempts to pre-create files.
*/
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 327e7ef..d0c1586 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -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,
* 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) ||
- strcmp(path, "pg_xlog") == 0)
+ strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
#else
pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n",
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 9b00dc1..3905a5d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -79,11 +79,11 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
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
* 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;
/*
@@ -120,7 +120,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
switch (type)
{
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.. */
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,
/*
* 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;
key.path = (char *) path;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index b53591d..23ac4e7 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -54,7 +54,7 @@ static int SimpleXLogPageRead(XLogReaderState *xlogreader,
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
* the data blocks touched by the WAL records, and return them in a page map.
*/
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index bdcab56..12950ea 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -1,5 +1,5 @@
#
-# 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 warnings;
@@ -30,10 +30,10 @@ sub run_test
my $test_master_datadir = $node_master->data_dir;
- # turn pg_xlog into a symlink
- print("moving $test_master_datadir/pg_xlog to $master_xlogdir\n");
- move("$test_master_datadir/pg_xlog", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_xlog") or die;
+ # turn pg_wal into a symlink
+ print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
+ move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
+ symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
RewindTest::start_master();
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 6d04e56..55a6f0d 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
#include <fcntl.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 validate_exec(const char *dir, const char *cmdName);
@@ -220,9 +220,9 @@ verify_directories(void)
pg_fatal("You must have read and write access in the current directory.\n");
check_bin_dir(&old_cluster);
- check_data_dir(old_cluster.pgdata);
+ check_data_dir(&old_cluster);
check_bin_dir(&new_cluster);
- check_data_dir(new_cluster.pgdata);
+ check_data_dir(&new_cluster);
}
@@ -253,6 +253,32 @@ win32_check_directory_write_permissions(void)
/*
+ * 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()
*
* This function validates the given cluster directory - we search for a
@@ -262,34 +288,27 @@ win32_check_directory_write_permissions(void)
*
*/
static void
-check_data_dir(const char *pg_data)
+check_data_dir(ClusterInfo *cluster)
{
- char subDirName[MAXPGPATH];
- int subdirnum;
-
- /* start check with top-most directory */
- const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
- "pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
- "pg_xlog"};
-
- for (subdirnum = 0;
- subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
- ++subdirnum)
- {
- struct stat statBuf;
-
- snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
- /* Win32 can't stat() a directory with a trailing slash. */
- *requiredSubdirs[subdirnum] ? "/" : "",
- requiredSubdirs[subdirnum]);
-
- 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);
- }
+ const char *pg_data = cluster->pgdata;
+
+ /* get old and new cluster versions */
+ old_cluster.major_version = get_major_server_version(&old_cluster);
+ new_cluster.major_version = get_major_server_version(&new_cluster);
+
+ check_single_dir(pg_data, "");
+ check_single_dir(pg_data, "base");
+ check_single_dir(pg_data, "global");
+ check_single_dir(pg_data, "pg_multixact");
+ check_single_dir(pg_data, "pg_subtrans");
+ check_single_dir(pg_data, "pg_tblspc");
+ check_single_dir(pg_data, "pg_twophase");
+
+ /* pg_xlog has been renamed to pg_wal in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_xlog");
+ else
+ check_single_dir(pg_data, "pg_wal");
}
diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
index 9ad9321..7490398 100644
--- a/src/bin/pg_xlogdump/pg_xlogdump.c
+++ b/src/bin/pg_xlogdump/pg_xlogdump.c
@@ -680,7 +680,7 @@ usage(void)
printf(" -f, --follow keep retrying after reaching end of WAL\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(" (default: ./pg_xlog)\n");
+ printf(" (default: ./pg_wal)\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(" -s, --start=RECPTR start reading at log position RECPTR\n");
diff --git a/src/common/file_utils.c b/src/common/file_utils.c
index 1855e23..2fdb469 100644
--- a/src/common/file_utils.c
+++ b/src/common/file_utils.c
@@ -29,6 +29,11 @@
#define PG_FLUSH_DATA_WORKS 1
#endif
+/*
+ * pg_xlog has been renamed to pg_wal in version 10.
+ */
+#define MINIMUM_VERSION_FOR_PG_WAL 100000
+
#ifdef PG_FLUSH_DATA_WORKS
static int pre_sync_fname(const char *fname, bool isdir,
const char *progname);
@@ -40,25 +45,31 @@ static void walkdir(const char *path,
/*
* Issue fsync recursively on PGDATA and all its contents.
*
- * We fsync regular files and directories wherever they are, but we
- * follow symlinks only for pg_xlog and immediately under pg_tblspc.
- * Other symlinks are presumed to point at files we're not responsible
- * for fsyncing, and might not have privileges to write at all.
+ * We fsync regular files and directories wherever they are, but we follow
+ * 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 for
+ * 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.
*/
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;
- char pg_xlog[MAXPGPATH];
+ char pg_wal[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);
/*
- * 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.
*/
xlog_is_symlink = false;
@@ -67,14 +78,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
{
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"),
- progname, pg_xlog, strerror(errno));
+ progname, pg_wal, strerror(errno));
else if (S_ISLNK(st.st_mode))
xlog_is_symlink = true;
}
#else
- if (pgwin32_is_junction(pg_xlog))
+ if (pgwin32_is_junction(pg_wal))
xlog_is_symlink = true;
#endif
@@ -85,7 +96,7 @@ fsync_pgdata(const char *pg_data, const char *progname)
#ifdef PG_FLUSH_DATA_WORKS
walkdir(pg_data, pre_sync_fname, false, progname);
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);
#endif
@@ -93,14 +104,14 @@ fsync_pgdata(const char *pg_data, const char *progname)
* Now we do the fsync()s in the same order.
*
* 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
* in pg_tblspc, they'll get fsync'd twice. That's not an expected case
* so we don't worry about optimizing it.
*/
walkdir(pg_data, fsync_fname, false, progname);
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);
}
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index 0a595cc..ceb0462 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -128,7 +128,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
/*
* The XLog directory and control file (relative to $PGDATA)
*/
-#define XLOGDIR "pg_xlog"
+#define XLOGDIR "pg_wal"
#define XLOG_CONTROL_FILE "global/pg_control"
/*
diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h
index 1cb263d..b83c398 100644
--- a/src/include/common/file_utils.h
+++ b/src/include/common/file_utils.h
@@ -17,7 +17,8 @@
extern int fsync_fname(const char *fname, bool isdir,
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,
const char *progname);
extern int fsync_parent_path(const char *fname, const char *progname);
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index f2cbfb3..6df73c9 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -16,7 +16,7 @@
/* ----------
* 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
* appearing in VALID_XFN_CHARS. The status files in archive_status have
* corresponding names with ".ready" or ".done" appended.
--
2.10.1
0002-Rename-pg_clog-to-pg_xact.patchtext/plain; charset=US-ASCII; name=0002-Rename-pg_clog-to-pg_xact.patchDownload
From c5188910213699db4dcf201b2f854e825703f222 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 4 Oct 2016 14:41:15 +0900
Subject: [PATCH 2/2] Rename pg_clog to pg_xact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 ++--
doc/src/sgml/catalogs.sgml | 4 ++--
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++++----
doc/src/sgml/ref/pg_resetxlog.sgml | 4 ++--
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 +++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/README | 10 +++++-----
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 5 ++---
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 ++--
src/backend/access/transam/xact.c | 16 ++++++++--------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 +++++-----
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 ++--
src/backend/utils/time/tqual.c | 6 +++---
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++++------------
src/include/access/slru.h | 4 ++--
28 files changed, 82 insertions(+), 71 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..d22af0d 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_xact/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_xact</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 29738b0..839b52a 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,7 +2514,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 1bb501c..3e6296e 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5822,7 +5822,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_xact</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2e64cc4..e9cfb06 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15323,7 +15323,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_xact | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e0..65a64c8 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_xact</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_xact</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_xact</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_xact</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..6ebc68b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_xact</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_xact</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..d5430d4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_xact</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..56aef3c 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -146,6 +141,11 @@ Item
</row>
<row>
+ <entry><filename>pg_xact</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>postgresql.auto.conf</></entry>
<entry>A file used for storing configuration parameters that are set by
<command>ALTER SYSTEM</command></entry>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa76..1f9fac9 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b019bc1..560a8da 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,8 +6762,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_xact before we finish
+ * the VACUUM and perhaps truncate off the part of pg_xact he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..e7dd19f 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
+pg_xact and pg_subtrans
-----------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_xact records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_xact are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..08e1edd 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_xact", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index a8d275f..0d03700 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_xact-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..287e435 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_xact-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..6871239 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,15 +3,14 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
* The tree can easily be walked from child to parent, but not in the
* opposite direction.
*
- * This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_xact, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..0a103c3 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_xact but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604..8bed3f5 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_xact, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_xact */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..6d6b3e4 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,8 +1206,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_xact. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_xact update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2033,7 +2033,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_xact. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_xact. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_xact.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,7 +5389,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_xact. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5526,7 +5526,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5542,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 4fda179..c754a91 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8488,7 +8488,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_xact. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..d673031 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,7 +356,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_xact and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_xact and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_xact).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,7 +1086,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_xact is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index e3a6911..29a555e 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2395,7 +2395,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible. We
* only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..bc80777 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_xact), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..d41a79f 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_xact.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..41e89e1 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_xact). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_xact before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_xact until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 385e808..72a60ee 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_xact",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 55a6f0d..b242e30 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_xact");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 90c0720..9c475df 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_xact_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_xact_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_xact_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_xact in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..96a1e44 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_xact and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.10.1
0002-Rename-pg_clog-to-pg_transaction.patchtext/plain; charset=US-ASCII; name=0002-Rename-pg_clog-to-pg_transaction.patchDownload
From 0d30ef662a52b6b02496a6618c0457d6d6773992 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 4 Oct 2016 14:41:15 +0900
Subject: [PATCH 2/2] Rename pg_clog to pg_transaction
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 6 +++---
doc/src/sgml/catalogs.sgml | 6 +++---
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 12 +++++------
doc/src/sgml/ref/pg_resetxlog.sgml | 6 +++---
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 ++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 10 ++++-----
src/backend/access/transam/README | 22 ++++++++++----------
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 4 ++--
src/backend/access/transam/multixact.c | 8 +++----
src/backend/access/transam/subtrans.c | 18 ++++++++--------
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/xact.c | 38 ++++++++++++++++++++--------------
src/backend/access/transam/xlog.c | 6 +++---
src/backend/commands/vacuum.c | 14 ++++++-------
src/backend/postmaster/autovacuum.c | 4 ++--
src/backend/storage/buffer/README | 4 ++--
src/backend/storage/ipc/procarray.c | 5 +++--
src/backend/utils/time/tqual.c | 29 +++++++++++++-------------
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++-----------
src/include/access/slru.h | 12 +++++------
28 files changed, 145 insertions(+), 125 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..eb4f962 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
- all transactions. A table file is only usable with this
+ <filename>pg_transaction/*</filename>, which contain the commit status
+ of all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_transaction</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 29738b0..77b395e 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_transaction</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,8 +2514,8 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
- It is the minimum of the per-table
+ transaction ID wraparound or to allow <literal>pg_transaction</> to be
+ shrunk. It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
</row>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 1bb501c..b0b7215 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5822,7 +5822,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_transaction</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2e64cc4..a9d2ec4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15323,7 +15323,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_transaction | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e0..c741a9b 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
- will take more space, because it must store the commit status of all
- transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
+ is that the <filename>pg_transaction</> subdirectory of the database
+ cluster will take more space, because it must store the commit status of
+ all transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_transaction</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_transaction</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_transaction</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..67b048b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
- adding one,
+ file name in the directory <filename>pg_transaction</> under the data
+ directory, adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_transaction</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..34ef4f1 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_transaction</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..61d15d4 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -136,6 +131,11 @@ Item
</row>
<row>
+ <entry><filename>pg_transaction</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>pg_twophase</></entry>
<entry>Subdirectory containing state files for prepared transactions</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa76..aac0a8d 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_transaction</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b019bc1..075d06a 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,11 +6762,11 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
- * exclusive lock ensures no other backend is in process of checking the
- * tuple status. Also, getting exclusive lock makes it safe to adjust the
- * infomask bits.
+ * conceivably not finish checking the XID against pg_transaction before we
+ * finish the VACUUM and perhaps truncate off the part of pg_transaction he
+ * needs. Getting exclusive lock ensures no other backend is in process of
+ * checking the tuple status. Also, getting exclusive lock makes it safe to
+ * adjust the infomask bits.
*
* NB: All code in here must be safe to execute during crash recovery!
*/
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..36bcde9 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,18 +331,18 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
------------------------
+pg_transaction and pg_subtrans
+------------------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
-information. There is a limited number of pages of each kept in memory, so
-in many cases there is no need to actually read from disk. However, if
-there's a long running transaction or a backend sitting idle with an open
+pg_transaction and pg_subtrans are permanent (on-disk) storage of transaction
+related information. There is a limited number of pages of each kept in
+memory, so in many cases there is no need to actually read from disk. However,
+if there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
-an XID. A transaction can be in progress, committed, aborted, or
+pg_transaction records the commit status for each transaction that has been
+assigned an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
necessary to update a subtransaction's transaction status to subcommit, so we
@@ -381,10 +381,10 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_transaction and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+for pg_transaction are implemented in transam.c, while the low-level functions
+are in clog.c. pg_subtrans is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..c7a3cbb 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_transaction", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index a8d275f..4a48f76 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,8 +3,8 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
- * for each transaction.
+ * This module is a pg_transaction-like system that stores the commit
+ * timestamp for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
* CommitTs page is initialized to zeroes. Also, one XLOG record is
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..aa8e07e 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,10 +3,10 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
- * MultiXactMember for each MultiXactId. It is a fundamental part of the
- * shared-row-lock implementation. Each MultiXactMember is comprised of a
- * TransactionId and a set of flag bits. The name is a bit historical:
+ * The pg_multixact manager is a pg_transaction-like manager that stores an
+ * array of MultiXactMember for each MultiXactId. It is a fundamental part
+ * of the shared-row-lock implementation. Each MultiXactMember is comprised
+ * of a TransactionId and a set of flag bits. The name is a bit historical:
* originally, a MultiXactId consisted of more than one TransactionId (except
* in rare corner cases), hence "multi". Nowadays, however, it's perfectly
* legitimate to have MultiXactIds that only include a single Xid.
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..d96a487 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,17 +3,17 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
- * transaction Id for each transaction. It is a fundamental part of the
- * nested transactions implementation. A main transaction has a parent
- * of InvalidTransactionId, and each subtransaction has its immediate parent.
- * The tree can easily be walked from child to parent, but not in the
- * opposite direction.
+ * The pg_subtrans manager is a pg_transaction-like manager that stores
+ * the parent transaction Id for each transaction. It is a fundamental
+ * part of the nested transactions implementation. A main transaction has
+ * a parent of InvalidTransactionId, and each subtransaction has its
+ * immediate parent. The tree can easily be walked from child to parent,
+ * but not in the opposite direction.
*
* This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
- * no need to preserve data over a crash and restart.
+ * are completely different from pg_transaction, because we only need to
+ * remember pg_subtrans information for currently-open transactions. Thus,
+ * there is no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
* data across crashes. During database startup, we simply force the
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..8a41c7f 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_transaction but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604..52de336 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,8 +1379,8 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
- * TransactionIdIsInProgress will stop saying the prepared xact is in
+ * pg_transaction, then remove its PGPROC from the global ProcArray (which
+ * means TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
*/
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_transaction */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..817b323 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,10 +1206,10 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
- * disk, leading to loss of the transaction commit if the system
- * crashes a little later.
+ * pg_transaction. Without this, it is possible for the checkpoint
+ * to set REDO after the XLOG record but fail to flush the pg_trans
+ * update to disk, leading to loss of the transaction commit if the
+ * system crashes a little later.
*
* Note: we could, but don't bother to, set this flag in
* RecordTransactionAbort. That's because loss of a transaction abort
@@ -2033,8 +2033,8 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
- * durably commit.
+ * We need to mark our XIDs as committed in pg_transaction. This is
+ * where we durably commit.
*/
latestXid = RecordTransactionCommit();
}
@@ -2539,10 +2539,10 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
- * far as assigning an XID to advertise). But if we're inside a parallel
- * worker, skip this; the user backend must be the one to write the abort
- * record.
+ * Advertise the fact that we aborted in pg_transaction (assuming that we
+ * got as far as assigning an XID to advertise). But if we're inside a
+ * parallel worker, skip this; the user backend must be the one to write
+ * the abort record.
*/
if (!is_parallel_worker)
latestXid = RecordTransactionAbort(false);
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_transaction. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_transaction.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,8 +5389,8 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
- * protocol during recovery to provide information on database
+ * Mark the transaction committed in pg_transaction. We use async
+ * commit protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
* this commit record. This ensures that if we crash we don't see hint
@@ -5526,7 +5526,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5545,10 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /*
+ * Mark the transaction aborted in pg_transaction, no need for async
+ * stuff.
+ */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 48c18e8..2262ae0 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8487,9 +8487,9 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
- * we wait till he's out of his commit critical section before proceeding.
- * See notes in RecordTransactionCommit().
+ * that our flushing had better include the xact's update of
+ * pg_transaction. So we wait till he's out of his commit critical
+ * section before proceeding. See notes in RecordTransactionCommit().
*
* Because we've already released the insertion locks, this test is a bit
* fuzzy: it is possible that we will wait for xacts we didn't really need
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..5c61d1a 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,8 +356,8 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
- * (autovacuum.c does this for itself.)
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
}
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_transaction and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_transaction and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_transaction).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,8 +1086,8 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
- * as it could be.
+ * worst possible outcome is that pg_transaction is not truncated as
+ * aggressively as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 1a92ca1..31fcd51 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2394,8 +2394,8 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
- * only need to do this once, not after each table.
+ * Update pg_database.datfrozenxid, and truncate pg_transaction if
+ * possible. We only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..94da258 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,8 +63,8 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
-great harm is done if they get reset to zero by conflicting updates.
+(they cache the results of transaction status lookups in pg_transaction),
+so no great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
an exclusive buffer lock (and it must also be WAL-logged).
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..dd5c79a 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_transaction.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,8 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_transaction to see if it's been
+ * aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..fbf9c6c 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,23 +13,24 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
- * just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
- * MyPgXact->xid in the PGXACT array. That fixes that problem, but it
- * also means there is a window where TransactionIdIsInProgress and
- * TransactionIdDidCommit will both return true. If we check only
- * TransactionIdDidCommit, we could consider a tuple committed when a
- * later GetSnapshotData call will still think the originating transaction
- * is in progress, which leads to application-level inconsistency. The
- * upshot is that we gotta check TransactionIdIsInProgress first in all
- * code paths, except for a few cases where we are looking at
- * subtransactions of our own main transaction and so there can't be any
- * race condition.
+ * pg_transaction). Otherwise we have a race condition: we might decide
+ * that a just-committed transaction crashed, because none of the tests
+ * succeed. xact.c is careful to record commit/abort in pg_transaction
+ * before it unsets MyPgXact->xid in the PGXACT array. That fixes that
+ * problem, but it also means there is a window where
+ * TransactionIdIsInProgress and TransactionIdDidCommit will both return
+ * true. If we check only TransactionIdDidCommit, we could consider a
+ * tuple committed when a later GetSnapshotData call will still think
+ * the originating transaction is in progress, which leads to
+ * application-level inconsistency. The upshot is that we gotta check
+ * TransactionIdIsInProgress first in all code paths, except for a few
+ * cases where we are looking at subtransactions of our own main
+ * transaction and so there can't be any race condition.
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_transaction until after deciding that the xact is no longer
+ * in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 385e808..974f11a 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_transaction",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 55a6f0d..a3a0a0f 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_transaction in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_transaction");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 90c0720..04704c2 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_trans_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_trans_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_trans_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_transaction in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_transaction");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..001817f 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,10 +76,10 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
- * has lsn_groups_per_page entries per buffer slot, each containing the
- * highest LSN known for a contiguous group of SLRU entries on that slot's
- * page.
+ * for pg_transaction, false for multixact, pg_subtrans, pg_notify).
+ * group_lsn[] has lsn_groups_per_page entries per buffer slot, each
+ * containing the highest LSN known for a contiguous group of SLRU entries
+ * on that slot's page.
*/
XLogRecPtr *group_lsn;
int lsn_groups_per_page;
@@ -120,8 +120,8 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * This flag tells whether to fsync writes (true for pg_transaction and
+ * multixact stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.10.0
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.
I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote:
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.
I disagree that this will materially help with the issue.
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.
pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.
Thanks!
Stephen
Re: Stephen Frost 2016-10-14 <20161014113523.GZ13284@tamriel.snowman.net>
I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.I disagree that this will materially help with the issue.
And internal/base and internal/global and internal/pg_... because
these shouldn't be touched by the users either.
I don't think this would lead anywhere.
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Christoph Berg (myon@debian.org) wrote:
Re: Stephen Frost 2016-10-14 <20161014113523.GZ13284@tamriel.snowman.net>
I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.I disagree that this will materially help with the issue.
And internal/base and internal/global and internal/pg_... because
these shouldn't be touched by the users either.I don't think this would lead anywhere.
It'd probably be easier to move the things that are *not* PG internal
(eg: config files, et al) *out* of the data directory and into somewhere
sensible, like /etc ...
Oh, wait ...
Thanks!
Stephen
On 10/14/16 9:06 AM, Stephen Frost wrote:
And internal/base and internal/global and internal/pg_... because
these shouldn't be touched by the users either.I don't think this would lead anywhere.
It'd probably be easier to move the things that are *not* PG internal
(eg: config files, et al) *out* of the data directory and into somewhere
sensible, like /etc ...
I do think it would be an improvement to segregate things users are
expected to touch (*.conf and pg_log are what come to mind) from
everything else, which could easily be done by moving everything else to
an internal/ directory. I agree that's not much of an improvement for
pg_[cx]log, but we could create internal/ as well as rename some things.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Jim Nasby (Jim.Nasby@BlueTreble.com) wrote:
On 10/14/16 9:06 AM, Stephen Frost wrote:
And internal/base and internal/global and internal/pg_... because
these shouldn't be touched by the users either.I don't think this would lead anywhere.
It'd probably be easier to move the things that are *not* PG internal
(eg: config files, et al) *out* of the data directory and into somewhere
sensible, like /etc ...I do think it would be an improvement to segregate things users are
expected to touch (*.conf and pg_log are what come to mind) from
everything else, which could easily be done by moving everything
else to an internal/ directory. I agree that's not much of an
improvement for pg_[cx]log, but we could create internal/ as well as
rename some things.
Apologis, I should have made it clear what I was getting at.
The Debian/Ubuntu packaging already does segregate out the *.conf and
pg_log into other locations based on the FHS. On a Debian-based system,
there really shouldn't be anything that the user is expected to touch
under /var/lib (where the PG data directory lives).
Thanks!
Stephen
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
On 10/14/16 9:06 AM, Stephen Frost wrote:
It'd probably be easier to move the things that are *not* PG internal
(eg: config files, et al) *out* of the data directory and into somewhere
sensible, like /etc ...
I do think it would be an improvement to segregate things users are
expected to touch (*.conf and pg_log are what come to mind) from
everything else, which could easily be done by moving everything else to
an internal/ directory. I agree that's not much of an improvement for
pg_[cx]log, but we could create internal/ as well as rename some things.
I can't get excited about that at all. It will just get in the way of
the actually useful end goal we had for directory restructuring, which
was to separate data to be copied by pg_basebackup from data not to be
copied by it. And in reality, people who don't understand that the
contents of PGDATA should be treated as "hands off unless documented
otherwise" are not going to be any less likely to shoot themselves in
the foot just because there's a directory named "internal" or
"here_be_dragons" or "keep_out_this_means_you" in the way.
I'd also suggest that an extra level of directory search to get at
database data files is not free.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Oct 14, 2016 at 9:56 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
On 10/14/16 9:06 AM, Stephen Frost wrote:
It'd probably be easier to move the things that are *not* PG internal
(eg: config files, et al) *out* of the data directory and into somewhere
sensible, like /etc ...I do think it would be an improvement to segregate things users are
expected to touch (*.conf and pg_log are what come to mind) from
everything else, which could easily be done by moving everything else to
an internal/ directory. I agree that's not much of an improvement for
pg_[cx]log, but we could create internal/ as well as rename some things.I can't get excited about that at all. It will just get in the way of
the actually useful end goal we had for directory restructuring, which
was to separate data to be copied by pg_basebackup from data not to be
copied by it. And in reality, people who don't understand that the
contents of PGDATA should be treated as "hands off unless documented
otherwise" are not going to be any less likely to shoot themselves in
the foot just because there's a directory named "internal" or
"here_be_dragons" or "keep_out_this_means_you" in the way.
+1. I think we should move the don't-include-in-backup files to a separate
directory for *technical* reasons.
I don't think moving files that are already supposed to be internal into a
directory called internal is going to help much, an din particular not for
xlog. If we don't rename it, the problem will remain.
And for the "don't touch" part, if anything we should move the config files
into a subdirectory of PGDATA and not the other way around.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On Fri, Oct 14, 2016 at 4:35 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote:
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.I disagree that this will materially help with the issue.
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.
Ugh. Changing the names of those options are probably going to break a
*lot* of things, a lot more than changing the names of the directories. Is
it really worth doing that? Especially if we are even more clear that
people should not be touching those directories in the first place.
Those are just the tip of the iceberg. We do use the term xlog in a lot of
places (almost as many as wal, but that's a different problem)
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
14.10.2016, 07:38, Peter Eisentraut kirjoitti:
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.
pg_receivexlog should probably be renamed, seeing how we have
pg_recvlogical perhaps pg_recvwal would work?
The --xlog, -x, --xlog-method and -X flags for pg_basebackup are a bit
confusing as it is. Perhaps they can be kept around as deprecated
aliases for a new --wal stream/fetch switch: I don't think we need new
--wal and --wal-method switches.
pg_resetxlog should probably be called something different than just
plain pg_resetwal to make it obvious that running it will cause data loss.
pg_xlogdump is a developer tool, users shouldn't care; it's hard enough
to use as it is as it doesn't do anything useful when you try to point
it to a recycled wal file.
All in all, I think this is a good opportunity to clarify what the tools
are actually supposed to do and who should be running them. As an
author of a backup tool utilizing some of these tools & options I don't
think renaming commands and/or arguments is a big deal -- we have to
deal with a bunch of changes for every new major version anyway.
/ Oskari
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Re: Stephen Frost 2016-10-14 <20161014113523.GZ13284@tamriel.snowman.net>
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.
There's actually another instance of "rename so people shoot their
feet less often" here: pg_resetxlog, which is a user-facing tool.
Folks on #postgresql have repeatedly been joking that it should rather
be named pg_eatmydata, given the number of "howtos" on the web that
make use of it. Maybe this is the chance to find a less
innocent-sounding name. (Or add a mandatory --rewind-my-data switch.)
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Magnus Hagander (magnus@hagander.net) wrote:
On Fri, Oct 14, 2016 at 4:35 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote:
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.I disagree that this will materially help with the issue.
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.Ugh. Changing the names of those options are probably going to break a
*lot* of things, a lot more than changing the names of the directories. Is
it really worth doing that? Especially if we are even more clear that
people should not be touching those directories in the first place.
I would point out that I said "adding alternative names", not
"change/remove the existing options."
That said, while I like the general idea of "make everything referring
to transaction log/write-ahead xlog/xlog/wal/whatever refer in the same
way", I'm not sure that it's a really pressing issue or that changing
the name of the directory should drive those other changes.
Those are just the tip of the iceberg. We do use the term xlog in a lot of
places (almost as many as wal, but that's a different problem)
True, and yes, we should consider the places that already talk about
"wal", but, overall, I believe we can take this one step at a time and
don't have to do everything all at once simply because we're changing
the directory name. We're not changing what it *is*, after all.
Thanks!
Stephen
* Christoph Berg (myon@debian.org) wrote:
Re: Stephen Frost 2016-10-14 <20161014113523.GZ13284@tamriel.snowman.net>
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.There's actually another instance of "rename so people shoot their
feet less often" here: pg_resetxlog, which is a user-facing tool.
That is *not* a user-facing tool.
Folks on #postgresql have repeatedly been joking that it should rather
be named pg_eatmydata, given the number of "howtos" on the web that
make use of it. Maybe this is the chance to find a less
innocent-sounding name. (Or add a mandatory --rewind-my-data switch.)
Not sure on the best approach here, but I agree that it's a problem that
people think pg_resetxlog is some kind of recovery tool (hint: it's
not).
Thanks!
Stephen
On Fri, Oct 14, 2016 at 11:48 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Magnus Hagander (magnus@hagander.net) wrote:
On Fri, Oct 14, 2016 at 4:35 AM, Stephen Frost <sfrost@snowman.net>
wrote:
* Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote:
On 10/12/16 11:22 AM, Tom Lane wrote:
The main problem we're trying to fix here is people thinking that
something with "log" in the name contains discardable data. Just
relocating the directory without renaming it won't improve that.I think it would help if we moved it to something like
"internal/pg_xlog" and "internal/pg_clog". Keep the name but move it
out of sight.I disagree that this will materially help with the issue.
We have a tool called pg_xlogdump in the standard installation.
initdb
has an option --xlogdir, pg_basebackup has --xlog and others.
Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.Ugh. Changing the names of those options are probably going to break a
*lot* of things, a lot more than changing the names of the directories.Is
it really worth doing that? Especially if we are even more clear that
people should not be touching those directories in the first place.I would point out that I said "adding alternative names", not
"change/remove the existing options."
Oh, I missed that. Thanks for clarifying :)
That said, while I like the general idea of "make everything referring
to transaction log/write-ahead xlog/xlog/wal/whatever refer in the same
way", I'm not sure that it's a really pressing issue or that changing
the name of the directory should drive those other changes.
Agreed.
Those are just the tip of the iceberg. We do use the term xlog in a lot
of
places (almost as many as wal, but that's a different problem)
True, and yes, we should consider the places that already talk about
"wal", but, overall, I believe we can take this one step at a time and
don't have to do everything all at once simply because we're changing
the directory name. We're not changing what it *is*, after all.
Yeah, I think if we aim to fix everything at once, we'll get nothing done.
That old saying of not letting perfection getting in the way of progress
applies.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
On Fri, Oct 14, 2016 at 07:19:02PM +0200, Christoph Berg wrote:
Re: Stephen Frost 2016-10-14 <20161014113523.GZ13284@tamriel.snowman.net>
We have a tool called pg_xlogdump in the standard installation. initdb
has an option --xlogdir, pg_basebackup has --xlog and others. Renaming
the xlog directory would make this all a bit confusing, unless we're
prepared to rename the programs and options as well.pg_xlogdump is not a user-facing tool, frankly, so I don't believe we
should be terribly concerned about either leaving it named as-is or
renaming it. I agree that we should consider adding alternative names
to the options for initdb and pg_basebackup.There's actually another instance of "rename so people shoot their
feet less often" here: pg_resetxlog, which is a user-facing tool.
Folks on #postgresql have repeatedly been joking that it should rather
be named pg_eatmydata, given the number of "howtos" on the web that
make use of it. Maybe this is the chance to find a less
innocent-sounding name. (Or add a mandatory --rewind-my-data switch.)
I wonder how many of the uses of pg_resetxlog were caused by mistakenly
removing the pg_xlog directory. My point is renaming pg_xlog might
reduce mistake use of pg_resetxlog.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Re: Bruce Momjian 2016-10-19 <20161018220909.GA11661@momjian.us>
There's actually another instance of "rename so people shoot their
feet less often" here: pg_resetxlog, which is a user-facing tool.
Folks on #postgresql have repeatedly been joking that it should rather
be named pg_eatmydata, given the number of "howtos" on the web that
make use of it. Maybe this is the chance to find a less
innocent-sounding name. (Or add a mandatory --rewind-my-data switch.)I wonder how many of the uses of pg_resetxlog were caused by mistakenly
removing the pg_xlog directory. My point is renaming pg_xlog might
reduce mistake use of pg_resetxlog.
I don't think there's much of a connection. There are people who
clean up disk space by removing everything that sounds like log files.
For those people renaming the directories makes sense so they don't
have that idea.
There are other people who have random database startup problems, ask
google, and end up with applying some pg_resetxlog advice (that
doesn't necessarily fit their problem). For those people renaming
pg_resetxlog to something that sounds more like "it will break your
data, use as last resort only" might make sense. (Though I don't have
a good suggestion, and the cost of renaming utilities is higher than
renaming some internal directory names.)
The question would now be if there's people who used pg_resetxlog
because they thought it freed up disk space, and if renaming either
would have prevented that. I'm less sure about that.
(tl;dr: rename pg_xlog yes, rename pg_resetxlog only if we have a good
alternative.)
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Wed, Oct 19, 2016 at 7:05 AM, Christoph Berg <myon@debian.org> wrote:
(tl;dr: rename pg_xlog yes, rename pg_resetxlog only if we have a good
alternative.)
I'm amused by the idea of a TL;DR in parentheses at the very bottom of
the email, but maybe I'm just easily amused.
One idea would be to rename pg_resetxlog to pg_resetwal. I think
that's actually an improvement. The "x" in "xlog" is not a clear
abbreviation for "write-ahead", especially when we also use "x" in
other contexts to mean "transaction" - think "xid". Given our current
practices, we could justifiably rename pg_clog to pg_xlog -- after
all, that's where we log the status of the xacts. Ugh.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Wed, Oct 12, 2016 at 10:22 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
OK. I can live with that as well. Attached are three patches. The
pg_xlog -> pg_wal move, the pg_clog -> pg_transaction move, and the
pg_clog -> pg_xact move. Only one survivor to be chosen among the last
two ones.
Committed 0001.
To be honest, I don't really like either pg_transaction or pg_xact.
Neither name captures the fact that what we're really tracking here is
the transaction *status*. pg_xact is slightly worse because it's a
poor abbreviation for transaction, but I think the argument against
even pg_transaction is similar to the one Tom previously levied
against pg_logical - viz. "logical what?". The transaction themselves
are not stored in the directory, just the commit status. The fact
that commit status is saved is the source of the "c" in "clog".
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
One idea would be to rename pg_resetxlog to pg_resetwal. I think
that's actually an improvement.
This would fit in as part of a general plan to s/xlog/wal/g throughout
our user-visible names and documentation. Which seems like a good idea
to me; there's no need to expose two different terms for the same thing.
(I don't feel a great need to unify the terminology in the code, though.
Just in stuff users see.)
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Robert Haas (robertmhaas@gmail.com) wrote:
On Wed, Oct 12, 2016 at 10:22 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:OK. I can live with that as well. Attached are three patches. The
pg_xlog -> pg_wal move, the pg_clog -> pg_transaction move, and the
pg_clog -> pg_xact move. Only one survivor to be chosen among the last
two ones.Committed 0001.
Glad to see that happen, finally.
To be honest, I don't really like either pg_transaction or pg_xact.
Neither name captures the fact that what we're really tracking here is
the transaction *status*. pg_xact is slightly worse because it's a
poor abbreviation for transaction, but I think the argument against
even pg_transaction is similar to the one Tom previously levied
against pg_logical - viz. "logical what?". The transaction themselves
are not stored in the directory, just the commit status. The fact
that commit status is saved is the source of the "c" in "clog".
This really needs to move forward also.
When it comes to the name, I tend to think of 'pg_xact' as saying "this
is where we persist info we need to keep about transactions." Today
that's just the commit status info, but I could imagine that there
might, someday, be other things that go in there. "pg_multixact" is
an example of something quite similar but does have more than just one
"thing." Also, using "pg_xact" and then "pg_subxact" and "pg_multixact"
bring them all under one consistent naming scheme.
Thanks!
Stephen
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
Robert Haas <robertmhaas@gmail.com> writes:
One idea would be to rename pg_resetxlog to pg_resetwal. I think
that's actually an improvement.This would fit in as part of a general plan to s/xlog/wal/g throughout
our user-visible names and documentation. Which seems like a good idea
to me; there's no need to expose two different terms for the same thing.(I don't feel a great need to unify the terminology in the code, though.
Just in stuff users see.)
+1 on the general change of xlog -> wal.
That said, I'd also like to see a --force or similar option or mechanism
put in place to reduce the risk of users trashing their system because
they think pg_resetwal is "safe." ("It's just gonna reset things to make
the database start again, should be fine.").
pg_destroydb almost seems like a better choice, though I suppose
'pg_clearwal' would be more acceptable. Doesn't have quite the same
impact though.
Not sure on the best answer here, but it's definitely foot-gun that some
users have ended up using on themselves with depressing regularity.
Thanks!
Stephen
On 10/20/2016 09:12 AM, Stephen Frost wrote:
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
Robert Haas <robertmhaas@gmail.com> writes:
That said, I'd also like to see a --force or similar option or mechanism
put in place to reduce the risk of users trashing their system because
they think pg_resetwal is "safe." ("It's just gonna reset things to make
the database start again, should be fine.").pg_destroydb almost seems like a better choice, though I suppose
'pg_clearwal' would be more acceptable. Doesn't have quite the same
impact though.
pg_dropwal
Users won't *drop* things they shouldn't on purpose (usually) but they
will reset and will clear them. Destroydb isn't anymore accurate because
it doesn't destroy it. Instead it makes it so I can log in again and see
my data.
(Yes we all know the real implications with it but from a DUH user
perspective...)
Sincerely,
JD
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 12:05 PM, Stephen Frost <sfrost@snowman.net> wrote:
To be honest, I don't really like either pg_transaction or pg_xact.
Neither name captures the fact that what we're really tracking here is
the transaction *status*. pg_xact is slightly worse because it's a
poor abbreviation for transaction, but I think the argument against
even pg_transaction is similar to the one Tom previously levied
against pg_logical - viz. "logical what?". The transaction themselves
are not stored in the directory, just the commit status. The fact
that commit status is saved is the source of the "c" in "clog".This really needs to move forward also.
When it comes to the name, I tend to think of 'pg_xact' as saying "this
is where we persist info we need to keep about transactions." Today
that's just the commit status info, but I could imagine that there
might, someday, be other things that go in there. "pg_multixact" is
an example of something quite similar but does have more than just one
"thing." Also, using "pg_xact" and then "pg_subxact" and "pg_multixact"
bring them all under one consistent naming scheme.
I don't dispute the fact that you tend to think of it that way, but I
think it's a real stretch to say that "pg_xact" is a clear name from
the point of view of the uninitiated. Now, maybe the point is to be a
little bit deliberately unclear, but "xact" for "transaction" is not a
lot better than "xlog" for "write-ahead log". It's just arbitrary
abbreviations we made up and you either know what they mean or you
don't. We could call it "pg_xkcd" and we wouldn't be removing much in
the way of clarity.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 12:12 PM, Stephen Frost <sfrost@snowman.net> wrote:
That said, I'd also like to see a --force or similar option or mechanism
put in place to reduce the risk of users trashing their system because
they think pg_resetwal is "safe." ("It's just gonna reset things to make
the database start again, should be fine.").
You know we already have that, right?
pg_destroydb almost seems like a better choice, though I suppose
'pg_clearwal' would be more acceptable. Doesn't have quite the same
impact though.Not sure on the best answer here, but it's definitely foot-gun that some
users have ended up using on themselves with depressing regularity.
Just to provide some perspective from the other side of this, I
handled a severity-1 escalation a few weeks ago where a user basically
called up and explained their situation and I told them based on all
of the facts and circumstances presented that running pg_resetxlog was
going to be the best way forward and they said that was pretty much
what they were expecting to hear, and did so. I think there's far too
much anti-pg_resetxlog bias on this list. The situation where you
need to use it is not common in general, but it's pretty common in
support cases that reach me. I don't think I'd be exaggerating if I
said that 25% of the customer escalations I handle personally require
the use pg_resetxlog. Of course, that's because by the time the
ticket gets to me, it's typically the case that all of the easy, neat
solutions have already been ruled out.
My experience is that users who are faced with this situation
typically understand that they are in a bad situation and when I
explain to them --- in a clear and direct way but without the sort of
hysterical exaggeration sometimes seen on this mailing list --- what
the consequences are, they are not surprised by those consequences and
they are willing to accept them because they know that the
alternatives are worse. For example, consider a customer with a
mostly read-only 20TB database. If that user runs pg_resetxlog, they
can be back up in 5 minutes and it is likely (though of course not
certain) that corruption will be minimal. If they restore from
backup, they will be down for many more hours. After pg_resetxlog,
they can restore from backup on another system or do the
dump-and-restore which I invariably recommend while they are up. For
many customers, this is a good trade-off. The decision, because of
the risks associated with it, is usually passed up from the DBA I'm
working with to some business leader. If that business leader feels
that benefits of being up immediately rather than many hours later are
sufficient to justify the risk of a possibly-corrupted database,
running pg_resetxlog is a perfectly reasonable decision.
I have not yet had one DBA or business leader call back and say "hey,
that thing where we ran pg_resetxlog? you should have discouraged us
more, because that was a disaster". Now maybe those disasters have
happened and I am just not aware of them, but I think we should all
take a deep breath and remind ourselves that the database exists in
service to the business and not the other way around. My job -- when
doing support -- is to tell you what your options are and what
consequences they may have, good and bad -- not to tell you how to run
your company. Telling users that pg_resetxlog will "destroy your
database" is over-the-top hyperbole. It's a sharp tool with risks and
benefits and it deserves to be presented exactly that way.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 12:29:47PM -0400, Robert Haas wrote:
When it comes to the name, I tend to think of 'pg_xact' as saying "this
is where we persist info we need to keep about transactions." Today
that's just the commit status info, but I could imagine that there
might, someday, be other things that go in there. "pg_multixact" is
an example of something quite similar but does have more than just one
"thing." Also, using "pg_xact" and then "pg_subxact" and "pg_multixact"
bring them all under one consistent naming scheme.I don't dispute the fact that you tend to think of it that way, but I
think it's a real stretch to say that "pg_xact" is a clear name from
the point of view of the uninitiated. Now, maybe the point is to be a
little bit deliberately unclear, but "xact" for "transaction" is not a
lot better than "xlog" for "write-ahead log". It's just arbitrary
abbreviations we made up and you either know what they mean or you
don't. We could call it "pg_xkcd" and we wouldn't be removing much in
the way of clarity.
What is your suggestion for a name? If you have none, I suggest we use
"pg_xact".
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 1:39 PM, Bruce Momjian <bruce@momjian.us> wrote:
On Thu, Oct 20, 2016 at 12:29:47PM -0400, Robert Haas wrote:
When it comes to the name, I tend to think of 'pg_xact' as saying "this
is where we persist info we need to keep about transactions." Today
that's just the commit status info, but I could imagine that there
might, someday, be other things that go in there. "pg_multixact" is
an example of something quite similar but does have more than just one
"thing." Also, using "pg_xact" and then "pg_subxact" and "pg_multixact"
bring them all under one consistent naming scheme.I don't dispute the fact that you tend to think of it that way, but I
think it's a real stretch to say that "pg_xact" is a clear name from
the point of view of the uninitiated. Now, maybe the point is to be a
little bit deliberately unclear, but "xact" for "transaction" is not a
lot better than "xlog" for "write-ahead log". It's just arbitrary
abbreviations we made up and you either know what they mean or you
don't. We could call it "pg_xkcd" and we wouldn't be removing much in
the way of clarity.What is your suggestion for a name? If you have none, I suggest we use
"pg_xact".
I'm not sure. pg_transaction_status would be clear, but it's long.
Is pg_xact actually better than pg_clog?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
Is pg_xact actually better than pg_clog?
Yes, because it doesn't contain the three letters "log".
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.
Personally I'd go for "pg_trans", but it's only a weak preference.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 2:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Robert Haas <robertmhaas@gmail.com> writes:
Is pg_xact actually better than pg_clog?
Yes, because it doesn't contain the three letters "log".
I figured somebody was going to say that.
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.Personally I'd go for "pg_trans", but it's only a weak preference.
Heaven forfend we actually use enough characters to make it self-documenting.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
On Thu, Oct 20, 2016 at 2:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.Personally I'd go for "pg_trans", but it's only a weak preference.
Heaven forfend we actually use enough characters to make it self-documenting.
$ ls $PGDATA
PG_VERSION pg_dynshmem/ pg_notify/ pg_stat_tmp/ postgresql.auto.conf
base/ pg_hba.conf pg_replslot/ pg_subtrans/ postgresql.conf
global/ pg_ident.conf pg_serial/ pg_tblspc/ postmaster.opts
pg_clog/ pg_logical/ pg_snapshots/ pg_twophase/ postmaster.pid
pg_commit_ts/ pg_multixact/ pg_stat/ pg_wal/
I don't see one single one of those subdirectory names that I'd call
self-documenting. Are you proposing we rename them all with carpal-
tunnel-syndrome-promoting names?
There's certainly some case to be made for renaming at least one of
"pg_subtrans" and "pg_multixact" so that these three similarly-purposed
subdirectories can all have similar names. But I think on the whole
that's (a) fixing what ain't broken, and (b) making it even more unlikely
that we'll ever get to consensus on changing anything. We've managed to
agree that we need to change the names ending in "log"; let's do that
and be happy that we've removed one foot-gun from the system.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 02:02:27PM -0400, Robert Haas wrote:
On Thu, Oct 20, 2016 at 1:39 PM, Bruce Momjian <bruce@momjian.us> wrote:
On Thu, Oct 20, 2016 at 12:29:47PM -0400, Robert Haas wrote:
When it comes to the name, I tend to think of 'pg_xact' as saying "this
is where we persist info we need to keep about transactions." Today
that's just the commit status info, but I could imagine that there
might, someday, be other things that go in there. "pg_multixact" is
an example of something quite similar but does have more than just one
"thing." Also, using "pg_xact" and then "pg_subxact" and "pg_multixact"
bring them all under one consistent naming scheme.I don't dispute the fact that you tend to think of it that way, but I
think it's a real stretch to say that "pg_xact" is a clear name from
the point of view of the uninitiated. Now, maybe the point is to be a
little bit deliberately unclear, but "xact" for "transaction" is not a
lot better than "xlog" for "write-ahead log". It's just arbitrary
abbreviations we made up and you either know what they mean or you
don't. We could call it "pg_xkcd" and we wouldn't be removing much in
the way of clarity.What is your suggestion for a name? If you have none, I suggest we use
"pg_xact".I'm not sure. pg_transaction_status would be clear, but it's long.
Is pg_xact actually better than pg_clog?
Uh, yeah, no "log". Wasn't that the point?
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 2:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Robert Haas <robertmhaas@gmail.com> writes:
On Thu, Oct 20, 2016 at 2:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.Personally I'd go for "pg_trans", but it's only a weak preference.
Heaven forfend we actually use enough characters to make it self-documenting.
$ ls $PGDATA
PG_VERSION pg_dynshmem/ pg_notify/ pg_stat_tmp/ postgresql.auto.conf
base/ pg_hba.conf pg_replslot/ pg_subtrans/ postgresql.conf
global/ pg_ident.conf pg_serial/ pg_tblspc/ postmaster.opts
pg_clog/ pg_logical/ pg_snapshots/ pg_twophase/ postmaster.pid
pg_commit_ts/ pg_multixact/ pg_stat/ pg_wal/I don't see one single one of those subdirectory names that I'd call
self-documenting. Are you proposing we rename them all with carpal-
tunnel-syndrome-promoting names?
No. Are you proposing that self-documenting names are a bad thing
rather than a good thing?
There's certainly some case to be made for renaming at least one of
"pg_subtrans" and "pg_multixact" so that these three similarly-purposed
subdirectories can all have similar names. But I think on the whole
that's (a) fixing what ain't broken, and (b) making it even more unlikely
that we'll ever get to consensus on changing anything. We've managed to
agree that we need to change the names ending in "log"; let's do that
and be happy that we've removed one foot-gun from the system.
I agree that there is an overwhelming consensus in favor of getting
"log" out of the names, but I do not agree that the only two possible
alternative names are "pg_trans" and "pg_xact", which strikes me as
being akin to saying that the only two options for dinner tonight are
overripe peaches and lunch meats a week past the sell-by date. If I
had to pick only between those two, I suppose I'd go with "pg_xact"
which is clear enough to someone familiar with PostgreSQL internals,
as opposed to "pg_trans" which I don't think will be clear even to
those people. But I don't like either one very much.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 02:23:32PM -0400, Tom Lane wrote:
Robert Haas <robertmhaas@gmail.com> writes:
On Thu, Oct 20, 2016 at 2:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.Personally I'd go for "pg_trans", but it's only a weak preference.
Heaven forfend we actually use enough characters to make it self-documenting.
$ ls $PGDATA
PG_VERSION pg_dynshmem/ pg_notify/ pg_stat_tmp/ postgresql.auto.conf
base/ pg_hba.conf pg_replslot/ pg_subtrans/ postgresql.conf
global/ pg_ident.conf pg_serial/ pg_tblspc/ postmaster.opts
pg_clog/ pg_logical/ pg_snapshots/ pg_twophase/ postmaster.pid
pg_commit_ts/ pg_multixact/ pg_stat/ pg_wal/I don't see one single one of those subdirectory names that I'd call
self-documenting.
That's a problem we should do something about, even if we can't do it
by renaming these all in one go. At the very least, we can do this
for any new names.
Are you proposing we rename them all with carpal-
tunnel-syndrome-promoting names?
Are you saying that people are getting carpal tunnel syndrome from
hitting the tab key, which has been standard for completion in shells
for decades? I'm pretty sure that doesn't actually happen.
There's certainly some case to be made for renaming at least one of
"pg_subtrans" and "pg_multixact" so that these three similarly-purposed
subdirectories can all have similar names. But I think on the whole
that's (a) fixing what ain't broken, and (b) making it even more unlikely
that we'll ever get to consensus on changing anything. We've managed to
agree that we need to change the names ending in "log"; let's do that
and be happy that we've removed one foot-gun from the system.
Removing foot guns, un-sexy as it may be from a developer's
perspective, is very useful work.
Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* David Fetter (david@fetter.org) wrote:
On Thu, Oct 20, 2016 at 02:23:32PM -0400, Tom Lane wrote:
Robert Haas <robertmhaas@gmail.com> writes:
On Thu, Oct 20, 2016 at 2:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
We have the two precedents "pg_subtrans" and "pg_multixact", so
unless we want to get into renaming those too, I think "pg_trans"
and "pg_xact" are really the only options worth considering.Personally I'd go for "pg_trans", but it's only a weak preference.
Heaven forfend we actually use enough characters to make it self-documenting.
$ ls $PGDATA
PG_VERSION pg_dynshmem/ pg_notify/ pg_stat_tmp/ postgresql.auto.conf
base/ pg_hba.conf pg_replslot/ pg_subtrans/ postgresql.conf
global/ pg_ident.conf pg_serial/ pg_tblspc/ postmaster.opts
pg_clog/ pg_logical/ pg_snapshots/ pg_twophase/ postmaster.pid
pg_commit_ts/ pg_multixact/ pg_stat/ pg_wal/I don't see one single one of those subdirectory names that I'd call
self-documenting.That's a problem we should do something about, even if we can't do it
by renaming these all in one go. At the very least, we can do this
for any new names.
I disagree that excessivly long names for files or directories are
useful and should be fully self-documenting. We should name our
directories with useful hints at what they are used for that remind
those who are knowledgable where things live. Secondary to that is
using an approach to naming which avoid implying anything about the
directories to those who are *not* knowledgable, which leads us to the
current discussion regarding the removal of directories with 'log' in
the name.
Individuals who are not knowledgable in this area are not going to get
any more benefit from a directory named 'pg_trans' or
'pg_transaction_status' than one named 'pg_clog' or 'pg_xact' and
therefore this whole line of reasoning is a red herring.
Thanks!
Stephen
Stephen Frost <sfrost@snowman.net> writes:
* David Fetter (david@fetter.org) wrote:
On Thu, Oct 20, 2016 at 02:23:32PM -0400, Tom Lane wrote:
I don't see one single one of those subdirectory names that I'd call
self-documenting.
That's a problem we should do something about, even if we can't do it
by renaming these all in one go. At the very least, we can do this
for any new names.
I disagree that excessivly long names for files or directories are
useful and should be fully self-documenting.
I'm mostly with Stephen on this. As the names stand, they encourage
people to go look at the documentation,
https://www.postgresql.org/docs/devel/static/storage-file-layout.html
which will provide more information than you'd ever get out of any
reasonable directory name.
Having said that, I still don't like "pg_logical", but I suppose
renaming it would have more downsides than upsides.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Oct 21, 2016 at 12:35 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Wed, Oct 12, 2016 at 10:22 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:OK. I can live with that as well. Attached are three patches. The
pg_xlog -> pg_wal move, the pg_clog -> pg_transaction move, and the
pg_clog -> pg_xact move. Only one survivor to be chosen among the last
two ones.Committed 0001.
Thanks!
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 3:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm mostly with Stephen on this. As the names stand, they encourage
people to go look at the documentation,
https://www.postgresql.org/docs/devel/static/storage-file-layout.html
which will provide more information than you'd ever get out of any
reasonable directory name.
Well, we could change them all to pg_a, pg_b, pg_c, pg_d, ... which
would encourage that even more strongly. But I don't think that
proposal can be taken seriously. Giving things meaningful names is a
good practice in almost every case.
Having said that, I still don't like "pg_logical", but I suppose
renaming it would have more downsides than upsides.
Remind me what your beef is?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Oct 21, 2016 at 10:03 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Oct 20, 2016 at 3:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm mostly with Stephen on this. As the names stand, they encourage
people to go look at the documentation,
https://www.postgresql.org/docs/devel/static/storage-file-layout.html
which will provide more information than you'd ever get out of any
reasonable directory name.Well, we could change them all to pg_a, pg_b, pg_c, pg_d, ... which
would encourage that even more strongly. But I don't think that
proposal can be taken seriously. Giving things meaningful names is a
good practice in almost every case.
Moving on with the topic of this thread... I would think that
"pg_xact" is what we are moving to rename pg_clog.
On top of that, after reading the thread, here are the options and
binaries that could be renamed for consistency with the renaming of
pg_xlog:
- pg_xlogdump -> pg_waldump
- pg_resetxlog -> pg_resetwal
- pg_receivexlog -> pg_receivewal
- initdb --xlogdir -> --waldir
- pg_basebackup --xlogmethod --xlogdir -> --walmethod --waldir
That's quite a number, and each change is trivial. Previous options
would be better kept for backward-compatibility. Personally, I see no
urge in changing all that and I am fine with just renaming the *log
directories of PGDATA for this thread. But as the point has been
raised, here are all things that could be done.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Oct 20, 2016 at 6:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Oct 20, 2016 at 3:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm mostly with Stephen on this. As the names stand, they encourage
people to go look at the documentation,
https://www.postgresql.org/docs/devel/static/storage-file-layout.html
which will provide more information than you'd ever get out of any
reasonable directory name.Well, we could change them all to pg_a, pg_b, pg_c, pg_d, ... which
would encourage that even more strongly. But I don't think that
proposal can be taken seriously. Giving things meaningful names is a
good practice in almost every case.
Those don't have the virtue of being at least somewhat
m
nemonic
like pg_xact.
I'll toss my lot in with Steven's and Tom's on this.
I have no problem continuing keeping with historical precedent and
allowing mnemonic abbreviations in our directory and file names at this
point.
David J.
On 10/21/16 3:12 AM, David G. Johnston wrote:
I have no problem continuing keeping with historical precedent and
allowing mnemonic abbreviations in our directory and file names at this
point.
I'm still in favor of pg_xact. A search of the 9.6 docs brings up a
number of hits for "xact": pg_last_xact_replay_timestamp(),
pg_advisory_xact_lock(), pg_advisory_xact_lock_shared(),
pg_last_committed_xact(), pg_prepared_xacts(), etc. There are also
numerous column names that have "xact" in them.
It's not just an arcane developer term when it shows up in a number of
our user-facing functions/columns.
--
-David
david@pgmasters.net
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Robert Haas (robertmhaas@gmail.com) wrote:
On Thu, Oct 20, 2016 at 12:12 PM, Stephen Frost <sfrost@snowman.net> wrote:
That said, I'd also like to see a --force or similar option or mechanism
put in place to reduce the risk of users trashing their system because
they think pg_resetwal is "safe." ("It's just gonna reset things to make
the database start again, should be fine.").You know we already have that, right?
Yes, but I was meaning an option which would be required to make
pg_resetxlog actually *do* anything. In other words, I'd rather have it
report some info back to the user, if it's run without the
'--really-force' or what-have-you option, and only proceed with
clearing the WAL or rewriting pg_control when '--really-force' is used.
pg_destroydb almost seems like a better choice, though I suppose
'pg_clearwal' would be more acceptable. Doesn't have quite the same
impact though.Not sure on the best answer here, but it's definitely foot-gun that some
users have ended up using on themselves with depressing regularity.Just to provide some perspective from the other side of this, I
[...]
I wasn't suggesting that we remove the capability. There are certainly
use-cases for it, but, unfortunately, I've seen a number of cases where
users simply google'd an error that they got back when trying to start
PG and found someone saying "well, I got this error, but then I ran
pg_resetxlog, and now the database starts up again."
It likely doesn't help that the top links tend to be to mailing list
archives where pg_resetxlog was brought up.
Thanks!
Stephen
On Fri, Oct 21, 2016 at 9:47 AM, Stephen Frost <sfrost@snowman.net> wrote:
* Robert Haas (robertmhaas@gmail.com) wrote:
On Thu, Oct 20, 2016 at 12:12 PM, Stephen Frost <sfrost@snowman.net> wrote:
That said, I'd also like to see a --force or similar option or mechanism
put in place to reduce the risk of users trashing their system because
they think pg_resetwal is "safe." ("It's just gonna reset things to make
the database start again, should be fine.").You know we already have that, right?
Yes, but I was meaning an option which would be required to make
pg_resetxlog actually *do* anything. In other words, I'd rather have it
report some info back to the user, if it's run without the
'--really-force' or what-have-you option, and only proceed with
clearing the WAL or rewriting pg_control when '--really-force' is used.
I don't think that the problem is that people are accidentally typing
"pg_resetxlog $PGDATA" and pressing return. They're typing that on
purpose, and if you change the sequence of characters required to get
that effect, they'll just type the new thing instead. The problem is
that they don't understand when it's appropriate to use that command
and what the consequences are.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Robert Haas (robertmhaas@gmail.com) wrote:
I don't think that the problem is that people are accidentally typing
"pg_resetxlog $PGDATA" and pressing return. They're typing that on
purpose, and if you change the sequence of characters required to get
that effect, they'll just type the new thing instead. The problem is
that they don't understand when it's appropriate to use that command
and what the consequences are.
I agree that they don't understand, and that's why I believe that making
the command name, or a required option, a bit more ominous would make
them pause and realize that maybe they want to consider other options
first.
This is not exactly unheard of- apt-get requires an entire phrase be to
be entered when you're asking it to do something extremely dangerous
(remove an essential package):
---------------
root@ionith:~# apt-get remove login
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
login
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
login
0 upgraded, 0 newly installed, 1 to remove and 71 not upgraded.
After this operation, 1,212 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
---------------
My thought would be to make pg_resetxlog do something more along the
lines of what pg_control does and have it, by default, just investigate
the state of things and complain about problems and then have it include
an option to actually reset things with an appropriately ominous name.
The goal there being, primairly, to give a way for users to get
information about why PG isn't starting or what it is complaining about,
with some additional information about what happens if they forcibly
reset the xlog, noting that it could very likely cause corruption, etc.
Thanks!
Stephen
David Steele wrote:
On 10/21/16 3:12 AM, David G. Johnston wrote:
I have no problem continuing keeping with historical precedent and
allowing mnemonic abbreviations in our directory and file names at this
point.I'm still in favor of pg_xact. A search of the 9.6 docs brings up a number
of hits for "xact": pg_last_xact_replay_timestamp(),
pg_advisory_xact_lock(), pg_advisory_xact_lock_shared(),
pg_last_committed_xact(), pg_prepared_xacts(), etc. There are also numerous
column names that have "xact" in them.
I'm +1 on pg_clog -> pg_xact.
Also +1 to renaming pg_subtrans to pg_subxact.
In general, +1 to short mnemonic meaningful names. -1 to overly long
names, -1 to meaningless names.
Regarding pg_receivexlog I think I'd propose pg_recvwal rather than
pg_receivewal, because of pg_recvlogical.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Oct 22, 2016 at 4:29 AM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
David Steele wrote:
On 10/21/16 3:12 AM, David G. Johnston wrote:
I have no problem continuing keeping with historical precedent and
allowing mnemonic abbreviations in our directory and file names at this
point.I'm still in favor of pg_xact. A search of the 9.6 docs brings up a number
of hits for "xact": pg_last_xact_replay_timestamp(),
pg_advisory_xact_lock(), pg_advisory_xact_lock_shared(),
pg_last_committed_xact(), pg_prepared_xacts(), etc. There are also numerous
column names that have "xact" in them.I'm +1 on pg_clog -> pg_xact.
So let's say that's the winner then.
Also +1 to renaming pg_subtrans to pg_subxact.
Nice suggestion, good naming for consistency with the rest.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sat, Oct 22, 2016 at 07:33:56AM +0900, Michael Paquier wrote:
On Sat, Oct 22, 2016 at 4:29 AM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:David Steele wrote:
On 10/21/16 3:12 AM, David G. Johnston wrote:
I have no problem continuing keeping with historical precedent and
allowing mnemonic abbreviations in our directory and file names at this
point.I'm still in favor of pg_xact. A search of the 9.6 docs brings up a number
of hits for "xact": pg_last_xact_replay_timestamp(),
pg_advisory_xact_lock(), pg_advisory_xact_lock_shared(),
pg_last_committed_xact(), pg_prepared_xacts(), etc. There are also numerous
column names that have "xact" in them.I'm +1 on pg_clog -> pg_xact.
So let's say that's the winner then.
Also +1 to renaming pg_subtrans to pg_subxact.
Nice suggestion, good naming for consistency with the rest.
Agreed.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 10/22/16 6:58 PM, Bruce Momjian wrote:
On Sat, Oct 22, 2016 at 07:33:56AM +0900, Michael Paquier wrote:
On Sat, Oct 22, 2016 at 4:29 AM, Alvaro Herrera
Also +1 to renaming pg_subtrans to pg_subxact.
Nice suggestion, good naming for consistency with the rest.
Agreed.
+1
--
-David
david@pgmasters.net
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Oct 21, 2016 at 9:03 PM, Stephen Frost <sfrost@snowman.net> wrote:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
login
0 upgraded, 0 newly installed, 1 to remove and 71 not upgraded.
After this operation, 1,212 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
Another case was:
glxgears -iacknowledgethatthistoolisnotabenchmark
Which was required to get it to print the FPS for a while. The problem
-- and also the advantage -- of this is that it's scriptable. That
means people can still put it in recipe books and scripts and others
can copy it without being aware what it does or even that they're
doing it.
I think the apt-get behaviour was specifically designed to ensure it
couldn't easily be put into a script which I would have said was
desirable -- except I suspect there are situations where Postgres
database scripts need to do a resetxlog. I'm not sure I can think of
any examples offhand but I wouldn't be too surprised.
--
greg
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 10/22/2016 06:00 PM, David Steele wrote:
On 10/22/16 6:58 PM, Bruce Momjian wrote:
On Sat, Oct 22, 2016 at 07:33:56AM +0900, Michael Paquier wrote:
On Sat, Oct 22, 2016 at 4:29 AM, Alvaro Herrera
Also +1 to renaming pg_subtrans to pg_subxact.
Nice suggestion, good naming for consistency with the rest.
Agreed.
+1
+1 from me, too.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Sun, Oct 23, 2016 at 5:18 PM, Vik Fearing <vik@2ndquadrant.fr> wrote:
On 10/22/2016 06:00 PM, David Steele wrote:
On 10/22/16 6:58 PM, Bruce Momjian wrote:
On Sat, Oct 22, 2016 at 07:33:56AM +0900, Michael Paquier wrote:
On Sat, Oct 22, 2016 at 4:29 AM, Alvaro Herrera
Also +1 to renaming pg_subtrans to pg_subxact.
Nice suggestion, good naming for consistency with the rest.
Agreed.
+1
+1 from me, too.
OK, glad to see that we are reaching a conclusion to this thread.
Attached are two patches. 0001 renames pg_clog to pg_xact. I found a
comment in xact.c that was not yet updated. And 0002 renames
pg_subtrans to pg_subxact.
--
Michael
Attachments:
0001-Rename-pg_clog-to-pg_xact.patchtext/plain; charset=US-ASCII; name=0001-Rename-pg_clog-to-pg_xact.patchDownload
From 1711e73fe59b37c0626c1382c6f044b28c01f3d9 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Sun, 23 Oct 2016 20:52:22 +0900
Subject: [PATCH 1/2] Rename pg_clog to pg_xact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 ++--
doc/src/sgml/catalogs.sgml | 4 ++--
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++++----
doc/src/sgml/ref/pg_resetxlog.sgml | 4 ++--
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 +++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/README | 10 +++++-----
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 5 ++---
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 ++--
src/backend/access/transam/xact.c | 18 +++++++++---------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 +++++-----
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 ++--
src/backend/utils/time/tqual.c | 6 +++---
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++++------------
src/include/access/slru.h | 4 ++--
28 files changed, 83 insertions(+), 72 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..d22af0d 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_xact/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_xact</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 29738b0..839b52a 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1847,7 +1847,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2514,7 +2514,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index adab2f8..8a5d202 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5834,7 +5834,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_xact</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2e64cc4..e9cfb06 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15323,7 +15323,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_xact | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e0..65a64c8 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_xact</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_xact</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_xact</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_xact</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e..6ebc68b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_xact</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_xact</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a4..d5430d4 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_xact</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index fddb69b..56aef3c 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -146,6 +141,11 @@ Item
</row>
<row>
+ <entry><filename>pg_xact</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>postgresql.auto.conf</></entry>
<entry>A file used for storing configuration parameters that are set by
<command>ALTER SYSTEM</command></entry>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa76..1f9fac9 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b019bc1..560a8da 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,8 +6762,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_xact before we finish
+ * the VACUUM and perhaps truncate off the part of pg_xact he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715..e7dd19f 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
+pg_xact and pg_subtrans
-----------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_xact records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_xact are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 2634476..08e1edd 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_xact", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index a8d275f..0d03700 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_xact-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e9588a7..287e435 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_xact-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 908fe2d..6871239 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,15 +3,14 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
* The tree can easily be walked from child to parent, but not in the
* opposite direction.
*
- * This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_xact, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 1eba49a..0a103c3 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_xact but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604..8bed3f5 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_xact, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_xact */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e11b229..0dc4d43 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1206,8 +1206,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_xact. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_xact update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2033,7 +2033,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_xact. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -2539,7 +2539,7 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
+ * Advertise the fact that we aborted in pg_xact (assuming that we got as
* far as assigning an XID to advertise). But if we're inside a parallel
* worker, skip this; the user backend must be the one to write the abort
* record.
@@ -4625,7 +4625,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_xact. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5371,7 +5371,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_xact.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5389,7 +5389,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_xact. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5526,7 +5526,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5542,7 +5542,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d6c057a..ba1bce2 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8488,7 +8488,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_xact. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 58bbf55..d673031 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,7 +356,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_xact and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_xact and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_xact).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,7 +1086,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_xact is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index e3a6911..29a555e 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2395,7 +2395,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible. We
* only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f..bc80777 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_xact), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index e5d487d..d41a79f 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -388,7 +388,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_xact.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1180,7 +1180,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 26a3be3..41e89e1 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_xact). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_xact before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_xact until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index c8a8c52..9b82622 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_xact",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 55a6f0d..b242e30 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_xact");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 90c0720..9c475df 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_xact_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -113,7 +113,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_xact_xlog_xid();
/* New now using xids of the old system */
@@ -374,17 +374,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -399,10 +399,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_xact_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_xact in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -432,8 +438,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 5fcebc5..96a1e44 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_xact and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.10.1
0002-Rename-pg_subtrans-to-pg_subxact.patchtext/plain; charset=US-ASCII; name=0002-Rename-pg_subtrans-to-pg_subxact.patchDownload
From f7b2413b716ae93bd5f2b7b3abb892c8a936f271 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Sun, 23 Oct 2016 21:33:02 +0900
Subject: [PATCH 2/2] Rename pg_subtrans to pg_subxact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/transam/README | 18 +++++++++---------
src/backend/access/transam/subtrans.c | 8 ++++----
src/backend/access/transam/transam.c | 10 +++++-----
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/varsup.c | 6 +++---
src/backend/access/transam/xact.c | 2 +-
src/backend/access/transam/xlog.c | 8 ++++----
src/backend/replication/basebackup.c | 2 +-
src/backend/replication/logical/snapbuild.c | 2 +-
src/backend/storage/ipc/procarray.c | 14 +++++++-------
src/backend/utils/time/tqual.c | 2 +-
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 2 +-
src/bin/pg_upgrade/exec.c | 7 ++++++-
src/include/access/slru.h | 4 ++--
src/include/storage/proc.h | 2 +-
19 files changed, 53 insertions(+), 48 deletions(-)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index e9cfb06..74ccb77 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15330,7 +15330,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
- pg_subtrans | 19
+ pg_subxact | 19
(19 rows)
</programlisting>
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 56aef3c..e72331d 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -121,7 +121,7 @@ Item
</row>
<row>
- <entry><filename>pg_subtrans</></entry>
+ <entry><filename>pg_subxact</></entry>
<entry>Subdirectory containing subtransaction status data</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 1f9fac9..aa0eccb 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subxact</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index e7dd19f..94553f1 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -198,7 +198,7 @@ parent. This maintains the invariant that child transactions have XIDs later
than their parents, which is assumed in a number of places.
The subsidiary actions of obtaining a lock on the XID and entering it into
-pg_subtrans and PG_PROC are done at the time it is assigned.
+pg_subxact and PG_PROC are done at the time it is assigned.
A transaction that has no XID still needs to be identified for various
purposes, notably holding locks. For this purpose we assign a "virtual
@@ -331,10 +331,10 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_xact and pg_subtrans
+pg_xact and pg_subxact
-----------------------
-pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subxact are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
@@ -367,24 +367,24 @@ allow unlimited transaction nesting depth, so any particular subtransaction's
commit state is dependent on the commit status of each and every ancestor
transaction.
-The "subtransaction parent" (pg_subtrans) mechanism records, for each
+The "subtransaction parent" (pg_subxact) mechanism records, for each
transaction with an XID, the TransactionId of its parent transaction. This
information is stored as soon as the subtransaction is assigned an XID.
-Top-level transactions do not have a parent, so they leave their pg_subtrans
+Top-level transactions do not have a parent, so they leave their pg_subxact
entries set to the default value of zero (InvalidTransactionId).
-pg_subtrans is used to check whether the transaction in question is still
+pg_subxact is used to check whether the transaction in question is still
running --- the main Xid of a transaction is recorded in the PGXACT struct,
but since we allow arbitrary nesting of subtransactions, we can't fit all Xids
in shared memory, so we have to store them on disk. Note, however, that for
each transaction we keep a "cache" of Xids that are known to be part of the
-transaction tree, so we can skip looking at pg_subtrans unless we know the
+transaction tree, so we can skip looking at pg_subxact unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subxact. It
implements the LRU policy for in-memory buffer pages. The high-level routines
for pg_xact are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+clog.c. pg_subxact is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 6871239..e0f0395 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,7 +3,7 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_xact-like manager that stores the parent
+ * The pg_subxact manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
@@ -11,7 +11,7 @@
* opposite direction.
*
* are completely different from pg_xact, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
+ * pg_subxact information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
@@ -179,7 +179,7 @@ SUBTRANSShmemInit(void)
{
SubTransCtl->PagePrecedes = SubTransPagePrecedes;
SimpleLruInit(SubTransCtl, "subtrans", NUM_SUBTRANS_BUFFERS, 0,
- SubtransControlLock, "pg_subtrans",
+ SubtransControlLock, "pg_subxact",
LWTRANCHE_SUBTRANS_BUFFERS);
/* Override default assumption that writes should be fsync'd */
SubTransCtl->do_fsync = false;
@@ -240,7 +240,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
int endPage;
/*
- * Since we don't expect pg_subtrans to be valid across crashes, we
+ * Since we don't expect pg_subxact to be valid across crashes, we
* initialize the currently-active page(s) to zeroes during startup.
* Whenever we advance into a new page, ExtendSUBTRANS will likewise zero
* the new page without regard to whatever was previously on disk.
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 0a103c3..9f11dfd 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -137,13 +137,13 @@ TransactionIdDidCommit(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*
* Originally we Assert'ed that the result of SubTransGetParent was not
* zero. However with the introduction of prepared transactions, there can
* be a window just after database startup where we do not have complete
- * knowledge in pg_subtrans of the transactions after TransactionXmin.
+ * knowledge in pg_subxact of the transactions after TransactionXmin.
* StartupSUBTRANS() has ensured that any missing information will be
* zeroed. Since this case should not happen under normal conditions, it
* seems reasonable to emit a WARNING for it.
@@ -157,7 +157,7 @@ TransactionIdDidCommit(TransactionId transactionId)
parentXid = SubTransGetParent(transactionId);
if (!TransactionIdIsValid(parentXid))
{
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return false;
}
@@ -193,7 +193,7 @@ TransactionIdDidAbort(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*/
if (xidstatus == TRANSACTION_STATUS_SUB_COMMITTED)
@@ -206,7 +206,7 @@ TransactionIdDidAbort(TransactionId transactionId)
if (!TransactionIdIsValid(parentXid))
{
/* see notes in TransactionIdDidCommit */
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return true;
}
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 8bed3f5..5b3831a 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1674,7 +1674,7 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
*
* Our other responsibility is to determine and return the oldest valid XID
* among the prepared xacts (if none, return ShmemVariableCache->nextXid).
- * This is needed to synchronize pg_subtrans startup properly.
+ * This is needed to synchronize pg_subxact startup properly.
*
* If xids_p and nxids_p are not NULL, pointer to a palloc'd array of all
* top-level xids is stored in *xids_p. The number of entries in the array
@@ -1819,7 +1819,7 @@ PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
*
* Currently we simply call SubTransSetParent() for any subxids of prepared
* transactions. If overwriteOK is true, it's OK if some XIDs have already
- * been marked in pg_subtrans.
+ * been marked in pg_subxact.
*/
void
StandbyRecoverPreparedTransactions(bool overwriteOK)
@@ -1976,7 +1976,7 @@ RecoverPreparedTransactions(void)
/*
* Reconstruct subtrans state for the transaction --- needed
- * because pg_subtrans is not preserved over a restart. Note that
+ * because pg_subxact is not preserved over a restart. Note that
* we are linking all the subtransactions directly to the
* top-level XID; there may originally have been a more complex
* hierarchy, but there's no need to restore that exactly.
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 2f7e645..8703eea 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -166,7 +166,7 @@ GetNewTransactionId(bool isSubXact)
* XID before we zero the page. Fortunately, a page of the commit log
* holds 32K or more transactions, so we don't have to do this very often.
*
- * Extend pg_subtrans and pg_commit_ts too.
+ * Extend pg_subxact and pg_commit_ts too.
*/
ExtendCLOG(xid);
ExtendCommitTs(xid);
@@ -203,9 +203,9 @@ GetNewTransactionId(bool isSubXact)
*
* If there's no room to fit a subtransaction XID into PGPROC, set the
* cache-overflowed flag instead. This forces readers to look in
- * pg_subtrans to map subtransaction XIDs up to top-level XIDs. There is a
+ * pg_subxact to map subtransaction XIDs up to top-level XIDs. There is a
* race-condition window, in that the new XID will not appear as running
- * until its parent link has been placed into pg_subtrans. However, that
+ * until its parent link has been placed into pg_subxact. However, that
* will happen before anyone could possibly have a reason to inquire about
* the status of the XID, so it seems OK. (Snapshots taken during this
* window *will* include the parent XID, so they will deliver the correct
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 0dc4d43..5703234 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -544,7 +544,7 @@ AssignTransactionId(TransactionState s)
log_unknown_top = true;
/*
- * Generate a new Xid and record it in PG_PROC and pg_subtrans.
+ * Generate a new Xid and record it in PG_PROC and pg_subxact.
*
* NB: we must make the subtrans entry BEFORE the Xid appears anywhere in
* shared storage other than PG_PROC; because if there's no room for it in
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ba1bce2..c21362d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8640,9 +8640,9 @@ CreateCheckPoint(int flags)
PreallocXlogFiles(recptr);
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). During recovery, though, we mustn't do this because
* StartupSUBTRANS hasn't been called yet.
*/
@@ -8979,9 +8979,9 @@ CreateRestartPoint(int flags)
}
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). When hot standby is disabled, though, we mustn't do
* this because StartupSUBTRANS hasn't been called yet.
*/
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index ffc7e58..32c1998 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -134,7 +134,7 @@ static const char *excludeDirContents[] =
"pg_snapshots",
/* Contents zeroed on startup, see StartupSUBTRANS(). */
- "pg_subtrans",
+ "pg_subxact",
/* end of list */
NULL
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 8b59fc5..2d73734 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -20,7 +20,7 @@
* tables since the data we decode is wholly contained in the WAL
* records. Also, our snapshots need to be different in comparison to normal
* MVCC ones because in contrast to those we cannot fully rely on the clog and
- * pg_subtrans for information about committed transactions because they might
+ * pg_subxact for information about committed transactions because they might
* commit in the future from the POV of the WAL entry we're currently
* decoding. This definition has the advantage that we only need to prevent
* removal of catalog rows, while normal table's rows can still be
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index d41a79f..e4e88a9 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -935,7 +935,7 @@ ProcArrayApplyXidAssignment(TransactionId topxid,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Notice that we update pg_subtrans with the top-level xid, rather than
+ * Notice that we update pg_subxact with the top-level xid, rather than
* the parent xid. This is a difference between normal processing and
* recovery, yet is still correct in all cases. The reason is that
* subtransaction commit is not marked in clog until commit processing, so
@@ -1152,7 +1152,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * If the KnownAssignedXids overflowed, we have to check pg_subtrans
+ * If the KnownAssignedXids overflowed, we have to check pg_subxact
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
@@ -1166,7 +1166,7 @@ TransactionIdIsInProgress(TransactionId xid)
/*
* If none of the relevant caches overflowed, we know the Xid is not
- * running without even looking at pg_subtrans.
+ * running without even looking at pg_subxact.
*/
if (nxids == 0)
{
@@ -1175,7 +1175,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * Step 4: have to check pg_subtrans.
+ * Step 4: have to check pg_subxact.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
@@ -1276,7 +1276,7 @@ TransactionIdIsActive(TransactionId xid)
* ignore concurrently running lazy VACUUMs because (a) they must be working
* on other tables, and (b) they don't need to do snapshot-based lookups.
*
- * This is also used to determine where to truncate pg_subtrans. For that
+ * This is also used to determine where to truncate pg_subxact. For that
* backends in all databases have to be considered, so rel = NULL has to be
* passed in.
*
@@ -3081,14 +3081,14 @@ DisplayXidCache(void)
* KnownAssignedXids list. In backends, this is copied into snapshots in
* GetSnapshotData(), taking advantage of the fact that XidInMVCCSnapshot()
* doesn't care about the distinction either. Subtransaction XIDs are
- * effectively treated as top-level XIDs and in the typical case pg_subtrans
+ * effectively treated as top-level XIDs and in the typical case pg_subxact
* links are *not* maintained (which does not affect visibility).
*
* We have room in KnownAssignedXids and in snapshots to hold maxProcs *
* (1 + PGPROC_MAX_CACHED_SUBXIDS) XIDs, so every master transaction must
* report its subtransaction XIDs in a WAL XLOG_XACT_ASSIGNMENT record at
* least every PGPROC_MAX_CACHED_SUBXIDS. When we receive one of these
- * records, we mark the subXIDs as children of the top XID in pg_subtrans,
+ * records, we mark the subXIDs as children of the top XID in pg_subxact,
* and then remove them from KnownAssignedXids. This prevents overflow of
* KnownAssignedXids and snapshots, at the cost that status checks for these
* subXIDs will take a slower path through TransactionIdIsInProgress().
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 41e89e1..5cfa917 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -1490,7 +1490,7 @@ XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
* If the snapshot contains full subxact data, the fastest way to
* check things is just to compare the given XID against both subxact
* XIDs and top-level XIDs. If the snapshot overflowed, we have to
- * use pg_subtrans to convert a subxact XID to its parent XID, but
+ * use pg_subxact to convert a subxact XID to its parent XID, but
* then we need only look at top-level XIDs not subxacts.
*/
if (!snapshot->suboverflowed)
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 9b82622..8f0460d 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -201,7 +201,7 @@ static const char *const subdirs[] = {
"pg_notify",
"pg_serial",
"pg_snapshots",
- "pg_subtrans",
+ "pg_subxact",
"pg_twophase",
"pg_multixact",
"pg_multixact/members",
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 579d7a1..61a1491 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -74,7 +74,7 @@ is_deeply(
'no WAL files copied');
# Contents of these directories should not be copied.
-foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subtrans))
+foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subxact))
{
is_deeply(
[ sort(slurp_dir("$tempdir/backup/$dirname/")) ],
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index b242e30..c6633c9 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -300,7 +300,6 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "base");
check_single_dir(pg_data, "global");
check_single_dir(pg_data, "pg_multixact");
- check_single_dir(pg_data, "pg_subtrans");
check_single_dir(pg_data, "pg_tblspc");
check_single_dir(pg_data, "pg_twophase");
@@ -315,6 +314,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_clog");
else
check_single_dir(pg_data, "pg_xact");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_subtrans");
+ else
+ check_single_dir(pg_data, "pg_subxact");
}
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 96a1e44..54ad056 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subxact, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -121,7 +121,7 @@ typedef struct SlruCtlData
/*
* This flag tells whether to fsync writes (true for pg_xact and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * stuff, false for pg_subxact and pg_notify).
*/
bool do_fsync;
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 7dc8dac..08c2d68 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -30,7 +30,7 @@
* generated at least one subtransaction that didn't fit in the cache).
* If none of the caches have overflowed, we can assume that an XID that's not
* listed anywhere in the PGPROC array is not a running transaction. Else we
- * have to look at pg_subtrans.
+ * have to look at pg_subxact.
*/
#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
--
2.10.1
On Sat, Oct 22, 2016 at 11:18:28PM +0300, Greg Stark wrote:
On Fri, Oct 21, 2016 at 9:03 PM, Stephen Frost <sfrost@snowman.net> wrote:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
login
0 upgraded, 0 newly installed, 1 to remove and 71 not upgraded.
After this operation, 1,212 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'Another case was:
glxgears -iacknowledgethatthistoolisnotabenchmarkWhich was required to get it to print the FPS for a while. The problem
-- and also the advantage -- of this is that it's scriptable. That
means people can still put it in recipe books and scripts and others
can copy it without being aware what it does or even that they're
doing it.I think the apt-get behaviour was specifically designed to ensure it
couldn't easily be put into a script which I would have said was
desirable -- except I suspect there are situations where Postgres
database scripts need to do a resetxlog. I'm not sure I can think of
any examples offhand but I wouldn't be too surprised.
Yes, pg_upgrade has eight calls to pg_resetxlog to set various value.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Bruce Momjian wrote:
On Sat, Oct 22, 2016 at 11:18:28PM +0300, Greg Stark wrote:
I think the apt-get behaviour was specifically designed to ensure it
couldn't easily be put into a script which I would have said was
desirable -- except I suspect there are situations where Postgres
database scripts need to do a resetxlog. I'm not sure I can think of
any examples offhand but I wouldn't be too surprised.Yes, pg_upgrade has eight calls to pg_resetxlog to set various value.
There is one difference though, which is that the really destructive
use of pg_resetxlog is the one that removes pg_xlog files. The other
uses that simply set flags in the control file are not as bad -- you can
simply go back to what the original value was. I think we would only
need the obnoxious string requirement in the most dangerous mode.
Alternatively, we could separate the tool in two different executables.
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Oct 24, 2016 at 11:59:42AM -0300, Alvaro Herrera wrote:
Bruce Momjian wrote:
On Sat, Oct 22, 2016 at 11:18:28PM +0300, Greg Stark wrote:
I think the apt-get behaviour was specifically designed to ensure it
couldn't easily be put into a script which I would have said was
desirable -- except I suspect there are situations where Postgres
database scripts need to do a resetxlog. I'm not sure I can think of
any examples offhand but I wouldn't be too surprised.Yes, pg_upgrade has eight calls to pg_resetxlog to set various value.
There is one difference though, which is that the really destructive
use of pg_resetxlog is the one that removes pg_xlog files. The other
uses that simply set flags in the control file are not as bad -- you can
simply go back to what the original value was. I think we would only
need the obnoxious string requirement in the most dangerous mode.Alternatively, we could separate the tool in two different executables.
OK, but we are going need to document that this special flag is only
needed for certain option uses.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Bruce Momjian wrote:
On Mon, Oct 24, 2016 at 11:59:42AM -0300, Alvaro Herrera wrote:
There is one difference though, which is that the really destructive
use of pg_resetxlog is the one that removes pg_xlog files. The other
uses that simply set flags in the control file are not as bad -- you can
simply go back to what the original value was. I think we would only
need the obnoxious string requirement in the most dangerous mode.
OK, but we are going need to document that this special flag is only
needed for certain option uses.
Perhaps, but not in too much detail; just that "users need to follow
on-screen indications" or some such would be enough.
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hi Craig,
This is a gentle reminder.
you assigned as reviewer to the current patch in the 11-2016 commitfest.
But you haven't shared your review yet. Please share your review about
the patch. This will help us in smoother operation of commitfest.
Please Ignore if you already shared your review.
Regards,
Hari Babu
Fujitsu Australia
On Tue, Nov 22, 2016 at 8:35 PM, Haribabu Kommi
<kommi.haribabu@gmail.com> wrote:
Hi Craig,
This is a gentle reminder.
you assigned as reviewer to the current patch in the 11-2016 commitfest.
But you haven't shared your review yet. Please share your review about
the patch. This will help us in smoother operation of commitfest.Please Ignore if you already shared your review.
I have moved this CF entry to 2017-01, the remaining, still unreviewed
patch are for renaming pg_subxact and pg_clog.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Tue, Nov 29, 2016 at 1:35 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Tue, Nov 22, 2016 at 8:35 PM, Haribabu Kommi
<kommi.haribabu@gmail.com> wrote:Hi Craig,
This is a gentle reminder.
you assigned as reviewer to the current patch in the 11-2016 commitfest.
But you haven't shared your review yet. Please share your review about
the patch. This will help us in smoother operation of commitfest.Please Ignore if you already shared your review.
I have moved this CF entry to 2017-01, the remaining, still unreviewed
patch are for renaming pg_subxact and pg_clog.
The second patch has rotten a little because of the backup
documentation. By the way, is something going to happen in the CF?
Craig, you are a reviewer of this patch.
--
Michael
Attachments:
0001-Rename-pg_clog-to-pg_xact.patchinvalid/octet-stream; name=0001-Rename-pg_clog-to-pg_xact.patchDownload
From fcf26703672232a77c29ad08146ab97a7626fc5e Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Sun, 23 Oct 2016 20:52:22 +0900
Subject: [PATCH 1/2] Rename pg_clog to pg_xact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 ++--
doc/src/sgml/catalogs.sgml | 4 ++--
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++++----
doc/src/sgml/ref/pg_resetxlog.sgml | 4 ++--
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 +++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/README | 10 +++++-----
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 5 ++---
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 ++--
src/backend/access/transam/xact.c | 18 +++++++++---------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 +++++-----
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 ++--
src/backend/utils/time/tqual.c | 6 +++---
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++++------------
src/include/access/slru.h | 4 ++--
28 files changed, 83 insertions(+), 72 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index d7df91090d..0c56c9d068 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_xact/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_xact</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 493050618d..cdd72b88eb 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1866,7 +1866,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2543,7 +2543,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 07afa3c77a..e77d01d572 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5902,7 +5902,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_xact</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 10e31868ba..865f74a260 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15321,7 +15321,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_xact | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e00de..65a64c85ec 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_xact</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_xact</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_xact</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_xact</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index c949c5e849..6ebc68b454 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_xact</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_xact</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a475f..d5430d4324 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_xact</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 5c52824dfc..91b44d4cc5 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -72,11 +72,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -146,6 +141,11 @@ Item
</row>
<row>
+ <entry><filename>pg_xact</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>postgresql.auto.conf</></entry>
<entry>A file used for storing configuration parameters that are set by
<command>ALTER SYSTEM</command></entry>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 346aa769a8..1f9fac9be9 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 1ce42ea970..0649b35d2c 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6762,8 +6762,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_xact before we finish
+ * the VACUUM and perhaps truncate off the part of pg_xact he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715339..e7dd19fd7b 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
+pg_xact and pg_subtrans
-----------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_xact records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_xact are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 1a43819736..5b1d13dac1 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_xact", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 2403de3ae3..a7ef495973 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_xact-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 59d1252ddc..51f8fa22c5 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_xact-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index a66fc0f2ad..70828e5170 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,15 +3,14 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
* The tree can easily be walked from child to parent, but not in the
* opposite direction.
*
- * This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_xact, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index c2b4318bd3..b91a259e80 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_xact but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5b72c1dcf5..3c1f7b596d 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_xact, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_xact */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index f5346f024e..fc603a575e 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1207,8 +1207,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_xact. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_xact update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2034,7 +2034,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_xact. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -2543,7 +2543,7 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
+ * Advertise the fact that we aborted in pg_xact (assuming that we got as
* far as assigning an XID to advertise). But if we're inside a parallel
* worker, skip this; the user backend must be the one to write the abort
* record.
@@ -4629,7 +4629,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_xact. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5373,7 +5373,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_xact.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5391,7 +5391,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_xact. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5528,7 +5528,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5544,7 +5544,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 70edafadff..41b721b1dd 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8550,7 +8550,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_xact. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 0f72c1c36a..e92372d06d 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -356,7 +356,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -880,7 +880,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_xact and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1026,7 +1026,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_xact and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1039,7 +1039,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_xact).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1086,7 +1086,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_xact is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 251b9fe372..b3fdd29c49 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2468,7 +2468,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible. We
* only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f0da..bc80777bb1 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_xact), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 3f47b984ee..ce34e8a8de 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -381,7 +381,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_xact.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1174,7 +1174,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 053a6d1c70..2431d8794a 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_xact). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_xact before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_xact until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 1e7d677244..8ad3879e13 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -196,7 +196,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -213,6 +212,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_xact",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 3a30ea7438..6810a6fb58 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -309,6 +309,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_xact");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 797e36d253..1760636c25 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -47,7 +47,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_xact_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -114,7 +114,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_xact_xlog_xid();
/* New now using xids of the old system */
@@ -375,17 +375,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -400,10 +400,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_xact_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_xact in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -433,8 +439,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index cf6edc3bdb..722867d5d2 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -119,7 +119,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_xact and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.11.0
0002-Rename-pg_subtrans-to-pg_subxact.patchinvalid/octet-stream; name=0002-Rename-pg_subtrans-to-pg_subxact.patchDownload
From 3964348533b73cd68c11074c173b66d37b8b51d1 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 17 Jan 2017 16:29:32 +0900
Subject: [PATCH 2/2] Rename pg_subtrans to pg_subxact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/protocol.sgml | 2 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/transam/README | 18 +++++++++---------
src/backend/access/transam/subtrans.c | 8 ++++----
src/backend/access/transam/transam.c | 10 +++++-----
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/varsup.c | 6 +++---
src/backend/access/transam/xact.c | 2 +-
src/backend/access/transam/xlog.c | 8 ++++----
src/backend/replication/basebackup.c | 2 +-
src/backend/replication/logical/snapbuild.c | 2 +-
src/backend/storage/ipc/procarray.c | 14 +++++++-------
src/backend/utils/time/tqual.c | 2 +-
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 2 +-
src/bin/pg_upgrade/exec.c | 7 ++++++-
src/include/access/slru.h | 4 ++--
src/include/storage/proc.h | 2 +-
21 files changed, 55 insertions(+), 50 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 0c56c9d068..a5a9b879e7 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -1093,7 +1093,7 @@ SELECT pg_stop_backup();
The contents of the directories <filename>pg_dynshmem/</>,
<filename>pg_notify/</>, <filename>pg_serial/</>,
<filename>pg_snapshots/</>, <filename>pg_stat_tmp/</>,
- and <filename>pg_subtrans/</> (but not the directories themselves) can be
+ and <filename>pg_subxact/</> (but not the directories themselves) can be
omitted from the backup as they will be initialized on postmaster startup.
If <xref linkend="guc-stats-temp-directory"> is set and is under the data
directory then the contents of that directory can also be omitted.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 865f74a260..e433b99f30 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15328,7 +15328,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
- pg_subtrans | 19
+ pg_subxact | 19
(19 rows)
</programlisting>
</para>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 9ba147cae5..d40dd42eaa 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -2098,7 +2098,7 @@ The commands accepted in walsender mode are:
<filename>pg_dynshmem</>, <filename>pg_notify</>,
<filename>pg_replslot</>, <filename>pg_serial</>,
<filename>pg_snapshots</>, <filename>pg_stat_tmp</>, and
- <filename>pg_subtrans</> are copied as empty directories (even if
+ <filename>pg_subxact</> are copied as empty directories (even if
they are symbolic links).
</para>
</listitem>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index 91b44d4cc5..2fb858a149 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -121,7 +121,7 @@ Item
</row>
<row>
- <entry><filename>pg_subtrans</></entry>
+ <entry><filename>pg_subxact</></entry>
<entry>Subdirectory containing subtransaction status data</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 1f9fac9be9..aa0eccb048 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subxact</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index e7dd19fd7b..94553f1f15 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -198,7 +198,7 @@ parent. This maintains the invariant that child transactions have XIDs later
than their parents, which is assumed in a number of places.
The subsidiary actions of obtaining a lock on the XID and entering it into
-pg_subtrans and PG_PROC are done at the time it is assigned.
+pg_subxact and PG_PROC are done at the time it is assigned.
A transaction that has no XID still needs to be identified for various
purposes, notably holding locks. For this purpose we assign a "virtual
@@ -331,10 +331,10 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_xact and pg_subtrans
+pg_xact and pg_subxact
-----------------------
-pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subxact are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
@@ -367,24 +367,24 @@ allow unlimited transaction nesting depth, so any particular subtransaction's
commit state is dependent on the commit status of each and every ancestor
transaction.
-The "subtransaction parent" (pg_subtrans) mechanism records, for each
+The "subtransaction parent" (pg_subxact) mechanism records, for each
transaction with an XID, the TransactionId of its parent transaction. This
information is stored as soon as the subtransaction is assigned an XID.
-Top-level transactions do not have a parent, so they leave their pg_subtrans
+Top-level transactions do not have a parent, so they leave their pg_subxact
entries set to the default value of zero (InvalidTransactionId).
-pg_subtrans is used to check whether the transaction in question is still
+pg_subxact is used to check whether the transaction in question is still
running --- the main Xid of a transaction is recorded in the PGXACT struct,
but since we allow arbitrary nesting of subtransactions, we can't fit all Xids
in shared memory, so we have to store them on disk. Note, however, that for
each transaction we keep a "cache" of Xids that are known to be part of the
-transaction tree, so we can skip looking at pg_subtrans unless we know the
+transaction tree, so we can skip looking at pg_subxact unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subxact. It
implements the LRU policy for in-memory buffer pages. The high-level routines
for pg_xact are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+clog.c. pg_subxact is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 70828e5170..3c535b0645 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,7 +3,7 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_xact-like manager that stores the parent
+ * The pg_subxact manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
@@ -11,7 +11,7 @@
* opposite direction.
*
* are completely different from pg_xact, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
+ * pg_subxact information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
@@ -179,7 +179,7 @@ SUBTRANSShmemInit(void)
{
SubTransCtl->PagePrecedes = SubTransPagePrecedes;
SimpleLruInit(SubTransCtl, "subtrans", NUM_SUBTRANS_BUFFERS, 0,
- SubtransControlLock, "pg_subtrans",
+ SubtransControlLock, "pg_subxact",
LWTRANCHE_SUBTRANS_BUFFERS);
/* Override default assumption that writes should be fsync'd */
SubTransCtl->do_fsync = false;
@@ -240,7 +240,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
int endPage;
/*
- * Since we don't expect pg_subtrans to be valid across crashes, we
+ * Since we don't expect pg_subxact to be valid across crashes, we
* initialize the currently-active page(s) to zeroes during startup.
* Whenever we advance into a new page, ExtendSUBTRANS will likewise zero
* the new page without regard to whatever was previously on disk.
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index b91a259e80..066a0a4800 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -137,13 +137,13 @@ TransactionIdDidCommit(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*
* Originally we Assert'ed that the result of SubTransGetParent was not
* zero. However with the introduction of prepared transactions, there can
* be a window just after database startup where we do not have complete
- * knowledge in pg_subtrans of the transactions after TransactionXmin.
+ * knowledge in pg_subxact of the transactions after TransactionXmin.
* StartupSUBTRANS() has ensured that any missing information will be
* zeroed. Since this case should not happen under normal conditions, it
* seems reasonable to emit a WARNING for it.
@@ -157,7 +157,7 @@ TransactionIdDidCommit(TransactionId transactionId)
parentXid = SubTransGetParent(transactionId);
if (!TransactionIdIsValid(parentXid))
{
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return false;
}
@@ -193,7 +193,7 @@ TransactionIdDidAbort(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*/
if (xidstatus == TRANSACTION_STATUS_SUB_COMMITTED)
@@ -206,7 +206,7 @@ TransactionIdDidAbort(TransactionId transactionId)
if (!TransactionIdIsValid(parentXid))
{
/* see notes in TransactionIdDidCommit */
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return true;
}
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 3c1f7b596d..9da228dc1d 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1674,7 +1674,7 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
*
* Our other responsibility is to determine and return the oldest valid XID
* among the prepared xacts (if none, return ShmemVariableCache->nextXid).
- * This is needed to synchronize pg_subtrans startup properly.
+ * This is needed to synchronize pg_subxact startup properly.
*
* If xids_p and nxids_p are not NULL, pointer to a palloc'd array of all
* top-level xids is stored in *xids_p. The number of entries in the array
@@ -1819,7 +1819,7 @@ PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
*
* Currently we simply call SubTransSetParent() for any subxids of prepared
* transactions. If overwriteOK is true, it's OK if some XIDs have already
- * been marked in pg_subtrans.
+ * been marked in pg_subxact.
*/
void
StandbyRecoverPreparedTransactions(bool overwriteOK)
@@ -1976,7 +1976,7 @@ RecoverPreparedTransactions(void)
/*
* Reconstruct subtrans state for the transaction --- needed
- * because pg_subtrans is not preserved over a restart. Note that
+ * because pg_subxact is not preserved over a restart. Note that
* we are linking all the subtransactions directly to the
* top-level XID; there may originally have been a more complex
* hierarchy, but there's no need to restore that exactly.
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index fc084c5bdb..9c987ff91b 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -166,7 +166,7 @@ GetNewTransactionId(bool isSubXact)
* XID before we zero the page. Fortunately, a page of the commit log
* holds 32K or more transactions, so we don't have to do this very often.
*
- * Extend pg_subtrans and pg_commit_ts too.
+ * Extend pg_subxact and pg_commit_ts too.
*/
ExtendCLOG(xid);
ExtendCommitTs(xid);
@@ -203,9 +203,9 @@ GetNewTransactionId(bool isSubXact)
*
* If there's no room to fit a subtransaction XID into PGPROC, set the
* cache-overflowed flag instead. This forces readers to look in
- * pg_subtrans to map subtransaction XIDs up to top-level XIDs. There is a
+ * pg_subxact to map subtransaction XIDs up to top-level XIDs. There is a
* race-condition window, in that the new XID will not appear as running
- * until its parent link has been placed into pg_subtrans. However, that
+ * until its parent link has been placed into pg_subxact. However, that
* will happen before anyone could possibly have a reason to inquire about
* the status of the XID, so it seems OK. (Snapshots taken during this
* window *will* include the parent XID, so they will deliver the correct
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index fc603a575e..fe0904fc11 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -545,7 +545,7 @@ AssignTransactionId(TransactionState s)
log_unknown_top = true;
/*
- * Generate a new Xid and record it in PG_PROC and pg_subtrans.
+ * Generate a new Xid and record it in PG_PROC and pg_subxact.
*
* NB: we must make the subtrans entry BEFORE the Xid appears anywhere in
* shared storage other than PG_PROC; because if there's no room for it in
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 41b721b1dd..9838a00f7a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8702,9 +8702,9 @@ CreateCheckPoint(int flags)
PreallocXlogFiles(recptr);
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). During recovery, though, we mustn't do this because
* StartupSUBTRANS hasn't been called yet.
*/
@@ -9065,9 +9065,9 @@ CreateRestartPoint(int flags)
}
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). When hot standby is disabled, though, we mustn't do
* this because StartupSUBTRANS hasn't been called yet.
*/
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 09ecc15365..6f1bce13d4 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -134,7 +134,7 @@ static const char *excludeDirContents[] =
"pg_snapshots",
/* Contents zeroed on startup, see StartupSUBTRANS(). */
- "pg_subtrans",
+ "pg_subxact",
/* end of list */
NULL
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 1e02aa9bd8..7ade4759dd 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -20,7 +20,7 @@
* tables since the data we decode is wholly contained in the WAL
* records. Also, our snapshots need to be different in comparison to normal
* MVCC ones because in contrast to those we cannot fully rely on the clog and
- * pg_subtrans for information about committed transactions because they might
+ * pg_subxact for information about committed transactions because they might
* commit in the future from the POV of the WAL entry we're currently
* decoding. This definition has the advantage that we only need to prevent
* removal of catalog rows, while normal table's rows can still be
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index ce34e8a8de..75736e3de9 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -929,7 +929,7 @@ ProcArrayApplyXidAssignment(TransactionId topxid,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Notice that we update pg_subtrans with the top-level xid, rather than
+ * Notice that we update pg_subxact with the top-level xid, rather than
* the parent xid. This is a difference between normal processing and
* recovery, yet is still correct in all cases. The reason is that
* subtransaction commit is not marked in clog until commit processing, so
@@ -1146,7 +1146,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * If the KnownAssignedXids overflowed, we have to check pg_subtrans
+ * If the KnownAssignedXids overflowed, we have to check pg_subxact
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
@@ -1160,7 +1160,7 @@ TransactionIdIsInProgress(TransactionId xid)
/*
* If none of the relevant caches overflowed, we know the Xid is not
- * running without even looking at pg_subtrans.
+ * running without even looking at pg_subxact.
*/
if (nxids == 0)
{
@@ -1169,7 +1169,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * Step 4: have to check pg_subtrans.
+ * Step 4: have to check pg_subxact.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
@@ -1270,7 +1270,7 @@ TransactionIdIsActive(TransactionId xid)
* ignore concurrently running lazy VACUUMs because (a) they must be working
* on other tables, and (b) they don't need to do snapshot-based lookups.
*
- * This is also used to determine where to truncate pg_subtrans. For that
+ * This is also used to determine where to truncate pg_subxact. For that
* backends in all databases have to be considered, so rel = NULL has to be
* passed in.
*
@@ -3075,14 +3075,14 @@ DisplayXidCache(void)
* KnownAssignedXids list. In backends, this is copied into snapshots in
* GetSnapshotData(), taking advantage of the fact that XidInMVCCSnapshot()
* doesn't care about the distinction either. Subtransaction XIDs are
- * effectively treated as top-level XIDs and in the typical case pg_subtrans
+ * effectively treated as top-level XIDs and in the typical case pg_subxact
* links are *not* maintained (which does not affect visibility).
*
* We have room in KnownAssignedXids and in snapshots to hold maxProcs *
* (1 + PGPROC_MAX_CACHED_SUBXIDS) XIDs, so every master transaction must
* report its subtransaction XIDs in a WAL XLOG_XACT_ASSIGNMENT record at
* least every PGPROC_MAX_CACHED_SUBXIDS. When we receive one of these
- * records, we mark the subXIDs as children of the top XID in pg_subtrans,
+ * records, we mark the subXIDs as children of the top XID in pg_subxact,
* and then remove them from KnownAssignedXids. This prevents overflow of
* KnownAssignedXids and snapshots, at the cost that status checks for these
* subXIDs will take a slower path through TransactionIdIsInProgress().
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 2431d8794a..295d3a975c 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -1490,7 +1490,7 @@ XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
* If the snapshot contains full subxact data, the fastest way to
* check things is just to compare the given XID against both subxact
* XIDs and top-level XIDs. If the snapshot overflowed, we have to
- * use pg_subtrans to convert a subxact XID to its parent XID, but
+ * use pg_subxact to convert a subxact XID to its parent XID, but
* then we need only look at top-level XIDs not subxacts.
*/
if (!snapshot->suboverflowed)
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 8ad3879e13..621e1be8c3 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -201,7 +201,7 @@ static const char *const subdirs[] = {
"pg_notify",
"pg_serial",
"pg_snapshots",
- "pg_subtrans",
+ "pg_subxact",
"pg_twophase",
"pg_multixact",
"pg_multixact/members",
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 2c5a3658d5..d560650566 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -74,7 +74,7 @@ is_deeply(
'no WAL files copied');
# Contents of these directories should not be copied.
-foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subtrans))
+foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subxact))
{
is_deeply(
[ sort(slurp_dir("$tempdir/backup/$dirname/")) ],
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 6810a6fb58..9012310b31 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -300,7 +300,6 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "base");
check_single_dir(pg_data, "global");
check_single_dir(pg_data, "pg_multixact");
- check_single_dir(pg_data, "pg_subtrans");
check_single_dir(pg_data, "pg_tblspc");
check_single_dir(pg_data, "pg_twophase");
@@ -315,6 +314,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_clog");
else
check_single_dir(pg_data, "pg_xact");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_subtrans");
+ else
+ check_single_dir(pg_data, "pg_subxact");
}
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 722867d5d2..d28c768dbc 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subxact, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
/*
* This flag tells whether to fsync writes (true for pg_xact and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * stuff, false for pg_subxact and pg_notify).
*/
bool do_fsync;
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 398fa8afde..e139de8c2f 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -30,7 +30,7 @@
* generated at least one subtransaction that didn't fit in the cache).
* If none of the caches have overflowed, we can assume that an XID that's not
* listed anywhere in the PGPROC array is not a running transaction. Else we
- * have to look at pg_subtrans.
+ * have to look at pg_subxact.
*/
#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
--
2.11.0
On Tue, Jan 17, 2017 at 4:31 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Tue, Nov 29, 2016 at 1:35 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:On Tue, Nov 22, 2016 at 8:35 PM, Haribabu Kommi
<kommi.haribabu@gmail.com> wrote:Hi Craig,
This is a gentle reminder.
you assigned as reviewer to the current patch in the 11-2016 commitfest.
But you haven't shared your review yet. Please share your review about
the patch. This will help us in smoother operation of commitfest.Please Ignore if you already shared your review.
I have moved this CF entry to 2017-01, the remaining, still unreviewed
patch are for renaming pg_subxact and pg_clog.The second patch has rotten a little because of the backup
documentation. By the way, is something going to happen in the CF?
Craig, you are a reviewer of this patch.
Moved to CF 2017-03.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 1/17/17 2:31 AM, Michael Paquier wrote:
On Tue, Nov 29, 2016 at 1:35 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:On Tue, Nov 22, 2016 at 8:35 PM, Haribabu Kommi
<kommi.haribabu@gmail.com> wrote:Hi Craig,
This is a gentle reminder.
you assigned as reviewer to the current patch in the 11-2016 commitfest.
But you haven't shared your review yet. Please share your review about
the patch. This will help us in smoother operation of commitfest.Please Ignore if you already shared your review.
I have moved this CF entry to 2017-01, the remaining, still unreviewed
patch are for renaming pg_subxact and pg_clog.The second patch has rotten a little because of the backup
documentation. By the way, is something going to happen in the CF?
Craig, you are a reviewer of this patch.
This patch does not apply cleanly at cccbdde:
$ git apply ../other/0001-Rename-pg_clog-to-pg_xact.patch
error: doc/src/sgml/ref/pg_resetxlog.sgml: No such file or directory
error: patch failed: src/backend/postmaster/autovacuum.c:2468
error: src/backend/postmaster/autovacuum.c: patch does not apply
Marked "Waiting on Author".
I'd really like to see the rest of the renames happen for v10. It seems
like the process got stalled after the pg_wal rename.
--
-David
david@pgmasters.net
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Mar 17, 2017 at 12:19 AM, David Steele <david@pgmasters.net> wrote:
This patch does not apply cleanly at cccbdde:
$ git apply ../other/0001-Rename-pg_clog-to-pg_xact.patch
error: doc/src/sgml/ref/pg_resetxlog.sgml: No such file or directory
error: patch failed: src/backend/postmaster/autovacuum.c:2468
error: src/backend/postmaster/autovacuum.c: patch does not apply
This has rotten again...
Marked "Waiting on Author".
I'd really like to see the rest of the renames happen for v10. It seems
like the process got stalled after the pg_wal rename.
Let's see what happens, attached are refreshed versions. Uncertainty
is the fun part of a CF.
--
Michael
Attachments:
0002-Rename-pg_subtrans-to-pg_subxact.patchapplication/octet-stream; name=0002-Rename-pg_subtrans-to-pg_subxact.patchDownload
From a6862702688e7af46223bd58504e8466cb0bb994 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 17 Mar 2017 10:25:58 +0900
Subject: [PATCH 2/2] Rename pg_subtrans to pg_subxact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/protocol.sgml | 2 +-
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/transam/README | 18 +++++++++---------
src/backend/access/transam/subtrans.c | 8 ++++----
src/backend/access/transam/transam.c | 10 +++++-----
src/backend/access/transam/twophase.c | 6 +++---
src/backend/access/transam/varsup.c | 6 +++---
src/backend/access/transam/xact.c | 2 +-
src/backend/access/transam/xlog.c | 8 ++++----
src/backend/replication/basebackup.c | 2 +-
src/backend/replication/logical/snapbuild.c | 2 +-
src/backend/storage/ipc/procarray.c | 14 +++++++-------
src/backend/utils/time/tqual.c | 2 +-
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 2 +-
src/bin/pg_upgrade/exec.c | 7 ++++++-
src/include/access/slru.h | 4 ++--
src/include/storage/proc.h | 2 +-
21 files changed, 55 insertions(+), 50 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 12f2efe4e2..1853ab5fe4 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -1094,7 +1094,7 @@ SELECT pg_stop_backup();
The contents of the directories <filename>pg_dynshmem/</>,
<filename>pg_notify/</>, <filename>pg_serial/</>,
<filename>pg_snapshots/</>, <filename>pg_stat_tmp/</>,
- and <filename>pg_subtrans/</> (but not the directories themselves) can be
+ and <filename>pg_subxact/</> (but not the directories themselves) can be
omitted from the backup as they will be initialized on postmaster startup.
If <xref linkend="guc-stats-temp-directory"> is set and is under the data
directory then the contents of that directory can also be omitted.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 9408a255dc..e329f83ae4 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15623,7 +15623,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
pg_wal | 16
pg_hba.conf | 17
pg_stat_tmp | 18
- pg_subtrans | 19
+ pg_subxact | 19
(19 rows)
</programlisting>
</para>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 7c82b48845..98ce89a82d 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -2215,7 +2215,7 @@ The commands accepted in walsender mode are:
<filename>pg_dynshmem</>, <filename>pg_notify</>,
<filename>pg_replslot</>, <filename>pg_serial</>,
<filename>pg_snapshots</>, <filename>pg_stat_tmp</>, and
- <filename>pg_subtrans</> are copied as empty directories (even if
+ <filename>pg_subxact</> are copied as empty directories (even if
they are symbolic links).
</para>
</listitem>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index a156693ec8..686ce07440 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -127,7 +127,7 @@ Item
</row>
<row>
- <entry><filename>pg_subtrans</></entry>
+ <entry><filename>pg_subxact</></entry>
<entry>Subdirectory containing subtransaction status data</entry>
</row>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index a749b83dc0..3c5fa0876e 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subxact</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index e7dd19fd7b..94553f1f15 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -198,7 +198,7 @@ parent. This maintains the invariant that child transactions have XIDs later
than their parents, which is assumed in a number of places.
The subsidiary actions of obtaining a lock on the XID and entering it into
-pg_subtrans and PG_PROC are done at the time it is assigned.
+pg_subxact and PG_PROC are done at the time it is assigned.
A transaction that has no XID still needs to be identified for various
purposes, notably holding locks. For this purpose we assign a "virtual
@@ -331,10 +331,10 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_xact and pg_subtrans
+pg_xact and pg_subxact
-----------------------
-pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subxact are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
@@ -367,24 +367,24 @@ allow unlimited transaction nesting depth, so any particular subtransaction's
commit state is dependent on the commit status of each and every ancestor
transaction.
-The "subtransaction parent" (pg_subtrans) mechanism records, for each
+The "subtransaction parent" (pg_subxact) mechanism records, for each
transaction with an XID, the TransactionId of its parent transaction. This
information is stored as soon as the subtransaction is assigned an XID.
-Top-level transactions do not have a parent, so they leave their pg_subtrans
+Top-level transactions do not have a parent, so they leave their pg_subxact
entries set to the default value of zero (InvalidTransactionId).
-pg_subtrans is used to check whether the transaction in question is still
+pg_subxact is used to check whether the transaction in question is still
running --- the main Xid of a transaction is recorded in the PGXACT struct,
but since we allow arbitrary nesting of subtransactions, we can't fit all Xids
in shared memory, so we have to store them on disk. Note, however, that for
each transaction we keep a "cache" of Xids that are known to be part of the
-transaction tree, so we can skip looking at pg_subtrans unless we know the
+transaction tree, so we can skip looking at pg_subxact unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subxact. It
implements the LRU policy for in-memory buffer pages. The high-level routines
for pg_xact are implemented in transam.c, while the low-level functions are in
-clog.c. pg_subtrans is contained completely in subtrans.c.
+clog.c. pg_subxact is contained completely in subtrans.c.
Write-Ahead Log Coding
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 70828e5170..3c535b0645 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,7 +3,7 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_xact-like manager that stores the parent
+ * The pg_subxact manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
@@ -11,7 +11,7 @@
* opposite direction.
*
* are completely different from pg_xact, because we only need to remember
- * pg_subtrans information for currently-open transactions. Thus, there is
+ * pg_subxact information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
* There are no XLOG interactions since we do not care about preserving
@@ -179,7 +179,7 @@ SUBTRANSShmemInit(void)
{
SubTransCtl->PagePrecedes = SubTransPagePrecedes;
SimpleLruInit(SubTransCtl, "subtrans", NUM_SUBTRANS_BUFFERS, 0,
- SubtransControlLock, "pg_subtrans",
+ SubtransControlLock, "pg_subxact",
LWTRANCHE_SUBTRANS_BUFFERS);
/* Override default assumption that writes should be fsync'd */
SubTransCtl->do_fsync = false;
@@ -240,7 +240,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
int endPage;
/*
- * Since we don't expect pg_subtrans to be valid across crashes, we
+ * Since we don't expect pg_subxact to be valid across crashes, we
* initialize the currently-active page(s) to zeroes during startup.
* Whenever we advance into a new page, ExtendSUBTRANS will likewise zero
* the new page without regard to whatever was previously on disk.
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index b91a259e80..066a0a4800 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -137,13 +137,13 @@ TransactionIdDidCommit(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*
* Originally we Assert'ed that the result of SubTransGetParent was not
* zero. However with the introduction of prepared transactions, there can
* be a window just after database startup where we do not have complete
- * knowledge in pg_subtrans of the transactions after TransactionXmin.
+ * knowledge in pg_subxact of the transactions after TransactionXmin.
* StartupSUBTRANS() has ensured that any missing information will be
* zeroed. Since this case should not happen under normal conditions, it
* seems reasonable to emit a WARNING for it.
@@ -157,7 +157,7 @@ TransactionIdDidCommit(TransactionId transactionId)
parentXid = SubTransGetParent(transactionId);
if (!TransactionIdIsValid(parentXid))
{
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return false;
}
@@ -193,7 +193,7 @@ TransactionIdDidAbort(TransactionId transactionId)
/*
* If it's marked subcommitted, we have to check the parent recursively.
* However, if it's older than TransactionXmin, we can't look at
- * pg_subtrans; instead assume that the parent crashed without cleaning up
+ * pg_subxact; instead assume that the parent crashed without cleaning up
* its children.
*/
if (xidstatus == TRANSACTION_STATUS_SUB_COMMITTED)
@@ -206,7 +206,7 @@ TransactionIdDidAbort(TransactionId transactionId)
if (!TransactionIdIsValid(parentXid))
{
/* see notes in TransactionIdDidCommit */
- elog(WARNING, "no pg_subtrans entry for subcommitted XID %u",
+ elog(WARNING, "no pg_subxact entry for subcommitted XID %u",
transactionId);
return true;
}
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index da77e3efde..751423f86c 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1674,7 +1674,7 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
*
* Our other responsibility is to determine and return the oldest valid XID
* among the prepared xacts (if none, return ShmemVariableCache->nextXid).
- * This is needed to synchronize pg_subtrans startup properly.
+ * This is needed to synchronize pg_subxact startup properly.
*
* If xids_p and nxids_p are not NULL, pointer to a palloc'd array of all
* top-level xids is stored in *xids_p. The number of entries in the array
@@ -1819,7 +1819,7 @@ PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
*
* Currently we simply call SubTransSetParent() for any subxids of prepared
* transactions. If overwriteOK is true, it's OK if some XIDs have already
- * been marked in pg_subtrans.
+ * been marked in pg_subxact.
*/
void
StandbyRecoverPreparedTransactions(bool overwriteOK)
@@ -1976,7 +1976,7 @@ RecoverPreparedTransactions(void)
/*
* Reconstruct subtrans state for the transaction --- needed
- * because pg_subtrans is not preserved over a restart. Note that
+ * because pg_subxact is not preserved over a restart. Note that
* we are linking all the subtransactions directly to the
* top-level XID; there may originally have been a more complex
* hierarchy, but there's no need to restore that exactly.
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 42fc351f7b..5be2c79b95 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -166,7 +166,7 @@ GetNewTransactionId(bool isSubXact)
* XID before we zero the page. Fortunately, a page of the commit log
* holds 32K or more transactions, so we don't have to do this very often.
*
- * Extend pg_subtrans and pg_commit_ts too.
+ * Extend pg_subxact and pg_commit_ts too.
*/
ExtendCLOG(xid);
ExtendCommitTs(xid);
@@ -203,9 +203,9 @@ GetNewTransactionId(bool isSubXact)
*
* If there's no room to fit a subtransaction XID into PGPROC, set the
* cache-overflowed flag instead. This forces readers to look in
- * pg_subtrans to map subtransaction XIDs up to top-level XIDs. There is a
+ * pg_subxact to map subtransaction XIDs up to top-level XIDs. There is a
* race-condition window, in that the new XID will not appear as running
- * until its parent link has been placed into pg_subtrans. However, that
+ * until its parent link has been placed into pg_subxact. However, that
* will happen before anyone could possibly have a reason to inquire about
* the status of the XID, so it seems OK. (Snapshots taken during this
* window *will* include the parent XID, so they will deliver the correct
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 02e0779f32..2a13e4f1c5 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -546,7 +546,7 @@ AssignTransactionId(TransactionState s)
log_unknown_top = true;
/*
- * Generate a new Xid and record it in PG_PROC and pg_subtrans.
+ * Generate a new Xid and record it in PG_PROC and pg_subxact.
*
* NB: we must make the subtrans entry BEFORE the Xid appears anywhere in
* shared storage other than PG_PROC; because if there's no room for it in
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index cdb3a8ac1d..df217e2bf0 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8862,9 +8862,9 @@ CreateCheckPoint(int flags)
PreallocXlogFiles(recptr);
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). During recovery, though, we mustn't do this because
* StartupSUBTRANS hasn't been called yet.
*/
@@ -9225,9 +9225,9 @@ CreateRestartPoint(int flags)
}
/*
- * Truncate pg_subtrans if possible. We can throw away all data before
+ * Truncate pg_subxact if possible. We can throw away all data before
* the oldest XMIN of any running transaction. No future transaction will
- * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * attempt to reference any pg_subxact entry older than that (see Asserts
* in subtrans.c). When hot standby is disabled, though, we mustn't do
* this because StartupSUBTRANS hasn't been called yet.
*/
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index e3a7ad5e9a..edf932e25f 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -134,7 +134,7 @@ static const char *excludeDirContents[] =
"pg_snapshots",
/* Contents zeroed on startup, see StartupSUBTRANS(). */
- "pg_subtrans",
+ "pg_subxact",
/* end of list */
NULL
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index e129a6b8e4..654490caa3 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -20,7 +20,7 @@
* tables since the data we decode is wholly contained in the WAL
* records. Also, our snapshots need to be different in comparison to normal
* MVCC ones because in contrast to those we cannot fully rely on the clog and
- * pg_subtrans for information about committed transactions because they might
+ * pg_subxact for information about committed transactions because they might
* commit in the future from the POV of the WAL entry we're currently
* decoding. This definition has the advantage that we only need to prevent
* removal of catalog rows, while normal table's rows can still be
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 0f8f435faf..c754f758e4 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -929,7 +929,7 @@ ProcArrayApplyXidAssignment(TransactionId topxid,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Notice that we update pg_subtrans with the top-level xid, rather than
+ * Notice that we update pg_subxact with the top-level xid, rather than
* the parent xid. This is a difference between normal processing and
* recovery, yet is still correct in all cases. The reason is that
* subtransaction commit is not marked in clog until commit processing, so
@@ -1146,7 +1146,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * If the KnownAssignedXids overflowed, we have to check pg_subtrans
+ * If the KnownAssignedXids overflowed, we have to check pg_subxact
* too. Fetch all xids from KnownAssignedXids that are lower than
* xid, since if xid is a subtransaction its parent will always have a
* lower value. Note we will collect both main and subXIDs here, but
@@ -1160,7 +1160,7 @@ TransactionIdIsInProgress(TransactionId xid)
/*
* If none of the relevant caches overflowed, we know the Xid is not
- * running without even looking at pg_subtrans.
+ * running without even looking at pg_subxact.
*/
if (nxids == 0)
{
@@ -1169,7 +1169,7 @@ TransactionIdIsInProgress(TransactionId xid)
}
/*
- * Step 4: have to check pg_subtrans.
+ * Step 4: have to check pg_subxact.
*
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
@@ -1270,7 +1270,7 @@ TransactionIdIsActive(TransactionId xid)
* ignore concurrently running lazy VACUUMs because (a) they must be working
* on other tables, and (b) they don't need to do snapshot-based lookups.
*
- * This is also used to determine where to truncate pg_subtrans. For that
+ * This is also used to determine where to truncate pg_subxact. For that
* backends in all databases have to be considered, so rel = NULL has to be
* passed in.
*
@@ -3109,14 +3109,14 @@ DisplayXidCache(void)
* KnownAssignedXids list. In backends, this is copied into snapshots in
* GetSnapshotData(), taking advantage of the fact that XidInMVCCSnapshot()
* doesn't care about the distinction either. Subtransaction XIDs are
- * effectively treated as top-level XIDs and in the typical case pg_subtrans
+ * effectively treated as top-level XIDs and in the typical case pg_subxact
* links are *not* maintained (which does not affect visibility).
*
* We have room in KnownAssignedXids and in snapshots to hold maxProcs *
* (1 + PGPROC_MAX_CACHED_SUBXIDS) XIDs, so every master transaction must
* report its subtransaction XIDs in a WAL XLOG_XACT_ASSIGNMENT record at
* least every PGPROC_MAX_CACHED_SUBXIDS. When we receive one of these
- * records, we mark the subXIDs as children of the top XID in pg_subtrans,
+ * records, we mark the subXIDs as children of the top XID in pg_subxact,
* and then remove them from KnownAssignedXids. This prevents overflow of
* KnownAssignedXids and snapshots, at the cost that status checks for these
* subXIDs will take a slower path through TransactionIdIsInProgress().
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 519f3b6803..d72a8b9773 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -1490,7 +1490,7 @@ XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
* If the snapshot contains full subxact data, the fastest way to
* check things is just to compare the given XID against both subxact
* XIDs and top-level XIDs. If the snapshot overflowed, we have to
- * use pg_subtrans to convert a subxact XID to its parent XID, but
+ * use pg_subxact to convert a subxact XID to its parent XID, but
* then we need only look at top-level XIDs not subxacts.
*/
if (!snapshot->suboverflowed)
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e0c72fbb80..c11b3b3cb8 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -202,7 +202,7 @@ static const char *const subdirs[] = {
"pg_notify",
"pg_serial",
"pg_snapshots",
- "pg_subtrans",
+ "pg_subxact",
"pg_twophase",
"pg_multixact",
"pg_multixact/members",
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 14bd813896..4e59c7e223 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -71,7 +71,7 @@ is_deeply(
'no WAL files copied');
# Contents of these directories should not be copied.
-foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subtrans))
+foreach my $dirname (qw(pg_dynshmem pg_notify pg_replslot pg_serial pg_snapshots pg_stat_tmp pg_subxact))
{
is_deeply(
[ sort(slurp_dir("$tempdir/backup/$dirname/")) ],
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index b954d19d9d..c6a6d11aeb 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -334,7 +334,6 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "base");
check_single_dir(pg_data, "global");
check_single_dir(pg_data, "pg_multixact");
- check_single_dir(pg_data, "pg_subtrans");
check_single_dir(pg_data, "pg_tblspc");
check_single_dir(pg_data, "pg_twophase");
@@ -349,6 +348,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_clog");
else
check_single_dir(pg_data, "pg_xact");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_subtrans");
+ else
+ check_single_dir(pg_data, "pg_subxact");
}
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index 722867d5d2..d28c768dbc 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subxact, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -120,7 +120,7 @@ typedef struct SlruCtlData
/*
* This flag tells whether to fsync writes (true for pg_xact and multixact
- * stuff, false for pg_subtrans and pg_notify).
+ * stuff, false for pg_subxact and pg_notify).
*/
bool do_fsync;
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 5f38fa6b4f..7929a71a7e 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -30,7 +30,7 @@
* generated at least one subtransaction that didn't fit in the cache).
* If none of the caches have overflowed, we can assume that an XID that's not
* listed anywhere in the PGPROC array is not a running transaction. Else we
- * have to look at pg_subtrans.
+ * have to look at pg_subxact.
*/
#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
--
2.12.0
0001-Rename-pg_clog-to-pg_xact.patchapplication/octet-stream; name=0001-Rename-pg_clog-to-pg_xact.patchDownload
From 9c9a05d14852b1750a18cf6c601305ec59d5c213 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 17 Mar 2017 10:24:38 +0900
Subject: [PATCH 1/2] Rename pg_clog to pg_xact
pg_upgrade is updated to handle the transfer correctly to post-10
clusters.
---
doc/src/sgml/backup.sgml | 4 ++--
doc/src/sgml/catalogs.sgml | 4 ++--
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/func.sgml | 2 +-
doc/src/sgml/maintenance.sgml | 8 ++++----
doc/src/sgml/ref/pg_resetwal.sgml | 4 ++--
doc/src/sgml/ref/pg_rewind.sgml | 2 +-
doc/src/sgml/storage.sgml | 10 +++++-----
doc/src/sgml/wal.sgml | 2 +-
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/README | 10 +++++-----
src/backend/access/transam/clog.c | 2 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/subtrans.c | 5 ++---
src/backend/access/transam/transam.c | 2 +-
src/backend/access/transam/twophase.c | 4 ++--
src/backend/access/transam/xact.c | 18 +++++++++---------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/vacuum.c | 10 +++++-----
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/storage/buffer/README | 2 +-
src/backend/storage/ipc/procarray.c | 4 ++--
src/backend/utils/time/tqual.c | 6 +++---
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_upgrade/exec.c | 6 ++++++
src/bin/pg_upgrade/pg_upgrade.c | 30 ++++++++++++++++++------------
src/include/access/slru.h | 4 ++--
28 files changed, 83 insertions(+), 72 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 69c599e180..12f2efe4e2 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -382,10 +382,10 @@ tar -cf backup.tar /usr/local/pgsql/data
directories. This will <emphasis>not</> work because the
information contained in these files is not usable without
the commit log files,
- <filename>pg_clog/*</filename>, which contain the commit status of
+ <filename>pg_xact/*</filename>, which contain the commit status of
all transactions. A table file is only usable with this
information. Of course it is also impossible to restore only a
- table and the associated <filename>pg_clog</filename> data
+ table and the associated <filename>pg_xact</filename> data
because that would render all other tables in the database
cluster useless. So file system backups only work for complete
backup and restoration of an entire database cluster.
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 2c2da2ad8a..df0435c3f0 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1893,7 +1893,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this table. This is used to track
whether the table needs to be vacuumed in order to prevent transaction
- ID wraparound or to allow <literal>pg_clog</> to be shrunk. Zero
+ ID wraparound or to allow <literal>pg_xact</> to be shrunk. Zero
(<symbol>InvalidTransactionId</symbol>) if the relation is not a table.
</entry>
</row>
@@ -2570,7 +2570,7 @@
All transaction IDs before this one have been replaced with a permanent
(<quote>frozen</>) transaction ID in this database. This is used to
track whether the database needs to be vacuumed in order to prevent
- transaction ID wraparound or to allow <literal>pg_clog</> to be shrunk.
+ transaction ID wraparound or to allow <literal>pg_xact</> to be shrunk.
It is the minimum of the per-table
<structname>pg_class</>.<structfield>relfrozenxid</> values.
</entry>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index b6daf9677c..9963cd61a1 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -6004,7 +6004,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Vacuum also allows removal of old files from the
- <filename>pg_clog</> subdirectory, which is why the default
+ <filename>pg_xact</> subdirectory, which is why the default
is a relatively low 200 million transactions.
This parameter can only be set at server start, but the setting
can be reduced for individual tables by
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 502f99b22b..9408a255dc 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15616,7 +15616,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
postmaster.pid | 9
pg_ident.conf | 10
global | 11
- pg_clog | 12
+ pg_xact | 12
pg_snapshots | 13
pg_multixact | 14
PG_VERSION | 15
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index f87f3e00de..65a64c85ec 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -527,18 +527,18 @@
<para>
The sole disadvantage of increasing <varname>autovacuum_freeze_max_age</>
(and <varname>vacuum_freeze_table_age</> along with it)
- is that the <filename>pg_clog</> subdirectory of the database cluster
+ is that the <filename>pg_xact</> subdirectory of the database cluster
will take more space, because it must store the commit status of all
transactions back to the <varname>autovacuum_freeze_max_age</> horizon.
The commit status uses two bits per transaction, so if
<varname>autovacuum_freeze_max_age</> is set to its maximum allowed
- value of two billion, <filename>pg_clog</> can be expected to
+ value of two billion, <filename>pg_xact</> can be expected to
grow to about half a gigabyte. If this is trivial compared to your
total database size, setting <varname>autovacuum_freeze_max_age</> to
its maximum allowed value is recommended. Otherwise, set it depending
- on what you are willing to allow for <filename>pg_clog</> storage.
+ on what you are willing to allow for <filename>pg_xact</> storage.
(The default, 200 million transactions, translates to about 50MB of
- <filename>pg_clog</> storage.)
+ <filename>pg_xact</> storage.)
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_resetwal.sgml b/doc/src/sgml/ref/pg_resetwal.sgml
index 0cc6fb4c4d..0d93b56ddd 100644
--- a/doc/src/sgml/ref/pg_resetwal.sgml
+++ b/doc/src/sgml/ref/pg_resetwal.sgml
@@ -256,12 +256,12 @@ PostgreSQL documentation
<para>
A safe value can be determined by looking for the numerically largest
- file name in the directory <filename>pg_clog</> under the data directory,
+ file name in the directory <filename>pg_xact</> under the data directory,
adding one,
and then multiplying by 1048576 (0x100000). Note that the file names are in
hexadecimal. It is usually easiest to specify the option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
- in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
+ in <filename>pg_xact</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</para>
</listitem>
diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml
index 371c4a475f..d5430d4324 100644
--- a/doc/src/sgml/ref/pg_rewind.sgml
+++ b/doc/src/sgml/ref/pg_rewind.sgml
@@ -229,7 +229,7 @@ PostgreSQL documentation
</step>
<step>
<para>
- Copy all other files such as <filename>pg_clog</filename> and
+ Copy all other files such as <filename>pg_xact</filename> and
configuration files from the source cluster to the target cluster
(everything except the relation files).
</para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index e0a89861f8..a156693ec8 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -78,11 +78,6 @@ Item
</row>
<row>
- <entry><filename>pg_clog</></entry>
- <entry>Subdirectory containing transaction commit status data</entry>
-</row>
-
-<row>
<entry><filename>pg_dynshmem</></entry>
<entry>Subdirectory containing files used by the dynamic shared memory
subsystem</entry>
@@ -152,6 +147,11 @@ Item
</row>
<row>
+ <entry><filename>pg_xact</></entry>
+ <entry>Subdirectory containing transaction commit status data</entry>
+</row>
+
+<row>
<entry><filename>postgresql.auto.conf</></entry>
<entry>A file used for storing configuration parameters that are set by
<command>ALTER SYSTEM</command></entry>
diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml
index 1468ba52a4..a749b83dc0 100644
--- a/doc/src/sgml/wal.sgml
+++ b/doc/src/sgml/wal.sgml
@@ -201,7 +201,7 @@
</listitem>
<listitem>
<para>
- Internal data structures such as <filename>pg_clog</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
+ Internal data structures such as <filename>pg_xact</filename>, <filename>pg_subtrans</filename>, <filename>pg_multixact</filename>,
<filename>pg_serial</filename>, <filename>pg_notify</filename>, <filename>pg_stat</filename>, <filename>pg_snapshots</filename> are not directly
checksummed, nor are pages protected by full page writes. However, where
such data structures are persistent, WAL records are written that allow
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index bffc971d68..85261379b1 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6790,8 +6790,8 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
* Note: it might seem we could make the changes without exclusive lock, since
* TransactionId read/write is assumed atomic anyway. However there is a race
* condition: someone who just fetched an old XID that we overwrite here could
- * conceivably not finish checking the XID against pg_clog before we finish
- * the VACUUM and perhaps truncate off the part of pg_clog he needs. Getting
+ * conceivably not finish checking the XID against pg_xact before we finish
+ * the VACUUM and perhaps truncate off the part of pg_xact he needs. Getting
* exclusive lock ensures no other backend is in process of checking the
* tuple status. Also, getting exclusive lock makes it safe to adjust the
* infomask bits.
diff --git a/src/backend/access/transam/README b/src/backend/access/transam/README
index 4ae4715339..e7dd19fd7b 100644
--- a/src/backend/access/transam/README
+++ b/src/backend/access/transam/README
@@ -331,17 +331,17 @@ of the xid fields is atomic, so assuming it for xmin as well is no extra
risk.
-pg_clog and pg_subtrans
+pg_xact and pg_subtrans
-----------------------
-pg_clog and pg_subtrans are permanent (on-disk) storage of transaction related
+pg_xact and pg_subtrans are permanent (on-disk) storage of transaction related
information. There is a limited number of pages of each kept in memory, so
in many cases there is no need to actually read from disk. However, if
there's a long running transaction or a backend sitting idle with an open
transaction, it may be necessary to be able to read and write this information
from disk. They also allow information to be permanent across server restarts.
-pg_clog records the commit status for each transaction that has been assigned
+pg_xact records the commit status for each transaction that has been assigned
an XID. A transaction can be in progress, committed, aborted, or
"sub-committed". This last state means that it's a subtransaction that's no
longer running, but its parent has not updated its state yet. It is not
@@ -381,9 +381,9 @@ each transaction we keep a "cache" of Xids that are known to be part of the
transaction tree, so we can skip looking at pg_subtrans unless we know the
cache has been overflowed. See storage/ipc/procarray.c for the gory details.
-slru.c is the supporting mechanism for both pg_clog and pg_subtrans. It
+slru.c is the supporting mechanism for both pg_xact and pg_subtrans. It
implements the LRU policy for in-memory buffer pages. The high-level routines
-for pg_clog are implemented in transam.c, while the low-level functions are in
+for pg_xact are implemented in transam.c, while the low-level functions are in
clog.c. pg_subtrans is contained completely in subtrans.c.
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 1a43819736..5b1d13dac1 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -450,7 +450,7 @@ CLOGShmemInit(void)
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "clog", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
- CLogControlLock, "pg_clog", LWTRANCHE_CLOG_BUFFERS);
+ CLogControlLock, "pg_xact", LWTRANCHE_CLOG_BUFFERS);
}
/*
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 20f60bc023..8e1df6e0ea 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -3,7 +3,7 @@
* commit_ts.c
* PostgreSQL commit timestamp manager
*
- * This module is a pg_clog-like system that stores the commit timestamp
+ * This module is a pg_xact-like system that stores the commit timestamp
* for each transaction.
*
* XLOG interactions: this module generates an XLOG record whenever a new
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index c350dfa17f..1a7824b5d4 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3,7 +3,7 @@
* multixact.c
* PostgreSQL multi-transaction-log manager
*
- * The pg_multixact manager is a pg_clog-like manager that stores an array of
+ * The pg_multixact manager is a pg_xact-like manager that stores an array of
* MultiXactMember for each MultiXactId. It is a fundamental part of the
* shared-row-lock implementation. Each MultiXactMember is comprised of a
* TransactionId and a set of flag bits. The name is a bit historical:
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index a66fc0f2ad..70828e5170 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -3,15 +3,14 @@
* subtrans.c
* PostgreSQL subtransaction-log manager
*
- * The pg_subtrans manager is a pg_clog-like manager that stores the parent
+ * The pg_subtrans manager is a pg_xact-like manager that stores the parent
* transaction Id for each transaction. It is a fundamental part of the
* nested transactions implementation. A main transaction has a parent
* of InvalidTransactionId, and each subtransaction has its immediate parent.
* The tree can easily be walked from child to parent, but not in the
* opposite direction.
*
- * This code is based on clog.c, but the robustness requirements
- * are completely different from pg_clog, because we only need to remember
+ * are completely different from pg_xact, because we only need to remember
* pg_subtrans information for currently-open transactions. Thus, there is
* no need to preserve data over a crash and restart.
*
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index c2b4318bd3..b91a259e80 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -224,7 +224,7 @@ TransactionIdDidAbort(TransactionId transactionId)
* True iff transaction associated with the identifier is currently
* known to have either committed or aborted.
*
- * This does NOT look into pg_clog but merely probes our local cache
+ * This does NOT look into pg_xact but merely probes our local cache
* (and so it's not named TransactionIdDidComplete, which would be the
* appropriate name for a function that worked that way). The intended
* use is just to short-circuit TransactionIdIsInProgress calls when doing
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 83ca6e0408..da77e3efde 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1379,7 +1379,7 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
/*
* The order of operations here is critical: make the XLOG entry for
* commit or abort, then mark the transaction committed or aborted in
- * pg_clog, then remove its PGPROC from the global ProcArray (which means
+ * pg_xact, then remove its PGPROC from the global ProcArray (which means
* TransactionIdIsInProgress will stop saying the prepared xact is in
* progress), then run the post-commit or post-abort callbacks. The
* callbacks will release the locks the transaction held.
@@ -2093,7 +2093,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
- /* Mark the transaction committed in pg_clog */
+ /* Mark the transaction committed in pg_xact */
TransactionIdCommitTree(xid, nchildren, children);
/* Checkpoint can proceed now */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 82f9a3c5c6..02e0779f32 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1208,8 +1208,8 @@ RecordTransactionCommit(void)
/*
* Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to set
- * REDO after the XLOG record but fail to flush the pg_clog update to
+ * pg_xact. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_xact update to
* disk, leading to loss of the transaction commit if the system
* crashes a little later.
*
@@ -2035,7 +2035,7 @@ CommitTransaction(void)
if (!is_parallel_worker)
{
/*
- * We need to mark our XIDs as committed in pg_clog. This is where we
+ * We need to mark our XIDs as committed in pg_xact. This is where we
* durably commit.
*/
latestXid = RecordTransactionCommit();
@@ -2545,7 +2545,7 @@ AbortTransaction(void)
AtAbort_Twophase();
/*
- * Advertise the fact that we aborted in pg_clog (assuming that we got as
+ * Advertise the fact that we aborted in pg_xact (assuming that we got as
* far as assigning an XID to advertise). But if we're inside a parallel
* worker, skip this; the user backend must be the one to write the abort
* record.
@@ -4631,7 +4631,7 @@ AbortSubTransaction(void)
s->parent->subTransactionId);
AtSubAbort_Notify();
- /* Advertise the fact that we aborted in pg_clog. */
+ /* Advertise the fact that we aborted in pg_xact. */
(void) RecordTransactionAbort(true);
/* Post-abort cleanup */
@@ -5375,7 +5375,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
if (standbyState == STANDBY_DISABLED)
{
/*
- * Mark the transaction committed in pg_clog.
+ * Mark the transaction committed in pg_xact.
*/
TransactionIdCommitTree(xid, parsed->nsubxacts, parsed->subxacts);
}
@@ -5393,7 +5393,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
RecordKnownAssignedTransactionIds(max_xid);
/*
- * Mark the transaction committed in pg_clog. We use async commit
+ * Mark the transaction committed in pg_xact. We use async commit
* protocol during recovery to provide information on database
* consistency for when users try to set hint bits. It is important
* that we do not set hint bits until the minRecoveryPoint is past
@@ -5530,7 +5530,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
if (standbyState == STANDBY_DISABLED)
{
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
}
else
@@ -5546,7 +5546,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
*/
RecordKnownAssignedTransactionIds(max_xid);
- /* Mark the transaction aborted in pg_clog, no need for async stuff */
+ /* Mark the transaction aborted in pg_xact, no need for async stuff */
TransactionIdAbortTree(xid, parsed->nsubxacts, parsed->subxacts);
/*
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 64335f909e..cdb3a8ac1d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8710,7 +8710,7 @@ CreateCheckPoint(int flags)
* that are currently in commit critical sections. If an xact inserted
* its commit record into XLOG just before the REDO point, then a crash
* restart from the REDO point would not replay that record, which means
- * that our flushing had better include the xact's update of pg_clog. So
+ * that our flushing had better include the xact's update of pg_xact. So
* we wait till he's out of his commit critical section before proceeding.
* See notes in RecordTransactionCommit().
*
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 3b3dfeead4..ff633faca6 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -357,7 +357,7 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params,
if ((options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
{
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible.
* (autovacuum.c does this for itself.)
*/
vac_update_datfrozenxid();
@@ -910,7 +910,7 @@ vac_update_relstats(Relation relation,
* pg_class.relminmxid values.
*
* If we are able to advance either pg_database value, also try to
- * truncate pg_clog and pg_multixact.
+ * truncate pg_xact and pg_multixact.
*
* We violate transaction semantics here by overwriting the database's
* existing pg_database tuple with the new values. This is reasonably
@@ -1056,7 +1056,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
- * truncate pg_clog and/or pg_multixact. Also do it if the shared
+ * truncate pg_xact and/or pg_multixact. Also do it if the shared
* XID-wrap-limit info is stale, since this action will update that too.
*/
if (dirty || ForceTransactionIdLimitUpdate())
@@ -1069,7 +1069,7 @@ vac_update_datfrozenxid(void)
* vac_truncate_clog() -- attempt to truncate the commit log
*
* Scan pg_database to determine the system-wide oldest datfrozenxid,
- * and use it to truncate the transaction commit log (pg_clog).
+ * and use it to truncate the transaction commit log (pg_xact).
* Also update the XID wrap limit info maintained by varsup.c.
* Likewise for datminmxid.
*
@@ -1116,7 +1116,7 @@ vac_truncate_clog(TransactionId frozenXID,
* of the interlock against copying a DB containing an active backend.
* Hence the new entry will not reduce the minimum. Also, if two VACUUMs
* concurrently modify the datfrozenxid's of different databases, the
- * worst possible outcome is that pg_clog is not truncated as aggressively
+ * worst possible outcome is that pg_xact is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index fa8de1390e..33ca749b52 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2472,7 +2472,7 @@ deleted:
*/
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * Update pg_database.datfrozenxid, and truncate pg_xact if possible. We
* only need to do this once, not after each table.
*
* Even if we didn't vacuum anything, it may still be important to do
diff --git a/src/backend/storage/buffer/README b/src/backend/storage/buffer/README
index 248883f0da..bc80777bb1 100644
--- a/src/backend/storage/buffer/README
+++ b/src/backend/storage/buffer/README
@@ -63,7 +63,7 @@ at about the same time would OR the same bits into the field, so there
is little or no risk of conflicting update; what's more, if there did
manage to be a conflict it would merely mean that one bit-update would
be lost and need to be done again later. These four bits are only hints
-(they cache the results of transaction status lookups in pg_clog), so no
+(they cache the results of transaction status lookups in pg_xact), so no
great harm is done if they get reset to zero by conflicting updates.
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index c724a0e952..0f8f435faf 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -381,7 +381,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
* ProcArrayEndTransaction -- mark a transaction as no longer running
*
* This is used interchangeably for commit and abort cases. The transaction
- * commit/abort must already be reported to WAL and pg_clog.
+ * commit/abort must already be reported to WAL and pg_xact.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
* latestXid is the latest Xid among the transaction's main XID and
@@ -1174,7 +1174,7 @@ TransactionIdIsInProgress(TransactionId xid)
* At this point, we know it's either a subtransaction of one of the Xids
* in xids[], or it's not running. If it's an already-failed
* subtransaction, we want to say "not running" even though its parent may
- * still be running. So first, check pg_clog to see if it's been aborted.
+ * still be running. So first, check pg_xact to see if it's been aborted.
*/
xc_slow_answer_inc();
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 703bdcedaf..519f3b6803 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -13,9 +13,9 @@
* NOTE: When using a non-MVCC snapshot, we must check
* TransactionIdIsInProgress (which looks in the PGXACT array)
* before TransactionIdDidCommit/TransactionIdDidAbort (which look in
- * pg_clog). Otherwise we have a race condition: we might decide that a
+ * pg_xact). Otherwise we have a race condition: we might decide that a
* just-committed transaction crashed, because none of the tests succeed.
- * xact.c is careful to record commit/abort in pg_clog before it unsets
+ * xact.c is careful to record commit/abort in pg_xact before it unsets
* MyPgXact->xid in the PGXACT array. That fixes that problem, but it
* also means there is a window where TransactionIdIsInProgress and
* TransactionIdDidCommit will both return true. If we check only
@@ -29,7 +29,7 @@
*
* When using an MVCC snapshot, we rely on XidInMVCCSnapshot rather than
* TransactionIdIsInProgress, but the logic is otherwise the same: do not
- * check pg_clog until after deciding that the xact is no longer in progress.
+ * check pg_xact until after deciding that the xact is no longer in progress.
*
*
* Summary of visibility functions:
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 9b71e0042d..e0c72fbb80 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -197,7 +197,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char *const subdirs[] = {
"global",
"pg_wal/archive_status",
- "pg_clog",
"pg_commit_ts",
"pg_dynshmem",
"pg_notify",
@@ -214,6 +213,7 @@ static const char *const subdirs[] = {
"pg_tblspc",
"pg_stat",
"pg_stat_tmp",
+ "pg_xact",
"pg_logical",
"pg_logical/snapshots",
"pg_logical/mappings"
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index 91fa71728e..b954d19d9d 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -343,6 +343,12 @@ check_data_dir(ClusterInfo *cluster)
check_single_dir(pg_data, "pg_xlog");
else
check_single_dir(pg_data, "pg_wal");
+
+ /* pg_clog has been renamed to pg_xact in post-10 cluster */
+ if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
+ check_single_dir(pg_data, "pg_clog");
+ else
+ check_single_dir(pg_data, "pg_xact");
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index fc66d93dd6..ca1aa5cbb8 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -48,7 +48,7 @@
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
-static void copy_clog_xlog_xid(void);
+static void copy_xact_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void setup(char *argv0, bool *live_check);
static void cleanup(void);
@@ -115,7 +115,7 @@ main(int argc, char **argv)
* Destructive Changes to New Cluster
*/
- copy_clog_xlog_xid();
+ copy_xact_xlog_xid();
/* New now using xids of the old system */
@@ -376,17 +376,17 @@ remove_new_subdir(char *subdir, bool rmtopdir)
* Copy the files from the old cluster into it
*/
static void
-copy_subdir_files(char *subdir)
+copy_subdir_files(char *old_subdir, char *new_subdir)
{
char old_path[MAXPGPATH];
char new_path[MAXPGPATH];
- remove_new_subdir(subdir, true);
+ remove_new_subdir(new_subdir, true);
- snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir);
- snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir);
+ snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir);
- prep_status("Copying old %s to new server", subdir);
+ prep_status("Copying old %s to new server", old_subdir);
exec_prog(UTILITY_LOG_FILE, NULL, true,
#ifndef WIN32
@@ -401,10 +401,16 @@ copy_subdir_files(char *subdir)
}
static void
-copy_clog_xlog_xid(void)
+copy_xact_xlog_xid(void)
{
- /* copy old commit logs to new data dir */
- copy_subdir_files("pg_clog");
+ /*
+ * Copy old commit logs to new data dir. pg_clog has been renamed to
+ * pg_xact in post-10 clusters.
+ */
+ copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact",
+ GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
+ "pg_clog" : "pg_xact");
/* set the next transaction id and epoch of the new cluster */
prep_status("Setting next transaction ID and epoch for new cluster");
@@ -434,8 +440,8 @@ copy_clog_xlog_xid(void)
if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER &&
new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER)
{
- copy_subdir_files("pg_multixact/offsets");
- copy_subdir_files("pg_multixact/members");
+ copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets");
+ copy_subdir_files("pg_multixact/members", "pg_multixact/members");
prep_status("Setting next multixact ID and offset for new cluster");
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index cf6edc3bdb..722867d5d2 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -76,7 +76,7 @@ typedef struct SlruSharedData
/*
* Optional array of WAL flush LSNs associated with entries in the SLRU
* pages. If not zero/NULL, we must flush WAL before writing pages (true
- * for pg_clog, false for multixact, pg_subtrans, pg_notify). group_lsn[]
+ * for pg_xact, false for multixact, pg_subtrans, pg_notify). group_lsn[]
* has lsn_groups_per_page entries per buffer slot, each containing the
* highest LSN known for a contiguous group of SLRU entries on that slot's
* page.
@@ -119,7 +119,7 @@ typedef struct SlruCtlData
SlruShared shared;
/*
- * This flag tells whether to fsync writes (true for pg_clog and multixact
+ * This flag tells whether to fsync writes (true for pg_xact and multixact
* stuff, false for pg_subtrans and pg_notify).
*/
bool do_fsync;
--
2.12.0
On Thu, Mar 16, 2017 at 9:31 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Fri, Mar 17, 2017 at 12:19 AM, David Steele <david@pgmasters.net> wrote:
This patch does not apply cleanly at cccbdde:
$ git apply ../other/0001-Rename-pg_clog-to-pg_xact.patch
error: doc/src/sgml/ref/pg_resetxlog.sgml: No such file or directory
error: patch failed: src/backend/postmaster/autovacuum.c:2468
error: src/backend/postmaster/autovacuum.c: patch does not applyThis has rotten again...
Marked "Waiting on Author".
I'd really like to see the rest of the renames happen for v10. It seems
like the process got stalled after the pg_wal rename.Let's see what happens, attached are refreshed versions. Uncertainty
is the fun part of a CF.
I understand that the point of renaming pg_clog to pg_xact is that
pg_clog contains the dreaded letters l-o-g, which we hypothesize
causes DBAs to remove it. (Alternate hypothesis: "So, that's what's
clogging my database!")
Renaming pg_subtrans to pg_subxact has no such redeeming properties.
More, with each of these renamings, we're further separating what
things are called in the code (xlog, clog, subtrans) with what they're
called in the filesystem (wal, xact, subxact).
So if we must rename pg_clog, OK, but can't we leave pg_subtrans
alone? It's not hurting anybody.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Mar 17, 2017 at 11:17 AM, Robert Haas <robertmhaas@gmail.com> wrote:
I understand that the point of renaming pg_clog to pg_xact is that
pg_clog contains the dreaded letters l-o-g, which we hypothesize
causes DBAs to remove it. (Alternate hypothesis: "So, that's what's
clogging my database!")Renaming pg_subtrans to pg_subxact has no such redeeming properties.
More, with each of these renamings, we're further separating what
things are called in the code (xlog, clog, subtrans) with what they're
called in the filesystem (wal, xact, subxact).So if we must rename pg_clog, OK, but can't we leave pg_subtrans
alone? It's not hurting anybody.
The only argument behind the renaming of pg_subtrans is really
consistency with pg_xact, because both deal with transactions. I don't
personally mind if this portion of the renaming is left off, as you
say anything labelled with "log" is at the origin of this thread.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Mar 16, 2017 at 10:21 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Fri, Mar 17, 2017 at 11:17 AM, Robert Haas <robertmhaas@gmail.com> wrote:
I understand that the point of renaming pg_clog to pg_xact is that
pg_clog contains the dreaded letters l-o-g, which we hypothesize
causes DBAs to remove it. (Alternate hypothesis: "So, that's what's
clogging my database!")Renaming pg_subtrans to pg_subxact has no such redeeming properties.
More, with each of these renamings, we're further separating what
things are called in the code (xlog, clog, subtrans) with what they're
called in the filesystem (wal, xact, subxact).So if we must rename pg_clog, OK, but can't we leave pg_subtrans
alone? It's not hurting anybody.The only argument behind the renaming of pg_subtrans is really
consistency with pg_xact, because both deal with transactions. I don't
personally mind if this portion of the renaming is left off, as you
say anything labelled with "log" is at the origin of this thread.
Fine! I've committed the pg_clog renaming, but I'd really like to
draw the line here. I'm not going to commit the pg_subtrans ->
pg_subxact naming and am -1 on anyone else doing so. I think that
having the names of things in the code match what shows up in the file
system is an awfully desirable property which we should preserve
insofar as we can do so without compromising other goals. Not
invalidating what users and DBAs think they know about how PostgreSQL
works is a good thing, too; there are a lot more people who know
something about the directory layout than will read this thread.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Mar 17, 2017 at 10:58 PM, Robert Haas <robertmhaas@gmail.com> wrote:
Fine! I've committed the pg_clog renaming, but I'd really like to
draw the line here. I'm not going to commit the pg_subtrans ->
pg_subxact naming and am -1 on anyone else doing so. I think that
having the names of things in the code match what shows up in the file
system is an awfully desirable property which we should preserve
insofar as we can do so without compromising other goals. Not
invalidating what users and DBAs think they know about how PostgreSQL
works is a good thing, too; there are a lot more people who know
something about the directory layout than will read this thread.
I'm cool with that, thanks for the commit.
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Mar 17, 2017 at 11:03 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
On Fri, Mar 17, 2017 at 10:58 PM, Robert Haas <robertmhaas@gmail.com> wrote:
Fine! I've committed the pg_clog renaming, but I'd really like to
draw the line here. I'm not going to commit the pg_subtrans ->
pg_subxact naming and am -1 on anyone else doing so. I think that
having the names of things in the code match what shows up in the file
system is an awfully desirable property which we should preserve
insofar as we can do so without compromising other goals. Not
invalidating what users and DBAs think they know about how PostgreSQL
works is a good thing, too; there are a lot more people who know
something about the directory layout than will read this thread.I'm cool with that, thanks for the commit.
monitoring.sgml still has some references to "clog". We should update them?
Regards,
--
Fujii Masao
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers