Re: 9.3 release notes suggestions

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.3 release notes suggestions
Date: 2013-05-04 16:21:12
Message-ID: CAB8KJ=j+JoqkKQbfs07J+fZmTSj=udrB2NJ4QK+sNvpEDY7wpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/5/5 Bruce Momjian <bruce(at)momjian(dot)us>:
(...)
>> > This is such a minor change I am trying to keep it short.
>>
>> Just out of curiosity, what was the reason for the change in the first place?
>> (Not that it's something I'm particularly passionate about, I just noticed it
>> when listing changes with potential backwards-compatibilty effects for
>> the wiki).
>
> Well, basically, if you used %c in log_line_prefix, the session id was
> not a fixed length, so your output shifted around based on the pid, see:
>
> http://www.postgresql.org/message-id/20121012185127.GB31038@momjian.us
>
> Always showing four digits seems to give greater consistency to the
> log output.

Makes sense as long as your PIDs stay below 0x10000, but on OS X it makes
it less consistent IMHO, as you still end up with a varying number of digits:

5184ea1f.15ed2 LOG: database system was shut down at 2013-05-04 19:59:41 JST
5184ea1f.15ed1 LOG: database system is ready to accept connections
5184ea1f.15ed6 LOG: autovacuum launcher started
5184ea23.15edb ERROR: column "x" does not exist at character 8
5184ea23.15edb STATEMENT: select x;
51852890.0a0a ERROR: column "x" does not exist at character 8
51852890.0a0a STATEMENT: select x;

(tested using 9.3 HEAD)

>> >> if my slightly disengaged brain is grokking the source correctly:
>> >>
>> >> src/backend/utils/error/elog.c:
>> >> appendStringInfo(buf, "%lx.%04x", (long) (MyStartTime), MyProcPid);
>> >
>> > Yep.
>>
>> In that case maybe the docs need updating as well?
>>
>> http://www.postgresql.org/docs/devel/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
>> "The %c escape prints a quasi-unique session identifier, consisting of
>> two 4-byte hexadecimal numbers (without leading zeros)" separated by a
>> dot.
>
> Uh, that was never right, because the part before the dot is the session
> start timestamp, and that is 8 hex digits:
>
> 50785b3e.7ff9

I understood it as a 4-byte number expressed in hex, which in this
case even without
zero padding is always going to be 8 hex digits unless your system
clock is stuck in the 1970s.

> I have changed the text to:
>
> The <literal>%c</> escape prints a quasi-unique session identifier,
> consisting of two hexadecimal numbers separated by a dot.
>
> Doc fix backpatched to 9.2.X.

Covers all bases :)

However it just occurred to me the example following that paragraph is incorrect
for 9.3, as the to_hex(pid) output won't be zero-padded.

Sorry to be pedantic about this, like I said it's not something I am
particularly
passionate about and I'd never even taken notice of the %c option, but at least
on OS X the documentation didn't match the observed behaviour.

Regards

Ian Barwick

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-05-04 17:17:44 Re: 9.3 release notes suggestions
Previous Message Bruce Momjian 2013-05-04 16:04:44 Re: Remaining beta blockers