: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(data-imports): classify ClickHouse deltaLake S3 blips as transient (#80985)
Tom Owers85fe95cb62b9
diff --git a/products/warehouse_sources/backend/models/table.py b/products/warehouse_sources/backend/models/table.pyindex acea21d52e81..bb1f42ab1598 100644--- a/products/warehouse_sources/backend/models/table.py+++ b/products/warehouse_sources/backend/models/table.py@@ -944,6 +944,21 @@ class DataWarehouseTable(CreatedMetaFields, UpdatedMetaFields, UUIDTModel, Delet"This is usually temporary - try again, or narrow the URL pattern if the dataset is very large.")+ # ClickHouse's own deltaLake() S3 table function hits the same transient object-store+ # blips as delta-rs (see TRANSIENT_OBJECT_STORE_ERRORS), just wrapped in a ClickHouse+ # exception instead of an OSError/DeltaError. Recognize it here too, before the generic+ # bucket-misconfiguration fallback below, so it's classified as retryable instead of+ # blamed on the customer's credentials or URL pattern.+ # Deferred: pipelines.core.delta.errors pulls in posthog.temporal.common.errors ->+ # temporalio, which must stay off django.setup(), where this model loads in every process.+ from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.errors import ( # noqa: PLC0415+ TRANSIENT_OBJECT_STORE_ERRORS,+ TransientObjectStoreError,+ )++ if any(needle in raw_message for needle in TRANSIENT_OBJECT_STORE_ERRORS):+ raise TransientObjectStoreError(raw_message)+for key, value in ExtractErrors.items():if key in raw_message:raise Exception(value)diff --git a/products/warehouse_sources/backend/tests/test_table.py b/products/warehouse_sources/backend/tests/test_table.pyindex 00cbfd2246be..e4ad10a18e87 100644--- a/products/warehouse_sources/backend/tests/test_table.py+++ b/products/warehouse_sources/backend/tests/test_table.py@@ -22,6 +22,9 @@ from products.warehouse_sources.backend.models.table import (get_hogql_field_for_column,run_chdb_query,)+from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.errors import (+ TransientObjectStoreError,+)from products.warehouse_sources.backend.types import ExternalDataSourceType@@ -162,6 +165,23 @@ class TestSafeExposeChError:with pytest.raises(Exception, match="Access was denied when reading the provided file"):DataWarehouseTable()._safe_expose_ch_error(delta_kernel_error)+ def test_delta_kernel_object_store_blip_is_retried_not_blamed_on_the_bucket(self) -> None:+ # ClickHouse's own deltaLake() S3 table function hits the same transient object-store+ # blips as delta-rs (e.g. a dropped connection to our own data-warehouse bucket), just+ # wrapped in a ClickHouse exception. Without this check it fell through to the generic+ # "check your credentials" message, which downstream code can no longer recognise as a+ # retryable infra blip (see is_transient_object_store_error) once it's a bare Exception.+ delta_kernel_error = ServerException(+ "DB::Exception: Received DeltaLake kernel error ObjectStoreError: Error interacting with "+ "object store: Generic S3 error: Error performing GET "+ "http://objectstorage:19000/data-warehouse/team_2_postgres_x/dw_table/_delta_log/_last_checkpoint "+ "in 6.1s, after 10 retries, max_retries: 10, retry_timeout: 180s - HTTP error: error sending request",+ code=742, # DELTA_KERNEL_ERROR+ )++ with pytest.raises(TransientObjectStoreError):+ DataWarehouseTable()._safe_expose_ch_error(delta_kernel_error)+class TestRunChdbQuery:def test_hung_query_is_killed_and_raises_instead_of_blocking(self) -> None: