Skip to content

Capture the slot's consistent point and split connect from streaming - #143

Merged
lukashes merged 2 commits into
mainfrom
feat/slot-consistent-point
Aug 5, 2026
Merged

Capture the slot's consistent point and split connect from streaming#143
lukashes merged 2 commits into
mainfrom
feat/slot-consistent-point

Conversation

@lukashes

@lukashes lukashes commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Groundwork for the initial snapshot (#49). A consistent snapshot needs the slot's exported consistent point and a seam to run the snapshot between slot creation and START_REPLICATION. This PR adds both.

  • replication_protocol.zig: read the CREATE_REPLICATION_SLOT result row and keep consistent_point, the slot's start LSN. Captured only when we create the slot; an existing slot leaves it null.
  • source.zig: split connect into connectAndEnsureSlot and beginReplication so a caller can act between the two. connect stays as a thin wrapper for callers that pass an explicit start LSN (tests).
  • main.zig: stream from the captured consistent point, falling back to 0/0 when the slot already existed.
  • Integration test: a freshly created slot exposes a valid consistent point and streams from it.

No behavior change on its own: for a fresh slot, 0/0 already resolves to the same position. The value is the captured point and the connect split, which the snapshot PRs build on.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Current run is the minimum over 3 passes, compared against the base branch (main @ b041d9c), built on the same runner.

Benchmark Baseline Current Δ Time Allocs Status
Converter DELETE 145.47μs 127.69μs -12.2% 13 → 14 🟢 faster
Converter INSERT 145.72μs 127.62μs -12.4% 13 → 14 🟢 faster
Converter UPDATE 175.01μs 174.93μs -0.0% 22 → 23 ➡️
JsonSerializer 49.92μs 50.62μs +1.4% 3 → 3 ➡️
KafkaProducer produce 243.26μs 211.04μs -13.2% 1 → 1 🟢 faster
KafkaProducer send 253.71μs 256.10μs +0.9% 0 → 0 ➡️
PgOutputDecoder 97.04μs 97.68μs +0.7% 6 → 6 ➡️
getPartitionKeyValue boolean 15.76μs 15.81μs +0.3% 1 → 1 ➡️
getPartitionKeyValue integer 0.04μs 0.04μs +0.0% 0 → 0 ⚪ noise
getPartitionKeyValue not found 0.03μs 0.03μs +0.0% 0 → 0 ⚪ noise
getPartitionKeyValue string 17.59μs 17.54μs -0.2% 1 → 1 ➡️
matchStreams found 17.54μs 17.71μs +1.0% 1 → 1 ➡️
matchStreams not found 0.05μs 0.06μs +9.2% 0 → 0 ⚪ noise

Summary: 🟢 3 faster · ➡️ 7 neutral · ⚪ 3 ignored (sub-μs)

Thresholds: <1μs ignore · 1–20μs 15% · 20–50μs 10% · ≥50μs 5%. Measured on a shared CI runner — treat small deltas as noise. Informational only; this check never fails the build.

@lukashes

lukashes commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

/bench

@lukashes
lukashes merged commit 8fda403 into main Aug 5, 2026
6 checks passed
@lukashes
lukashes deleted the feat/slot-consistent-point branch August 5, 2026 08:26
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.

1 participant