Re: pg_resetwal is broken if run from v10 against older version of PG data directory

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: tushar <tushar.ahuja@enterprisedb.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-05-29T10:19:56Z
Lists: pgsql-hackers
On Mon, May 29, 2017 at 3:20 PM, tushar <tushar.ahuja@enterprisedb.com> wrote:
> On 05/29/2017 03:10 PM, Amit Kapila wrote:
>>
>>   What makes you think above is a valid usage and should
>> pass?
>
> with earlier versions ,for instance - v.96 v/s v9.5 ,pg_resetwal was giving
> pg_control values .
>
> Installed v9.6 and v9.5  and run pg_resetwal of v9.6 against data directory
> of v9.5.
>
> [centos@centos-cpula ~]$ /tmp/pg9.6/bin/pg_resetxlog -D /tmp/pg9.5/bin/data/
> pg_resetxlog: pg_control exists but is broken or unknown version; ignoring
> it
> Guessed pg_control values:
>

I think this happens due to commit
f82ec32ac30ae7e3ec7c84067192535b2ff8ec0e which renames pg_xlog to
pg_wal.  It does take care of making some of the modules like
pg_basebackup to understand both old and new directory structures, but
not done for all the modules.  I think we should make similar changes
in pg_resetwal or at the very least update the docs to indicate
pg_resetwal can give an error if used against pre-10 data directory.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


Commits

  1. Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs.

  2. Rename "pg_xlog" directory to "pg_wal".