"strange" pg_rewind error

From: MichaelDBA <MichaelDBA(at)sqlexec(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: "strange" pg_rewind error
Date: 2020-05-03 12:57:13
Message-ID: 939b25f7-bc1b-ba32-fd3f-afed0f7c0702@sqlexec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Browse pgsql-admin by date

  From Date Subject
Next Message Anjul Tyagi 2020-05-04 06:49:35 Logical Replicated Database Slow
Previous Message vinod kale 2020-05-01 21:14:16 Re: Postgres pgbackrest issue.