pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Iwata, Aya <iwata.aya@jp.fujitsu.com>
Cc: Jamison, Kirk <k.jamison@jp.fujitsu.com>
Cc: Nagaura, Ryohei <nagaura.ryohei@jp.fujitsu.com>
Cc: Jacob Champion <pchampion@pivotal.io>
Cc: Jim Doty <jdoty@pivotal.io>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Cc: nagata@sraoss.co.jp <nagata@sraoss.co.jp>
Cc: Haribabu Kommi <kommi.haribabu@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Re: libpq debug log
Date: Mon, 04 Mar 2019 22:25:39 -0500
Message-ID: <5008.1551756339@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmobGvUKiNQfh-4GzTWxoD1qX63D3_W3O+fnzBXBCiRSo=g@mail.gmail.com>
References: <71E660EB361DF14299875B198D4CE5423DE3FBA4@g01jpexmbkw25>
	<20180827215124.0cdb4d0cb99136b5a86b1d9f@sraoss.co.jp>
	<71E660EB361DF14299875B198D4CE5423DE4A154@g01jpexmbkw25>
	<4bc9abbd-44a0-1787-b410-4e68b5ab3228@2ndquadrant.com>
	<71E660EB361DF14299875B198D4CE5423DE5ADB3@g01jpexmbkw25>
	<71E660EB361DF14299875B198D4CE5423DE758BB@g01jpexmbkw25>
	<CABAq_6HETsCjv5vf_HXKM+A9smW8P-GVH0iuZ-1Y8RiwQ8eZ+w@mail.gmail.com>
	<71E660EB361DF14299875B198D4CE5423DE804A9@g01jpexmbkw25>
	<71E660EB361DF14299875B198D4CE5423DE82363@g01jpexmbkw25>
	<ae75c8a3-95bd-37d2-bfc1-c0a11b347538@2ndquadrant.com>
	<71E660EB361DF14299875B198D4CE5423DE83937@g01jpexmbkw25>
	<71E660EB361DF14299875B198D4CE5423DE99C79@g01jpexmbkw25>
	<71E660EB361DF14299875B198D4CE5423DEB31F4@g01jpexmbkw25>
	<71E660EB361DF14299875B198D4CE5423DEB9E4B@g01jpexmbkw25>
	<EDA4195584F5064680D8130B1CA91C453BF258@G01JPEXMBYT04>
	<71E660EB361DF14299875B198D4CE5423DED92AD@g01jpexmbkw25>
	<D09B13F772D2274BB348A310EE3027C643BC5C@g01jpexmbkw24>
	<71E66! 0EB361DF14299875B198D4CE5423DEDA4CF@g01jpexmbkw25>
	<CA+TgmobviA3E6JH4ohq50FvvL8Lo1=jGKR3t2L196J3CjVeQJg@mail.gmail.com>
	<19535.1550861516@sss.pgh.pa.us>
	<71E660EB361DF14299875B198D4CE5423DEF1844@g01jpexmbkw25>
	<CA+TgmobGvUKiNQfh-4GzTWxoD1qX63D3_W3O+fnzBXBCiRSo=g@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> The basic idea being:

> - Each line is a whole message.
> - The line begins with <<< for a message received and >>> for a message sent.

+1, though do we really need to repeat the direction marker thrice?

> - Strings in single quotes are those sent/received as a fixed number of bytes.
> - Strings in double quotes are those sent/received as a string.
> - 4-byte integers are printed unadorned.
> - 2-byte integers are prefixed by #.
> - I guess 1-byte integers would need some other prefix, maybe @ or ##.

I doubt that anybody gives a fig for those distinctions, except when
they're writing actual code that speaks the protocol --- and I do not
think that that's the target use-case.  So strings and integers seem
like plenty.  I'd also suggest that just because the protocol has
single-letter codes for message types doesn't mean that average users
have memorized those codes; and that framing data like the message
length is of no interest.

In short, rather than

	<<< 'T' 101 4 "Schema" 2615 #2 19 #64 -1 #0 "Name" 1259 #2 19 #64 -1 #0 "Owner" 0 #0 19 #64 -1 #0

I'd envision something more like

	< RowDescription "Schema" 2615 2 19 64 -1 0 "Name" 1259 2 19 64 -1 0 "Owner" 0 0 19 64 -1 0

> But I still don't really see a need for different levels or whatever.
> I mean, you either want a dump of all of the protocol traffic, or you
> don't, I think.  Or maybe I am confused as to what the goal of all
> this really is.

Yeah, me too.  But a lot of this detail would only be useful if you
were trying to diagnose something like a discrepancy between the server
and libpq as to the width of some field.  And the number of users for
that can be counted without running out of fingers.  I think what would
be of use for a trace facility is as high-level a view as possible of
the message contents.

Or, in other words: a large part of the problem with the existing PQtrace
facility is that it *was* designed to help debug libpq itself, and that
use-case is no longer very interesting.  We should assume that the library
knows how to parse protocol messages.

			regards, tom lane




view thread (234+ messages)  latest in thread

Message-ID: <5008.1551756339@sss.pgh.pa.us>
Permalink:  ../5008.1551756339@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5008.1551756339@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, iwata.aya@jp.fujitsu.com, k.jamison@jp.fujitsu.com, nagaura.ryohei@jp.fujitsu.com, pchampion@pivotal.io, jdoty@pivotal.io, nagata@sraoss.co.jp, kommi.haribabu@gmail.com, peter.eisentraut@2ndquadrant.com
  Subject: Re: libpq debug log
  In-Reply-To: <5008.1551756339@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox