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>
Cc: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, 'Kyotaro Horiguchi' <horikyota(dot)ntt(at)gmail(dot)com>, "k(dot)jamison(at)fujitsu(dot)com" <k(dot)jamison(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: libpq debug log
Date: 2021-03-16 07:40:38
Message-ID: TYAPR01MB299002E5EE3AE7A1C4AA83B2FE6B9@TYAPR01MB2990.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-03-16 07:44:38 Re: shared-memory based stats collector
Previous Message Michael Paquier 2021-03-16 07:20:37 Permission failures with WAL files in 13~ on Windows