Skip to content

fix(wal): gate flush feedback on durable server acknowledgements - #124

Open
gabriele-wolfox wants to merge 2 commits into
mainfrom
dev/98
Open

fix(wal): gate flush feedback on durable server acknowledgements#124
gabriele-wolfox wants to merge 2 commits into
mainfrom
dev/98

Conversation

@gabriele-wolfox

@gabriele-wolfox gabriele-wolfox commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Problem

The WAL streaming client reported a flush position to PostgreSQL as soon as WAL
data was handed to the gRPC send buffer, before the Klio server confirmed it
durable. This made it unsafe to use Klio as a synchronous replication target for
zero RPO: PostgreSQL could acknowledge commits, or advance the physical slot's
restart_lsn, for data not yet guaranteed to survive a Klio server or network
failure.

Change

  • Convert the WAL Put RPC to bidirectional streaming so the server
    acknowledges each block once it has been fsynced.
  • Add a require_durable_ack client option (default off) that advances the
    reported flush position only up to durably acknowledged data. The default
    preserves the previous optimistic behavior.
  • Expose it as PluginConfiguration.spec.requireDurableAck and wire it into the
    generated client config.
  • Update the protocol and WAL streaming documentation, correcting the RPO
    claims.

Testing

  • Unit tests for the flush-LSN gating logic.
  • Kind e2e (physical streaming). With Klio asynchronous the option has no effect
    on commit latency or throughput. With Klio as the sole synchronous standby it
    gates commits as intended: in the single-client worst case, per-commit latency
    went from ~200 ms to ~400 ms (one extra flush cycle for the durable round
    trip); async runs were unchanged.

Closes #98

@gabriele-wolfox
gabriele-wolfox force-pushed the dev/98 branch 2 times, most recently from 224ad58 to 0bc6c72 Compare August 17, 2026 09:35
The WAL streaming client reported a flush position to PostgreSQL as soon as
WAL data was handed to the gRPC send buffer, before the Klio server confirmed
it durable. That made it unsafe to use Klio as a synchronous replication
target for zero RPO: PostgreSQL could acknowledge commits, or advance the
replication slot's restart_lsn, for data not yet guaranteed to survive a
server or network failure.

Convert the Put RPC to bidirectional streaming so the server acknowledges each
block once fsynced, and add a require_durable_ack client option (default off)
that advances the flush position only up to durably acknowledged data. The
default preserves the previous optimistic behavior.

Assisted-by: Claude
Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Add a requireDurableAck field to the PluginConfiguration spec and wire it into
the generated WAL client configuration, so synchronous replication targets can
require durable acknowledgements. Document how to enable it.

Assisted-by: Claude
Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WAL client reports unacknowledged flush position to Postgres, breaking RPO 0 guarantee

1 participant