Re: BackendKeyData is mandatory?

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, tgl(at)sss(dot)pgh(dot)pa(dot)us, hlinnaka(at)iki(dot)fi, peter(at)eisentraut(dot)org, pgsql-hackers(at)postgresql(dot)org, Dave Cramer <davecramer(at)gmail(dot)com>
Subject: Re: BackendKeyData is mandatory?
Date: 2025-07-03 06:37:47
Message-ID: CAGECzQSxGPVY8U1Wy8hMG=yeeVk35bP3Qr-Kkww4wZy=uFunyw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 3 Jul 2025 at 02:03, Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> Okay, wait -- JDBC was _copying_ our weird behavior? Why? Does
> something depend it in the wild?

I'm pretty sure there was no intent behind this, but it's simply
because our weird behaviour is the simplest from the client
implementation side with a fixed 4-byte key length:
1. Store two ints in a struct/class, these default to 0.
2. When you receive a BackendKeyData during startup update the two ints
3. When client wants to cancel, send a CancelRequest with the two ints.

So if step 2 is missed, then you send this all zero message. PgBouncer
has the same behaviour.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinya Kato 2025-07-03 06:40:07 Re: Extend COPY FROM with HEADER <integer> to skip multiple lines
Previous Message shveta malik 2025-07-03 06:34:33 Re: Using failover slots for PG-non_PG logical replication