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(analytics-platform): disable INSERT quorum in local dev so lazy precompute does not hang (#59250)

Lucas Ricoyfe2a77bf1fef
diff --git a/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py b/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
index 7e3c386f8d40..a6c120edb1db 100644
--- a/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
+++ b/products/analytics_platform/backend/lazy_computation/lazy_computation_executor.py
@@ -28,7 +28,7 @@ from posthog.clickhouse.client import sync_execute
from posthog.clickhouse.preaggregation.sql import DISTRIBUTED_PREAGGREGATION_RESULTS_TABLE
from posthog.clickhouse.query_tagging import tags_context
from posthog.models.team import Team
-from posthog.settings import HOGQL_INCREASED_MAX_EXECUTION_TIME, TEST
+from posthog.settings import DEBUG, HOGQL_INCREASED_MAX_EXECUTION_TIME, TEST
from posthog.utils import relative_date_parse_with_delta_mapping
from products.analytics_platform.backend.lazy_computation.computation_notifications import (
@@ -67,9 +67,10 @@ DEFAULT_CH_START_GRACE_PERIOD_SECONDS = 60 # 1 minute
# Quorum for INSERT queries. "auto" = majority of replicas must acknowledge writes before
# the INSERT returns. This ensures data is replicated before the subsequent SELECT reads it,
# preventing stale reads from hitting a replica that hasn't received the data yet.
-# Disabled in tests to avoid quorum behavior (tests usually run against a single-node or simplified
-# ClickHouse setup and we want them to remain fast and deterministic).
-PREAGGREGATION_INSERT_QUORUM: str | int = 0 if TEST else "auto"
+# Disabled in tests AND local dev (DEBUG) — both run against a single-node ClickHouse
+# where `insert_quorum=auto` waits 600s for an acknowledgement that never comes (the local
+# replica writes immediately but ClickHouse still blocks on the quorum protocol).
+PREAGGREGATION_INSERT_QUORUM: str | int = 0 if TEST or DEBUG else "auto"
def _get_insert_settings(team_id: int) -> dict: