pgsql: Coordinate log_line_prefix options 'm' and 'n' to share a timeva

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Coordinate log_line_prefix options 'm' and 'n' to share a timeva
Date: 2015-09-07 22:41:38
Message-ID: E1ZZ56Y-00067Y-HK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Coordinate log_line_prefix options 'm' and 'n' to share a timeval.

Commit f828654e introduced the 'n' option, but it invoked
gettimeofday() independently of the 'm' option. If both options were
in use (or multiple 'n' options), or if 'n' was in use along with
csvlog, then the reported times could be different for the same log
message.

To fix, initialize a global variable with gettimeofday() once per log
message, and use that for both formats.

Don't bother coordinating the time for the 't' option, which has much
lower resolution.

Per complaint by Alvaro Herrera.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/b1e1862a123b6904d51fd0a607e30f5832bf9a1f

Modified Files
--------------
src/backend/utils/error/elog.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2015-09-07 23:03:50 pgsql: In the pg_rewind test suite, receive WAL fully before promoting.
Previous Message Alvaro Herrera 2015-09-07 22:19:46 pgsql: Add more sanity checks in contrib/sslinfo