: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(postgres): stop retrying a provider data-transfer quota block (#101540)
Tom Owersa8d3ae49ddee
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.pyindex 46bcee0e137f..042ed6ad540e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py@@ -862,6 +862,17 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa"connect until the database is available again. Upgrade your provider's plan or wait ""for the quota to reset, then re-enable the sync."),+ # The same provider family (observed on Neon) blocks the handshake when the project's+ # data-transfer allowance is spent, wording it as a plain libpq ERROR rather than a+ # connection failure. The block only lifts when the customer upgrades the plan or the+ # billing period resets, so a whole-activity retry re-hits it exactly like the+ # compute-time quota above. Match the stable quota phrase and exclude the volatile+ # host/IP and port libpq prefixes it with.+ "exceeded the data transfer quota": (+ "Your database provider blocked the connection because your project exceeded its data "+ "transfer quota. Upgrade your provider's plan or wait for the quota to reset, then "+ "re-enable the sync."+ ),# A database proxy (observed on Prisma Accelerate) refuses the connection because the# account hit a plan limit, reporting "Your account has restrictions: planLimitReached".# The restriction is account-level state only the customer can lift (upgrade the plan ordiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.pyindex 7c82b6f04967..46facf9ab6cb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py@@ -764,25 +764,35 @@ class TestPostgresSourceNonRetryableErrors:assert "pg_hba.conf" in friendly[0]@pytest.mark.parametrize(- "error_msg",+ "error_msg,expected_fragment",[# Neon suspends compute when the plan's compute-time quota is exhausted; the handshake# fails with this provider message. The host/IP and port are volatile and excluded.- 'connection failed: connection to server at "44.198.216.75", port 5432 failed: ERROR: Your account or project has exceeded the compute time quota. Upgrade your plan to increase limits.',- "OperationalError: Your account or project has exceeded the compute time quota. Upgrade your plan to increase limits.",+ (+ 'connection failed: connection to server at "44.198.216.75", port 5432 failed: ERROR: Your account or project has exceeded the compute time quota. Upgrade your plan to increase limits.',+ "compute-time quota",+ ),+ (+ "OperationalError: Your account or project has exceeded the compute time quota. Upgrade your plan to increase limits.",+ "compute-time quota",+ ),+ # The same provider family blocks the handshake once the project's data-transfer+ # allowance is spent, so it needs the same classification as the compute-time quota.+ (+ 'connection failed: connection to server at "203.0.113.10", port 5432 failed: ERROR: Your project has exceeded the data transfer quota. Upgrade your plan to increase limits.',+ "data transfer quota",+ ),+ (+ "OperationalError: Your project has exceeded the data transfer quota. Upgrade your plan to increase limits.",+ "data transfer quota",+ ),],)- def test_exceeded_compute_time_quota_is_non_retryable(self, source, error_msg):- non_retryable = source.get_non_retryable_errors()- is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())- assert is_non_retryable, f"Exceeded compute-time quota error should be non-retryable: {error_msg}"-- def test_exceeded_compute_time_quota_returns_friendly_message(self, source):+ def test_exceeded_provider_quota_is_non_retryable_with_friendly_message(self, source, error_msg, expected_fragment):non_retryable = source.get_non_retryable_errors()- error_msg = "Your account or project has exceeded the compute time quota. Upgrade your plan to increase limits."friendly = [reason for pattern, reason in non_retryable.items() if pattern in error_msg and reason]- assert friendly, "Exceeded compute-time quota error should surface an actionable message"- assert "compute-time quota" in friendly[0]+ assert friendly, f"Exceeded provider quota error should surface an actionable message: {error_msg}"+ assert expected_fragment in friendly[0]@pytest.mark.parametrize("error_msg",