On Fri, Apr 5, 2024 at 12:09 PM Jelte Fennema-Nio <m...@jeltef.nl> wrote: > But I do think that we shouldn't be at all averse to the act of > bumping the protocol version itself. If we have a single small > protocol change in one release, then imho it's no problem to bump the > protocol version. Bumping the version should be painless. So we > shouldn't be inclined to push an already agreed upon protocol change > to the next release, because there are some more protocol changes in > the pipeline that won't make it in the current one.
I think I half-agree with this. Let's say we all agree that the world will end unless we make wire protocol changes A and B, and for whatever reason we also agree that these changes should be handled via a protocol version bump rather than any other method, but only the patch for A is sufficiently stable by the end of the release cycle. Then we commit A and bump the protocol version and the next release we do the same for B, hopefully before the world ends. In this sense this is just like CATALOG_VERSION_NO or XLOG_PAGE_MAGIC. We don't postpone commits because they'd require bumping those values; we just bump the values when it's necessary. But on the other hand, I find it a bit hard to believe that the statement "Bumping the version should be painless" will ever correspond to reality. Since we've not done a hard wire protocol break in a very long time, I assume that we would not want to start now. But that also means that when the PG version with protocol version 3.5 comes out, that server is going to have to be compatible with 3.4, 3.3, 3.2, 3.1, and 3.0. How will we test that it really is? We could test against libpqs from older server versions, but that quickly becomes awkward, because it means that there won't be tests that run as part of a regular build, but it'll have to all be done in the buildfarm or CI with something like the cross-version upgrade tests we already have. Maybe we'd be better off adding a libpq connection option that forces the use of a specific minor protocol version, but then we'll need backward-compatibility code in libpq basically forever. But maybe we need that anyway to avoid older and newer servers being unable to communicate. Plus, you've got all of the consequences for non-core drivers, which have to both add support for the new wire protocol - if they don't want to seem outdated and eventually obsolete - and also test that they're still compatible with all supported server versions. Connection poolers have the same set of problems. The whole thing is almost a hole with no bottom. Keeping up with core changes in this area could become a massive undertaking for lots and lots of people, some of whom may be the sole maintainer of some important driver that now needs a whole bunch of work. I'm not sure how much it improves things if we imagine adding feature flags to the existing protocol versions, rather than whole new protocol versions, but at least it cuts down on the assumption that adopting new features is mandatory, and that such features are cumulative. If a driver wants to support TDE but not protocol parameters or protocol parameters but not TDE, who are we to say no? If in supporting those things we bump the protocol version to 3.2, and then 3.3 fixes a huge performance problem, are drivers going to be required to add support for features they don't care about to get the performance fixes? I see some benefit in bumping the protocol version for major changes, or for changes that we have an important reason to make mandatory, or to make previously-optional features for which support has become in practical terms universal part of the base feature set. But I'm very skeptical of the idea that we should just handle as many things as possible via a protocol version bump. We've been avoiding protocol version bumps like the plague since forever, and swinging all the way to the other extreme doesn't sound like the right idea to me. > How about naming the GUCs pg_protocol.${NAME}, but still requiring the > _pq_ prefix in the StartupPacket. That way only client libraries would > have to see this internal prefix and they could remap it someway. I > see two options for that: > 1. At the server replace the _pq_ prefix with pg_protocol. So > _pq_.${NAME} would map to pg_protocol.${name} > 2. At the server replace the _pq_.pg_protocol prefix with pg_protocol. > So _pq_.pg_protocol.${NAME} would map to pg_protocol.${name}. > > I guess you prefer option 2, because that would still leave lots of > space to do something with the rest of the _pq_ space, i.e. > _pq_.magic_pixie_dust can still be used for something different than a > GUC. I'm not sure what I think about this. Do we need these new GUCs to be both PGC_PROTOCOL *and also* live in a separate namespace? I see the need for the former pretty clearly: if these kinds of things are to be part of the GUC system (which wasn't my initial bias, but whatever) then they need to have some important behavioral differences from other GUCs and so we need a flag to signal that. But what problem are we solving by also giving them special-looking names, and are we sure we wouldn't rather solve that problem some other way? -- Robert Haas EDB: http://www.enterprisedb.com