Skip to content

Commit

Permalink
fix(electric): Fix temporary replication slot going over character li…
Browse files Browse the repository at this point in the history
…mit (#1315)

Addresses [this
issue](https://linear.app/electric-sql/issue/VAX-1888/temporary-replication-slot-name-too-long-crashes-electric)

This is a quick fix to avoid failures because of long names but the
longer term solution is to ensure the replication slot names are smaller
in general, see issue description for suggestions.
  • Loading branch information
msfstef authored Jun 3, 2024
1 parent 189bd52 commit c3873fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/yellow-geckos-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@core/electric": patch
---

Truncate temporary replication slot name to always fit within Postgres' limit of 63 chars
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ defmodule Electric.Replication.Postgres.LogicalReplicationProducer do

publication = repl_opts.publication
main_slot = repl_opts.slot
tmp_slot = main_slot <> "_rc"
# Ensure temporary slot name fits within Postgres' limit of 63 chars
tmp_slot = String.slice(main_slot, 0..59) <> "_rc"

Logger.metadata(pg_producer: origin)

Expand Down

0 comments on commit c3873fe

Please sign in to comment.