: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 a generic S3 PUT timeout as transient in repartition (#102920)
Tom Owerscd846c35e758
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/repartition_table.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/repartition_table.pyindex 894bc1a89248..c9ffb69a37ef 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/repartition_table.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/repartition_table.py@@ -39,6 +39,7 @@ from products.warehouse_sources.backend.models.external_data_job import Externalfrom products.warehouse_sources.backend.models.external_data_schema import ExternalDataSchemafrom products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.errors import (is_transient_maintenance_error,+ is_transient_object_store_error,)from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.table import DeltaTableReffrom products.warehouse_sources.backend.temporal.data_imports.pipelines.core.repartition import (@@ -166,6 +167,12 @@ def _is_transient_infra_error(error: Exception) -> bool:# sync self-heals it; burning an attempt and reporting it instead abandons the table after the cap.if isinstance(error, PermissionError):return True+ # Same object-store blips (`Generic S3 error`, SlowDown, S3's internal-error response) that+ # `is_transient_maintenance_error` already recognizes for the maintenance path — the rewrite hits+ # the same data-warehouse bucket the same way, so an OSError/DeltaError matching one of those+ # needles here is exactly as transient.+ if is_transient_object_store_error(error):+ return Truemessage = str(error).lower()return any(snippet in message for snippet in _TRANSIENT_ERROR_SNIPPETS)diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.pyindex 16ff5131cbd3..80e6760bffd0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py@@ -674,6 +674,26 @@ class TestTransientObjectStoreFailure:skip_calls = [c for c in mock_capture_event.call_args_list if c.args[0] == "warehouse_repartition_skipped"]assert any(c.args[1].get("reason") == "transient_infra_error" for c in skip_calls)+ @parameterized.expand(+ [+ (+ "s3_permission_error",+ # s3fs raises a bare PermissionError for a transient credential-resolution race+ # against our own data-warehouse bucket.+ PermissionError("Access Denied"),+ ),+ (+ "generic_s3_timeout",+ # delta-rs's Rust object_store crate raises a bare OSError with a "Generic S3 error"+ # prefix for a PUT that timed out reaching our own data-warehouse bucket — the same+ # blip `is_transient_maintenance_error` already recognizes for the maintenance path.+ OSError(+ "Generic S3 error: Error performing PUT https://s3.example.com/bucket/path/_delta_log/"+ "00000000000000000143.json in 30.001s - HTTP error: error sending request: operation timed out"+ ),+ ),+ ]+ )@patch(f"{MODULE}.capture_exception")@patch(f"{MODULE}.capture_repartition_event")@patch(f"{MODULE}.HeartbeaterSync")@@ -682,8 +702,10 @@ class TestTransientObjectStoreFailure:@patch(f"{MODULE}.is_auto_repartition_enabled", return_value=True)@patch(f"{MODULE}.ExternalDataJob")@patch(f"{MODULE}.ExternalDataSchema")- def test_s3_permission_error_stands_down_without_burning_an_attempt(+ def test_object_store_blip_stands_down_without_burning_an_attempt(self,+ _name: str,+ error: Exception,mock_schema_model: MagicMock,_mock_job_model: MagicMock,_mock_enabled: MagicMock,@@ -693,13 +715,12 @@ class TestTransientObjectStoreFailure:mock_capture_event: MagicMock,mock_capture_exception: MagicMock,) -> None:- # s3fs raises a bare PermissionError for a transient credential-resolution race against our own- # data-warehouse bucket. It must stand down like the other infra blips, not burn an attempt or- # report a failure — otherwise a flagged table loses its whole retry budget to a self-healing- # blip and is abandoned at the cap.+ # Each of these must stand down like the other infra blips, not burn an attempt or report a+ # failure — otherwise a flagged table loses its whole retry budget to a self-healing blip and+ # is abandoned at the cap.schema = _schema(name="public.usages", s3_folder_name="usages", pending={**PENDING_TARGET, "attempts": 0})mock_schema_model.objects.select_related.return_value.get.return_value = schema- mock_repartition.side_effect = PermissionError("Access Denied")+ mock_repartition.side_effect = error_maybe_repartition_table(RepartitionActivityInputs(team_id=TEAM_ID, schema_id=SCHEMA_ID, job_id=JOB_ID, source_id=SOURCE_ID),