RE: libpq debug log
tsunakawa.takay@fujitsu.com <tsunakawa.takay@fujitsu.com>
From: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
To: "iwata.aya@fujitsu.com" <iwata.aya@fujitsu.com>
Cc: 'Tom Lane' <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@alvh.no-ip.org>, 'Kyotaro Horiguchi' <horikyota.ntt@gmail.com>, "k.jamison@fujitsu.com" <k.jamison@fujitsu.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-03-16T07:40:38Z
Lists: pgsql-hackers
I've finished the review. Here are the last set of comments.
(16)
(15) is also true for the processing of 'H' message.
(17) pqTraceOutputD
+ for (i = 0; i < nfields; i++)
+ {
+ len = pqTraceOutputInt32(message + cursor, f);
+ cursor += 4;
+ if (len == -1)
+ break;
+ pqTraceOutputNchar(message + cursor, f, len);
+ cursor += len;
+ }
Not break but continue, because non-NULL columns may follow a NULL column.
(18)
+ case 'E': /* Execute(F) or Error Return(B) */
+ pqTraceOutputE(message + LogCursor, LogEnd, conn->Pfdebug, toServer);
+ break;
Error Return -> ErrorResponse
(19) pqTraceOutputF
Check the protocol again. Two for loops should be required, one for format codes and another for arguments.
(20)
+ if ( len != -1)
Remove extra space before len.
(21)
I guess you intentionally omitted the following messages because they are only used during connection establishment. I'm fine with it. I wrote this just in case you missed them.
GSSENCRequest (F)
Int32(8)
GSSResponse (F)
Byte1('p')
PasswordMessage (F)
Byte1('p')
SASLInitialResponse (F)
Byte1('p')
SASLResponse (F)
Byte1('p')
(22)
+/* NotificationResponse */
+static void
+pqTraceOutputA(const char *message, int end, FILE *f)
+{
+ int cursor = 0;
+
+ pqTraceOutputInt16(message + cursor, f);
+ cursor += 2;
+ pqTraceOutputString(message + cursor, f);
Not Int16 but Int32.
Regards
Takayuki Tsunakawa
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