From: MichaelDBA <MichaelDBA@sqlexec.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: "strange" pg_rewind error
Date: Sun, 3 May 2020 08:57:13 -0400
Message-ID: <939b25f7-bc1b-ba32-fd3f-afed0f7c0702@sqlexec.com> (raw)
Here is my pg_rewind command. Trying to make a former primary follow
the newly-promoted standby...
/usr/pgsql-12/bin/pg_rewind -D '/apps/opt/postgres/pg12/data'
--source-server='host=mypromotedstandby user=repmgr dbname=repmgr
port=5432 password=mypassword connect_timeout=2'
Now I don't know if this matters but that log directory is actually a
symlink pointing to a location that has log files in both the source and
target.
Here is the error I get:
pg_rewind: servers diverged at WAL location 1/2F0000A0 on timeline 6
pg_rewind: rewinding from last common checkpoint at 1/2F000028 on timeline 6
pg_rewind: fatal: "/apps/opt/postgres/pg12/data/log" is not a directory
Here is the reference from the PostgreSQL source code where it is noted
as "strange"
https://github.com/postgres/postgres/blob/master/src/bin/pg_rewind/filemap.c
process_source_file(const char *path, file_type_t type, size_t newsize,
const char *link_target)
{
...
...
...
switch (type)
{
case FILE_TYPE_DIRECTORY:
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", localpath);
}
if (!exists)
action = FILE_ACTION_CREATE;
else
action = FILE_ACTION_NONE;
oldsize = 0;
break;
case FILE_TYPE_SYMLINK:
if (exists &&
Regards,
Michael Vitale
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: MichaelDBA@sqlexec.com
Subject: Re: "strange" pg_rewind error
In-Reply-To: <939b25f7-bc1b-ba32-fd3f-afed0f7c0702@sqlexec.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox