: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(redshift): stop retrying a query that times out on every attempt (#84638)
Tom Owers18579f50cf03
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.pyindex 8df8a3ec9f14..071948ef9956 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/redshift/source.py@@ -158,6 +158,13 @@ class RedshiftSource(SQLSource[RedshiftSourceConfig], SSHTunnelMixin, ValidateDa"server does not support SSL": None,"does not exist": None,"QueryTimeoutException": None,+ # `QueryTimeoutException` above only matches once Temporal's `ApplicationError` wraps+ # the failure with the class name (workflow layer) — the activity-level check matches+ # `str(e)` on the raw exception, which is just the message with no class name. Match+ # the stable prefix too (not the incremental field name, which varies per table) so a+ # table missing the SORTKEY stops retrying at the activity layer instead of burning a+ # full retry budget on a 10-minute query that will time out identically every time.+ "10 min timeout statement reached": None,"TemporaryFileSizeExceedsLimitException": None,"Name or service not known": None,"Network is unreachable": None,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.pyindex c79b4cfbc3b4..d7bc46f210ec 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@@ -1120,6 +1120,17 @@ class TestRedshiftSourceNonRetryableErrors:is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())assert is_non_retryable+ def test_query_timeout_raw_message_is_non_retryable(self):+ # Mirrors the `InsufficientPrivilege` case above: the activity-level check matches raw+ # `str(exception)`, which for `QueryTimeoutException` is just the message with no class+ # name — only the `QueryTimeoutException` key (workflow layer only) would miss this,+ # letting the activity retry a query that times out identically every attempt because the+ # table's incremental field isn't a SORTKEY.+ error_msg = "10 min timeout statement reached. Please ensure your incremental field (updated_at) is set as a SORTKEY on the table"+ non_retryable = RedshiftSource().get_non_retryable_errors()+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())+ assert is_non_retryable+class TestRedshiftValidateCredentials:def test_server_without_ssl_returns_friendly_error_without_capturing(self, mocker):