Repository navigation
fix(sessions): rebuild sessions v3 tables on self-hosted upgrade - #127889
Conversation
…installs Migration 0364 created the v3 MVs on top of the existing v3 table. An install that created v3 before the shape change still had uniqExact count columns, so ClickHouse refused the MV and migrate_clickhouse failed on upgrade. Off cloud, 0364 now drops the v3 tables and views and creates them again from the current definitions. Nothing wrote to v3 there since 0178, and v2 stays the default, so only stale rows go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: be030037-bc82-4088-8a1d-fe367ee20c39
|
😎 Merged successfully - details. |
🤖 CI report
|
There was a problem hiding this comment.
PostHog Review · Standard · reviewed f49fb74: 1 Should fix.
This is the only automatic review while this pull request is a draft. Comment @posthog review to review new changes sooner. Otherwise, a review of the new changes runs when you mark it ready for review.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
|
Risk: No findings A ClickHouse-migration-only fix: off-cloud, migration 0364 now drops and recreates the sessions v3 tables/view/MVs from current definitions (fixing the uniq/uniqExact conversion failure on self-hosted upgrades) and lifts the drop-size guard on the sharded table drop. I traced the data-loss claim (0178 unconditionally dropped the v3 ingestion MVs, and the replacement pipeline in 0328 is cloud-only, so off-cloud v3 rows are stale), verified drop/create idempotency and ordering against the 0158 precedent, and confirmed no later migration or code path depends on the old shape. No security issues found. Sentinel reviewed |
|
/trunk merge |
Problem
migrate_clickhousestops at0364_sessions_v3_more_ad_ids.Conversion from AggregateFunction(uniq, Nullable(UUID)) to AggregateFunction(uniqExact, Nullable(UUID)) is not supported.uniq. Off cloud,0364creates the new MV on top of the old v3 table, which still hasuniqExactcolumns.Changes
0364. The migration drops the v3 tables, view and MVs, then creates them from the current definitions.0178removed them. Sessions reads default to v2, so no query result changes.sharded_eventsandsession_replay_events.flag_keysand the old bloom filters, so the three unusedDROP_FLAG_*constants go.0364still has no operations there.How did you test this code?
0364fail with the error above. The new0364passes, givesuniqcolumns, and passes again on a second run.posthog/clickhouse/test/test_migrations.pypasses.Test rationale: no new test. The bug needs an old-shape table, which the test database never has.
Release status
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, claude-opus-5-5
Skills:
/clickhouse-migrations,/writing-pr-descriptions,/simplifyMore context for AI agents
docker logstrace.0364and adds no new migration, because a failed0364re-runs and must stop failing. It follows the drop-and-create order of0158.sharded_raw_sessions_v3off cloud, and that the cloud gate relies onCLOUD_DEPLOYMENTbeing set on the pod.Created with PostHog Desktop from a PostHog Desktop task
🤖 Generated with Claude Code