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(data-imports): heal delta tables with an empty log segment (#76334)

Tom Owers9e0ec5c6f42b
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
index ebcf00292fe0..823f9c77af4a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta_table_helper.py
@@ -262,8 +262,16 @@ class DeltaTableHelper:
await self._capture_unless_transient(e)
error_text = "".join(str(arg) for arg in e.args)
# Unrecoverable tables (bugged decimals, or an orphaned _delta_log missing its
- # metadata action — impossible on a healthy table): wipe so the sync starts fresh.
- if "parse decimal overflow" in error_text or "No table metadata or protocol found" in error_text:
+ # metadata action or containing no commit files at all, which can't happen on a
+ # healthy table since `is_deltatable` above already confirmed the log directory
+ # exists): wipe so the sync starts fresh. "No files in log segment" is delta-rs's
+ # own kernel raising `DeltaTableError::NotATable` because the log directory has
+ # zero usable commit files, e.g. a stray marker left by an interrupted purge/write.
+ if (
+ "parse decimal overflow" in error_text
+ or "No table metadata or protocol found" in error_text
+ or "No files in log segment" in error_text
+ ):
await self._logger.aerror(
f"get_delta_table: deleting unrecoverable delta table for a fresh sync: {error_text}"
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
index bba2d6fcd681..ae4839726128 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/test/test_delta_table_helper.py
@@ -227,6 +227,11 @@ class TestGetDeltaTableUnrecoverableErrors:
"Kernel error: No table metadata or protocol found in delta log.",
True,
),
+ (
+ "empty_log_segment",
+ "Generic delta kernel error: No files in log segment",
+ True,
+ ),
("bugged_decimal_data", "parse decimal overflow at column x", True),
("other_errors_reraise", "Generic DeltaTable error: something else went wrong", False),
]