Waiting for PostgreSQL 10 – Rename “pg_xlog” directory to “pg_wal”.

On 20th of October, Robert Haas committed patch:

Rename "pg_xlog" directory to "pg_wal".
"xlog" is not a particularly clear abbreviation for "write-ahead log",
and it sometimes confuses users into believe that the contents of the
"pg_xlog" directory are not critical data, leading to unpleasant
consequences.  So, rename the directory to "pg_wal".
This patch modifies pg_upgrade and pg_basebackup to understand both
the old and new directory layouts; the former is necessary given the
purpose of the tool, while the latter merely avoids an unnecessary
backward-compatibility break.
We may wish to consider renaming other programs, switches, and
functions which still use the old "xlog" naming to also refer to
"wal".  However, that's still under discussion, so let's do just this
much for now.
Discussion: CAB7nPqTeC-8+zux8_-4ZD46V7YPwooeFxgndfsq5Rg8ibLVm1A@mail.gmail.com
Michael Paquier

discussion link

This is not really visible for users, but it's pretty interesting change.

Up till 9.6, in $PGDATA we had some directories which could have caused confusion among users:

  • pg_log
  • pg_clog
  • pg_xlog

I heard horror stories about users assuming (wrongly) that pg_xlog or pg_clog are just some logs and can be removed if there is disk space problem.

Well, it's not the case – removing things from there (pg_clog and/or pg_xlog) is almost guaranteed to break the Pg and cause you to lose data.

Looks like there have been quite a lot of people having this idea, so decision was made to rename the directories (so far only the part for pg_xlog got committed, but as far as I understand, patch for pg_clog will be committed later).

From user point of view – nothing changes – PostgreSQL works as it worked before.

But if you wrote a tool that does things with xlogs (wal files), and you assumed the directory is $PGDATA/pg_xlog – then you'll have to update your application/script as it will break in Pg 10.

Since the change is clearly not backward-compatible, and will definitely break some tools, it was introduced into codebase as early as possible, to let everyone learn about it, and fix whatever needs to be fixed.

One thought on “Waiting for PostgreSQL 10 – Rename “pg_xlog” directory to “pg_wal”.”

  1. At the same time pg_subtrans may get renamed to pg_subxact for consistency with the potential new name of pg_clog to pg_xact. We’ll see.

Comments are closed.