plausible / analytics

Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
https://plausible.io
GNU Affero General Public License v3.0
19.57k stars 1.04k forks source link

Check to determine if Clickhouse tables should be clustered is catastrophically flawed #3749

Closed doctorpangloss closed 1 month ago

doctorpangloss commented 7 months ago

Past Issues Searched

Issue is a Bug Report

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

https://github.com/plausible/analytics/blob/51f0e406a05d2f11afb4e71e824b994aa19f4221/lib/plausible/data_migration/numeric_ids.ex#L49 which calls

SELECT 1 FROM system.replicas WHERE table = 'events'

On a clean clustered Clickhouse, this will return 0.

Expected behavior

You must determine if clustered tables should be used some other way.

Screenshots

No response

Environment

No response

doctorpangloss commented 7 months ago
select 1 from system.clusters where host_address != '127.0.0.1'

should work instead. additionally, the legacy ddl needs to be updated