Skip to content

Commit

Permalink
revert SET LOCAL in replconn hold (#1530)
Browse files Browse the repository at this point in the history
was a bug, `SET LOCAL` has no effect outside transactions, can cause
replication connections to close
  • Loading branch information
heavycrystal authored Mar 24, 2024
1 parent b0bdc86 commit 5ea2523
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flow/connectors/postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,13 @@ func (c *PostgresConnector) createSlotAndPublication(

c.logger.Warn(fmt.Sprintf("Creating replication slot '%s'", slot))

_, err = conn.Exec(ctx, "SET LOCAL idle_in_transaction_session_timeout=0")
// THIS IS NOT IN A TX!
_, err = conn.Exec(ctx, "SET idle_in_transaction_session_timeout=0")
if err != nil {
return fmt.Errorf("[slot] error setting idle_in_transaction_session_timeout: %w", err)
}

_, err = conn.Exec(ctx, "SET LOCAL lock_timeout=0")
_, err = conn.Exec(ctx, "SET lock_timeout=0")
if err != nil {
return fmt.Errorf("[slot] error setting lock_timeout: %w", err)
}
Expand Down

0 comments on commit 5ea2523

Please sign in to comment.