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

2017-05-30 Thread Robert Haas
On Tue, May 30, 2017 at 4:24 AM, Simon Riggs wrote: > Just check the name of the directory so that pg_resetwal will refuse > to run against pg_xlog directory That's a strictly weaker integrity check than what Tom already committed. That only distinguishes pre-10 from post-10, whereas Tom linked

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

2017-05-30 Thread Simon Riggs
On 29 May 2017 at 17:00, Tom Lane wrote: > Amit Kapila writes: >> 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 stru

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

2017-05-29 Thread Craig Ringer
On 30 May 2017 at 00:00, Tom Lane wrote: > I think it's just horribly dangerous to run any version of > pg_resetxlog/pg_resetwal You can pretty much stop there ;) -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sen

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

2017-05-29 Thread Amit Kapila
On Mon, May 29, 2017 at 9:30 PM, Tom Lane wrote: > Amit Kapila writes: >> 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 direct

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

2017-05-29 Thread Tom Lane
Michael Paquier writes: > Agreed. Shouldn't this be back-patched? PG_CONTROL_VERSION has not > been bumped between 9.4 and 9.5. Attached is a patch for HEAD. Pushed with minor adjustments. Notably, I didn't take your addition of canonicalize_path() and referencing the file by absolute path. That

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

2017-05-29 Thread Michael Paquier
On Mon, May 29, 2017 at 10:02 AM, Tom Lane wrote: > Michael Paquier writes: >> On Mon, May 29, 2017 at 9:00 AM, Tom Lane wrote: >>> So we need to prevent this, not try to make it work. I don't think >>> we can insist on a version match in pg_control, because part of the >>> point of pg_resetxlo

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

2017-05-29 Thread Tom Lane
Michael Paquier writes: > On Mon, May 29, 2017 at 9:00 AM, Tom Lane wrote: >> So we need to prevent this, not try to make it work. I don't think >> we can insist on a version match in pg_control, because part of the >> point of pg_resetxlog/pg_resetwal is to recover if pg_control is >> unreadabl

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

2017-05-29 Thread Michael Paquier
On Mon, May 29, 2017 at 9:00 AM, Tom Lane wrote: > So we need to prevent this, not try to make it work. I don't think > we can insist on a version match in pg_control, because part of the > point of pg_resetxlog/pg_resetwal is to recover if pg_control is > unreadable. But I think we could look a

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

2017-05-29 Thread Tom Lane
Amit Kapila writes: > 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. che

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

2017-05-29 Thread Michael Paquier
On Mon, May 29, 2017 at 3:19 AM, Amit Kapila wrote: > 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 > no

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

2017-05-29 Thread Tom Lane
tushar writes: > I have installed PG v9.6 / v9.5 , if we run pg_resetwal from v10 > binaries against data directory of v9.6/9.5 ,getting this error - > centos@centos-cpula bin]$ ./pg_resetwal -D /tmp/pg9.6/bin/data/ > pg_resetwal: pg_control exists but is broken or unknown version; ignoring it >

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

2017-05-29 Thread Amit Kapila
On Mon, May 29, 2017 at 3:20 PM, tushar 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

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

2017-05-29 Thread tushar
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. [cen

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

2017-05-29 Thread Amit Kapila
On Mon, May 29, 2017 at 1:48 PM, tushar wrote: > Hi, > > I have installed PG v9.6 / v9.5 , if we run pg_resetwal from v10 binaries > against data directory of v9.6/9.5 ,getting this error - > > centos@centos-cpula bin]$ ./pg_resetwal -D /tmp/pg9.6/bin/data/ > pg_resetwal: pg_control exists but is

[HACKERS] pg_resetwal is broken if run from v10 against older version of PG data directory

2017-05-29 Thread tushar
Hi, I have installed PG v9.6 / v9.5 , if we run pg_resetwal from v10 binaries against data directory of v9.6/9.5 ,getting this error - centos@centos-cpula bin]$ ./pg_resetwal -D /tmp/pg9.6/bin/data/ pg_resetwal: pg_control exists but is broken or unknown version; ignoring it pg_resetwal: could