Re: libpq: Fix lots of discrepancies in PQtrace
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Jelte Fennema-Nio <postgres@jeltef.nl>
Cc: Michael Paquier <michael@paquier.xyz>, Nathan Bossart <nathandbossart@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-08-09T22:08:02Z
Lists: pgsql-hackers
Pushed 0002 and 0003. On the latter: I decided against using int32 to print the request identifiers; by splitting into two int16's, we see that the numbers match the values in the PG_PROTOCOL() declarations: 2024-08-09 17:37:38.364622 F 8 SSLRequest 1234 5679 and 2024-08-09 17:37:38.422109 F 16 CancelRequest 1234 5678 NNNN NNNN (I didn't verify GSSEncRequest directly.) I also verified that in non-regress mode, the values printed by CancelRequest match those in the BackendKeyData message, 2024-08-09 17:34:27.544686 B 12 BackendKeyData NNNN NNNN I also added suppression in regress mode for the backend key in the CancelRequest message, since they would be different each time. There are no tests for this code. We could add a trace file for the connection packet in libpq_pipeline by changing PQconnectdb() to PQconnectStart() and then do PQtrace before polling until the connection is ready; we would have to have it match for the TAP test. Not sure this is worth the effort. But doing this in a very crude way allowed me to verify that, at least on my machine, this code is doing what's expected. Thank you, -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Commits
-
libpq: Trace all messages received from the server
- b8b3f861fbd7 18.0 landed
-
libpq: Trace responses to SSLRequest and GSSENCRequest
- a5c6b8f22c20 18.0 landed
-
libpq: Trace frontend authentication challenges
- ea92f3a0a5ad 18.0 landed
-
libpq: Trace StartupMessage/SSLRequest/GSSENCRequest correctly
- 7adec2d5fc29 18.0 landed
-
libpq: Add suppress argument to pqTraceOutputNchar
- 4eb179e5bf7a 18.0 landed
-
Use PqMsg_* macros in fe-auth.c.
- 32f07991b728 17.0 landed