Skip to content

Check the slot's database and plugin before reusing it - #152

Open
lukashes wants to merge 1 commit into
mainfrom
bugfix/slot-check-and-feedback
Open

Check the slot's database and plugin before reusing it#152
lukashes wants to merge 1 commit into
mainfrom
bugfix/slot-check-and-feedback

Conversation

@lukashes

Copy link
Copy Markdown
Owner

Slot names are global to the cluster, but slotExists matched on the name alone.
A slot of the same name in another database, or one running another output
plugin, passed the check, and START_REPLICATION then failed on every start: a
restart loop the supervisor cannot heal.

  • slotExists reads database and plugin alongside current_database() and
    rejects a foreign slot with SlotMismatch, naming both sides in the log.
    Returning "no slot" instead would send the run into createSlot, which fails
    on the name clash and, on the snapshot path, leaves a marker publication behind
    on every restart.
  • The drain loop no longer swallows receive errors. A broken connection there is
    the same failure the blocking receive reports, so it propagates instead of
    ending the batch as if the buffer had run dry. Nothing is lost: the batch LSN
    was never confirmed.
  • client_time in the standby status update is microseconds since 2000-01-01,
    not Unix seconds, so pg_stat_replication.reply_time reads as a real
    timestamp.

Closes #97.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

Benchmark Baseline Current Δ Time Allocs Status
Converter DELETE 141.54μs 142.70μs +0.8% 13 → 13 ➡️
Converter INSERT 138.23μs 142.16μs +2.8% 13 → 13 ➡️
Converter UPDATE 173.13μs 172.14μs -0.6% 22 → 22 ➡️
JsonSerializer 49.90μs 50.00μs +0.2% 3 → 3 ➡️
KafkaProducer produce 232.79μs 211.54μs -9.1% 1 → 1 🟢 faster
KafkaProducer send 273.86μs 248.01μs -9.4% 0 → 0 🟢 faster
PgOutputDecoder 94.89μs 95.30μs +0.4% 6 → 6 ➡️
getPartitionKeyValue boolean 15.45μs 15.35μs -0.6% 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.19μs 17.23μs +0.2% 1 → 1 ➡️
matchStreams found 17.23μs 17.11μs -0.6% 1 → 1 ➡️
matchStreams not found 0.06μs 0.06μs +0.0% 0 → 0 ⚪ noise

Summary: 🟢 2 faster · ➡️ 8 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.

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.

Postgres source: slot startup check and feedback inaccuracies

1 participant