Skip to content

Comments

fix: ClickHouse compatibility and database scoping bugs#85

Open
steffen-roemer wants to merge 1 commit intoPostHog:mainfrom
steffen-roemer:fix/clickhouse-compat-and-database-scoping
Open

fix: ClickHouse compatibility and database scoping bugs#85
steffen-roemer wants to merge 1 commit intoPostHog:mainfrom
steffen-roemer:fix/clickhouse-compat-and-database-scoping

Conversation

@steffen-roemer
Copy link

Summary

Fixes several bugs that break HouseWatch on single-node setups and newer ClickHouse versions:

  • Logs 500 error (fixes analyze/logs returns 500 #53): TEXT_LOG_SYSTEM_TABLE fallback used "system.text" instead of "system.text_log" — the table doesn't exist, causing 500 on /api/analyze/logs and /api/analyze/logs_frequency
  • Schema page stuck loading: The tables endpoint used AVAILABLE_TABLES_SQL (returns {database, table}) but the schema page frontend expects {name, total_bytes, ...} from TABLES_SQL. Switched the endpoint to use TABLES_SQL
  • Database scoping: TABLES_SQL, SCHEMA_SQL, and PARTS_SQL had no WHERE database = ... filter, returning results from all databases. Now scoped to CLICKHOUSE_DATABASE
  • Disk usage stuck loading: NODE_STORAGE_SQL filtered on type = 'local' but newer ClickHouse versions (tested on 26.1.2) use 'Local' (capitalized). Changed to lower(type) = 'local'

Test plan

  • /api/analyze/logs returns log entries instead of 500
  • /api/analyze/logs_frequency returns frequency data instead of 500
  • /schema page loads table list with sizes and row counts
  • /schema/{table} shows column details scoped to configured database
  • Disk usage page shows node storage info
  • Tested on ClickHouse 26.1.2, single-node, non-cluster setup

- Fix TEXT_LOG_SYSTEM_TABLE fallback using non-existent "system.text"
  instead of "system.text_log" (fixes PostHog#53)
- Scope TABLES_SQL, SCHEMA_SQL, and PARTS_SQL to CLICKHOUSE_DATABASE
  to avoid returning results from all databases
- Use TABLES_SQL in the tables endpoint so the schema page gets the
  fields it expects (name, total_bytes, etc.)
- Fix disk usage query filtering on type = 'local' which is now 'Local'
  in newer ClickHouse versions (case-sensitive mismatch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analyze/logs returns 500

1 participant