Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format

Lists: pgsql-hackers
From: Joe Conway <mail(at)joeconway(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-29 05:14:42
Message-ID: 568216C2.9000503@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I wonder why "Latest checkpoint's NextXID" is formated like this:

8<-------------------------
printf(_("Latest checkpoint's NextXID: %u/%u\n"),
ControlFile.checkPointCopy.nextXidEpoch,
ControlFile.checkPointCopy.nextXid);
8<-------------------------

Shouldn't it use "%X/%X", same as e.g. "Prior checkpoint location" and
all the other XIDs?

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-29 12:18:18
Message-ID: 56827A0A.2050705@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 29/12/15 07:14, Joe Conway wrote:
> I wonder why "Latest checkpoint's NextXID" is formated like this:
>
> 8<-------------------------
> printf(_("Latest checkpoint's NextXID: %u/%u\n"),
> ControlFile.checkPointCopy.nextXidEpoch,
> ControlFile.checkPointCopy.nextXid);
> 8<-------------------------
>
> Shouldn't it use "%X/%X", same as e.g. "Prior checkpoint location" and
> all the other XIDs?

No. The "locations" in the output are WAL locations. Those are
customarily printed with %X/%X. But NextXID is a transaction ID, those
are printed in decimal, with %u.

- Heikki


From: José Luis Tallón <jltallon(at)adv-solutions(dot)net>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-29 14:17:44
Message-ID: 56829608.1030408@adv-solutions.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/29/2015 01:18 PM, Heikki Linnakangas wrote:
> On 29/12/15 07:14, Joe Conway wrote:
>> I wonder why "Latest checkpoint's NextXID" is formated like this:
>>
>> 8<-------------------------
>> printf(_("Latest checkpoint's NextXID: %u/%u\n"),
>> ControlFile.checkPointCopy.nextXidEpoch,
>> ControlFile.checkPointCopy.nextXid);
>> 8<-------------------------
>>
>> Shouldn't it use "%X/%X", same as e.g. "Prior checkpoint location" and
>> all the other XIDs?
>
> No. The "locations" in the output are WAL locations. Those are
> customarily printed with %X/%X. But NextXID is a transaction ID, those
> are printed in decimal, with %u.

But Joe has a point here.... Others could also be confused if he doubted
about this.

"Latest checkpoint's NextXID: %u:%u\n", maybe ??
(slash becomes colon)

Worst part: fuzzies the translations unnecesarily

/ J.L.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: José Luis Tallón <jltallon(at)adv-solutions(dot)net>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-29 15:15:35
Message-ID: 31383.1451402135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?UTF-8?B?Sm9zw6kgTHVpcyBUYWxsw7Nu?= <jltallon(at)adv-solutions(dot)net> writes:
> On 12/29/2015 01:18 PM, Heikki Linnakangas wrote:
>> On 29/12/15 07:14, Joe Conway wrote:
>>> Shouldn't it use "%X/%X", same as e.g. "Prior checkpoint location" and
>>> all the other XIDs?

>> No. The "locations" in the output are WAL locations. Those are
>> customarily printed with %X/%X. But NextXID is a transaction ID, those
>> are printed in decimal, with %u.

> But Joe has a point here.... Others could also be confused if he doubted
> about this.

Yeah. Use of the same x/y notation with two different bases seems like
a recipe for confusion. It's probably too late to do anything about
this for 9.5, but I'd be +1 for adopting Jose's suggestion or some
other formatting tweak in HEAD.

regards, tom lane


From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, José Luis Tallón <jltallon(at)adv-solutions(dot)net>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-30 00:17:22
Message-ID: 56832292.2070403@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/29/2015 07:15 AM, Tom Lane wrote:
> Yeah. Use of the same x/y notation with two different bases seems like
> a recipe for confusion. It's probably too late to do anything about
> this for 9.5, but I'd be +1 for adopting Jose's suggestion or some
> other formatting tweak in HEAD.

I made the "%u/%u" -> "%u:%u" change in the controldata patch I just
posted, but I suppose I should commit that separately. Any complaints
about that?

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, José Luis Tallón <jltallon(at)adv-solutions(dot)net>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-30 05:46:57
Message-ID: CANP8+jKicB5Ux15f+toXRfJpEF7RQfDx3_ANH7tXs4qqrY8d4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 30 December 2015 at 00:17, Joe Conway <mail(at)joeconway(dot)com> wrote:

> On 12/29/2015 07:15 AM, Tom Lane wrote:
> > Yeah. Use of the same x/y notation with two different bases seems like
> > a recipe for confusion. It's probably too late to do anything about
> > this for 9.5, but I'd be +1 for adopting Jose's suggestion or some
> > other formatting tweak in HEAD.
>
> I made the "%u/%u" -> "%u:%u" change in the controldata patch I just
> posted, but I suppose I should commit that separately. Any complaints
> about that?

There is already long precedent about how to represent an XID with an
epoch... and it is neither of those two formats.

http://www.postgresql.org/docs/devel/static/functions-info.html
"Table 9-63. Transaction IDs and Snapshots"
"The internal transaction ID type (xid) is 32 bits wide and wraps around
every 4 billion transactions. However, these functions export a 64-bit
format that is extended with an "epoch" counter so it will not wrap around
during the life of an installation."

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: José Luis Tallón <jltallon(at)adv-solutions(dot)net>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>, Joe Conway <mail(at)joeconway(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-30 12:45:20
Message-ID: 5683D1E0.7080603@adv-solutions.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/30/2015 06:46 AM, Simon Riggs wrote:
> On 30 December 2015 at 00:17, Joe Conway <mail(at)joeconway(dot)com
> <mailto:mail(at)joeconway(dot)com>> wrote:
>
> On 12/29/2015 07:15 AM, Tom Lane wrote:
> > Yeah. Use of the same x/y notation with two different bases
> seems like
> > a recipe for confusion. It's probably too late to do anything about
> > this for 9.5, but I'd be +1 for adopting Jose's suggestion or some
> > other formatting tweak in HEAD.
>
> I made the "%u/%u" -> "%u:%u" change in the controldata patch I just
> posted, but I suppose I should commit that separately. Any complaints
> about that?
>
>
> There is already long precedent about how to represent an XID with an
> epoch... and it is neither of those two formats.
>
> http://www.postgresql.org/docs/devel/static/functions-info.html
> "Table 9-63. Transaction IDs and Snapshots"
> "The internal transaction ID type (xid) is 32 bits wide and wraps
> around every 4 billion transactions. However, these functions export a
> 64-bit format that is extended with an "epoch" counter so it will not
> wrap around during the life of an installation."

So? If I am guessing correctly, you propose to use %llu (more precisely,
UINT64_FORMAT) ?
(please correct me if I got it wrong)

IMHO, we have been telling users that XIDs are 32bits forever, so
showing a 64bits int where an XID is expected can easily induce confusion.
Moreover, the "epoch : whatever" format is widely used (Debian &
derivatives, just to name some) and understood...
... but I might be wrong.

Any format different from %X/%X seems better than what we have
know, in any case

Thanks,

/ J.L.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: José Luis Tallón <jltallon(at)adv-solutions(dot)net>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_controldata/pg_resetxlog "Latest checkpoint's NextXID" format
Date: 2015-12-30 15:29:29
Message-ID: 11245.1451489369@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?UTF-8?B?Sm9zw6kgTHVpcyBUYWxsw7Nu?= <jltallon(at)adv-solutions(dot)net> writes:
> On 12/30/2015 06:46 AM, Simon Riggs wrote:
>> There is already long precedent about how to represent an XID with an
>> epoch... and it is neither of those two formats.

> IMHO, we have been telling users that XIDs are 32bits forever, so
> showing a 64bits int where an XID is expected can easily induce confusion.

Yeah. Also, if you look at xmin or xmax in any stored row, it's only
going to be 32 bits. If we make pg_controldata merge the epoch into a
decimal representation, it's going to be a serious PITA to manually
compare stored XIDs to the printout.

We've talked about making on-disk XIDs be effectively 64 bits (with
some trick or other to avoid taking a big space hit). If that ever
happens, and we start printing xmin/xmax as true 64-bit values, then
it'd be appropriate for pg_controldata to do the same. But right now
I think a split format is still the way to go.

regards, tom lane