RE: libpq debug log
k.jamison@fujitsu.com <k.jamison@fujitsu.com>
From: "k.jamison@fujitsu.com" <k.jamison@fujitsu.com>
To: "'alvherre@alvh.no-ip.org'" <alvherre@alvh.no-ip.org>, "iwata.aya@fujitsu.com" <iwata.aya@fujitsu.com>
Cc: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>, 'Kyotaro
Horiguchi' <horikyota.ntt@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-24T04:04:04Z
Lists: pgsql-hackers
> From: alvherre@alvh.no-ip.org <alvherre@alvh.no-ip.org>
> I'll give this another look tomorrow, but I wanted to pass along that I prefer
> libpq-trace.{c,h} instead of libpq-logging. I also renamed variable "pin" and
> pgindented. I don't have any major reservations about this patch now, so I'll
> mark it ready-for-committer in case somebody else wants to have a look
> before push.
>
> (Not sure about the use of the word "forcely")
Hi Iwata-san and Alvaro-san,
Thank you for updating the patch.
Although it's already set as "Ready for Committer", I just found minor parts
that need to be fixed.
(1) Doc: PQtraceSetFlags
+ <literal>flags</literal> contains flag bits describing the operating mode
+ of tracing. If <literal>flags</literal> contains <literal>PQTRACE_SUPPRESS_TIMESTAMPS</literal>,
+ then timestamp is not printed with each message. If set to 0 (default),tracing will be output with timestamp.
+ This function should be called after calling <function>PQtrace</function>.
Missing space. And can be paraphrased to:
"If set to 0 (default), tracing with timestamp is printed."
(2)
+ * pqTraceMaybeBreakLine:
+ * Check whether the backend message is complete. If so, print a line
+ * break and reset the buffer. If print break line, return 1.
The 2nd & last sentence can be combined to
"If so, print a line break, reset the buffer, and return 1."
(3) +PQtraceSetFlags(PGconn *conn, int flags)
+ /* If PQtrace() is failed, do noting. */
"If PQtrace() failed, do nothing."
(4)
> (Not sure about the use of the word "forcely")
I think it's not necessary.
Also, I tested the flag to not print timestamp. For example,
PQtrace(conn, trace_file);
PQtraceSetFlags(conn, PQTRACE_SUPPRESS_TIMESTAMPS);
And it did not print the timestamp. So it worked.
It also passed all the regression tests. (although PQtrace() is not tested in existing libpq tests).
Regards,
Kirk Jamison
Commits
-
Rename PQtraceSetFlags() to PQsetTraceFlags().
- d0e750c0acaf 14.0 landed
-
Suppress length of Notice/Error msgs in PQtrace regress mode
- e7e341409a3d 14.0 landed
-
Strip file names reported in error messages on Windows, too.
- 53aafdb9ff6a 14.0 landed
-
Fix setvbuf()-induced crash in libpq_pipeline
- a68a894f0198 14.0 landed
-
libpq_pipeline: Must strdup(optarg) to avoid crash
- dde1a35aee62 14.0 landed
-
Remove setvbuf() call from PQtrace()
- 6ec578e60101 14.0 landed
-
Initialize conn->Pfdebug to NULL when creating a connection
- aba24b51cc1b 14.0 landed
-
Disable force_parallel_mode in libpq_pipeline
- a6d3dea8e5e0 14.0 landed
-
libpq_pipeline: add PQtrace() support and tests
- 7bebd0d00998 14.0 landed
-
Improve PQtrace() output format
- 198b3716dba6 14.0 landed
-
Re-simplify management of inStart in pqParseInput3's subroutines.
- d3a557894ce0 11.12 landed
- d2be6cdc55ad 10.17 landed
- a98e53e10dd5 9.6.22 landed
- 56defbdd0f4e 12.7 landed
- 51c54bb60309 14.0 landed
- 3580b4a0cde0 13.3 landed