RE: libpq debug log

From: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
To: "iwata(dot)aya(at)fujitsu(dot)com" <iwata(dot)aya(at)fujitsu(dot)com>, 'Alvaro Herrera' <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: libpq debug log
Date: 2021-01-25 07:12:56
Message-ID: TYAPR01MB2990FD222CCB8AE53B43DB2DFEBD0@TYAPR01MB2990.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

First, some possibly major questions:

(23)
From: 'Alvaro Herrera' <alvherre(at)alvh(dot)no-ip(dot)org>
> Maybe we can create a new file specifically for this to avoid mixing
> unrelated stuff in fe-misc.c -- say fe-trace.c where all this new
> tracing stuff goes.

What do you think about this suggestion? I think this is reasonable, including moving PQtrace/PQuntrace to the new file.

OTOH, fe-misc also has humble reasons to contain them. One is that the file header comment is as follows, accepting miscellaneous stuff. Another is that although most functions in fe-misc.c are related to protocol data transmission and receipt, several functions at the end of the file are already not related.

* fe-misc.c
*
* DESCRIPTION
* miscellaneous useful functions

(24)
-void PQtrace(PGconn *conn, FILE *stream);
+void PQtrace(PGconn *conn, FILE *stream, bits32 flags);
</synopsis>
</para>

+ <para>
+ <literal>flags</literal> contains flag bits describing the operating mode
+ of tracing. If <literal>(flags & TRACE_SUPPRESS_TIMESTAMPS)</literal> is
+ true, then timestamps are not printed with each message.
+ </para>

As I asked in the previous mail, I'm afraid we cannot change the signature of existing API functions. If we want this flag bits, we have to add something like PQtraceEx(), don't we?

The flag name differs between in the manual and in the source code:

+#define PQTRACE_SUPPRESS_TIMESTAMPS (1 << 0)

P.S.
Also, please note this as:

> Also, why don't you try running the regression tests with a temporary modification to PQtrace() to output the trace to a file? The sole purpose is to confirm that this patch doesn't make the test crash (core dump).

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2021-01-25 07:14:37 Re: The mysterious pg_proc.protrftypes
Previous Message David Rowley 2021-01-25 07:05:19 Re: Heap's backwards scan scans the incorrect pages with heap_setscanlimits()