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.

chore(dagster): log staging part names in part breaker (#57059)

Bryan Ciaraldi2f6509c64eec
diff --git a/posthog/dags/part_breaker.py b/posthog/dags/part_breaker.py
index a43187a95dc7..10a02c737830 100644
--- a/posthog/dags/part_breaker.py
+++ b/posthog/dags/part_breaker.py
@@ -1049,6 +1049,17 @@ def break_part(
f"Staging target: {target_count:,} rows in {target_parts} parts (largest: {target_largest_gib:.1f} GiB)"
)
+ # Log staging part names — useful for reconciliation if a later
+ # step fails after ATTACH PARTITION FROM (CH renumbers blocks at the
+ # destination, so these names will not match what lands in the source).
+ staging_part_names = client.execute(
+ "SELECT name FROM system.parts "
+ "WHERE database = %(db)s AND table = %(table)s AND active AND partition_id = %(partition_id)s "
+ "ORDER BY name",
+ {"db": database, "table": staging_target, "partition_id": partition_id},
+ )
+ context.log.info(f"Staging target parts: {[r[0] for r in staging_part_names]}")
+
# Verify count is within tolerance (dedup may reduce slightly)
if source_count > 0:
diff_pct = abs(target_count - source_count) / source_count