From 5ea25234b622520beb41af896ddc9b91929809c1 Mon Sep 17 00:00:00 2001 From: Kevin Biju <52661649+heavycrystal@users.noreply.github.com> Date: Mon, 25 Mar 2024 01:33:12 +0530 Subject: [PATCH] revert SET LOCAL in replconn hold (#1530) was a bug, `SET LOCAL` has no effect outside transactions, can cause replication connections to close --- flow/connectors/postgres/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flow/connectors/postgres/client.go b/flow/connectors/postgres/client.go index 54df692986..012b78a998 100644 --- a/flow/connectors/postgres/client.go +++ b/flow/connectors/postgres/client.go @@ -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) }