Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(redshift): stop reporting transient RPC timeouts during row-count estimation (#79222)

Tom Owersc3a6bfd02b3d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/redshift.py b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/redshift.py
index 951953beff51..50054d3aabd0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/redshift.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/redshift.py
@@ -1106,6 +1106,13 @@ class RedshiftImplementation(SQLSourceImplementation[RedshiftSourceConfig, psyco
return 0
except Exception as e:
logger.debug(f"get_rows_to_sync: Error: {e}. Using 0 as rows to sync", exc_info=e)
+ if "Remote request timeout" in str(e):
+ # Redshift's leader node lost internal RPC contact with a compute node mid-query
+ # (SQLSTATE-less `InternalError_`, code 29150) — a transient cluster-side hiccup,
+ # the same non-actionable class as a WLM/QMR abort (see `has_duplicate_primary_keys`).
+ # Row-count estimation is best-effort (already defaulting to 0 here), so skip
+ # reporting the expected error to error tracking.
+ return 0
capture_exception(e)
if "temporary file size exceeds temp_file_limit" in str(e):
raise TemporaryFileSizeExceedsLimitException(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py
index 623e0913f6d9..54b3f8043359 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/tests/test_redshift.py
@@ -382,6 +382,23 @@ class TestGetRowsToSync:
assert impl.get_rows_to_sync(cursor, self._inner(), None, logger) == 0
mock_capture.assert_not_called()
+ def test_remote_request_timeout_is_not_reported(self, impl, cursor, logger):
+ # A `Remote request timeout` (code 29150) is Redshift's leader node losing internal RPC
+ # contact with a compute node mid-query — a transient cluster-side hiccup, the same
+ # non-actionable class as a WLM/QMR abort. Row-count estimation is best-effort (the caller
+ # defaults to 0), so skip gracefully without reporting the expected error to error tracking.
+ cursor.execute.side_effect = psycopg.errors.InternalError_(
+ "Remote request timeout\nDETAIL: \n -----------------------------------------------\n"
+ " error: Remote request timeout\n code: 29150\n context: \n query: 0\n"
+ " location: redcat_rpc_client.cpp:3197\n process: padbmaster [pid=1074384894]\n"
+ " -----------------------------------------------"
+ )
+ with patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.redshift.redshift.capture_exception"
+ ) as mock_capture:
+ assert impl.get_rows_to_sync(cursor, self._inner(), None, logger) == 0
+ mock_capture.assert_not_called()
+
class TestFetchTableStats:
def test_returns_none_when_no_row(self, impl, cursor, logger):