From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | postgres(at)jeltef(dot)nl, hlinnaka(at)iki(dot)fi, peter(at)eisentraut(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: protocol-level wait-for-LSN |
Date: | 2024-11-04 20:07:49 |
Message-ID: | CA+TgmoYNMkJi9r9xH9XYjmfFpgVTZYQvj3EUEdgzFWgki+vgeQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Oct 30, 2024 at 6:45 PM Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
> doesn't work, right? I don't like clients need to know the exact order
> of each protocol extensions.
I agree with this criticism, at least for the most part. Years and
years ago, the only way to specify EXPLAIN options was to say EXPLAIN
[ANALYZE] [VERBOSE] query. So, if you said, EXPLAIN VERBOSE ANALYZE
query, it didn't work. Actually, it still doesn't, but now you can say
EXPLAIN (VERBOSE, ANALYZE) query and that will work, because the new
options syntax allows for options to be specified in any order. And a
really key point here is that for quite a while we were resistant to
adding any new EXPLAIN options precisely because everyone knew the
requirement to mention the options in a specific order did not scale.
We could reasonably ask users to remember that ANALYZE had to come
before VERBOSE, but asking people to remember the correct order of
three or six or ten options would end up being quite annoying.
And I think the problem here is the same. When you want to add the
first set of optional fields to a protocol message, it seems perfectly
reasonable to decide that _pq_.tde=1 or _pq_.wait_for_lsn=1 turns them
on. When you add the second set of fields, it probably still feels
reasonable. But when you get up to half a dozen or so protocol
extensions that affect the same underlying set of messages, it's going
to start to be pretty annoying. Parsing that protocol message is going
to require pretty complicated code. Even if you don't care about the
contents of the extra fields, you still potentially need code to
understand and ignore them, unless you refuse support for the protocol
extension altogether.
Now, what makes this case less of a problem than the EXPLAIN case
mentioned above is that people are not typically going to construct
protocol messages by hand. As long as the protocol documentation is
clear about the ordering of fields and which fields are controlled by
which options, maybe it's not too horrible if everybody has to go
through and write a bunch of if-statements. But even so, wouldn't it
be easier if protocol extensions only added new message types instead
of redefining existing ones? Then you could just ignore message types
you don't care about. To be clear, I'm not saying that we should
never, ever extend an existing message type. I'm just saying that the
design of cramming a bunch of new fields into a message type doesn't
seem entirely scalable, and therefore I believe we should consider
whether there are reasonable alternatives.
--
Robert Haas
EDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2024-11-04 21:00:23 | Re: pgsql: Implement pg_wal_replay_wait() stored procedure |
Previous Message | Daniel Gustafsson | 2024-11-04 20:03:44 | Re: pg_dump --no-comments confusion |