Skip to content

fix: use clickhouse.cluster for async migration polling (#207) - #219

Merged
vesperships merged 1 commit into
mainfrom
fix/207-async-cluster-hardcode
Sep 28, 2026
Merged

vesperships merged 1 commit into
mainfrom
fix/207-async-cluster-hardcode

Conversation

@vesperships

Copy link
Copy Markdown
Collaborator

Summary

Fixes #207.

Async migration polling and backfill progress reconciliation hardcoded clusterAllReplicas('cluster', ...), so clusters configured as e.g. moebel_cluster failed with Requested cluster 'cluster' not found.

Design

  1. Optional systemTableSource?(table: 'processes' | 'query_log'): string on ClickHouseExecutor (not mandatory — remote/ObsessionDB executors may omit it).
  2. Shared observableSystemTable(executor, table) helper: uses the capability when present, else system.${table}.
  3. Native executor:
    • clickhouse.cluster set → clusterAllReplicas('<name>', system.${table}) (name already validated at resolveConfig, same contract as onClusterClause)
    • unset → local system.${table} (never guesses 'cluster')
  4. queryStatus() (@chkit/clickhouse) and syncProgress() (@chkit/plugin-backfill) both go through observableSystemTable — one owner.
  5. Debug executor wrapper forwards systemTableSource when present so capability is not stripped under --debug.

Literal cluster name cluster still works when configured as such.

Test plan

  • @chkit/clickhouse unit tests: named cluster, no cluster (no literal 'cluster' emitted), {cluster} macro, configured 'cluster', capability fallback, queryStatus SQL capture
  • @chkit/plugin-backfill syncProgress tests: clustered capability, no-capability local fallback, undefined capability still reconciles
  • bun run typecheck / bun run lint / bun test for @chkit/clickhouse and @chkit/plugin-backfill
  • bun run typecheck / bun run lint for @chkit/cli (debug wrapper)

Hardcoded clusterAllReplicas('cluster', ...) broke async mode when
clickhouse.cluster was set to a real name. Add optional
systemTableSource on ClickHouseExecutor, shared observableSystemTable
helper, and wire queryStatus + backfill syncProgress through it.
@vesperships
vesperships merged commit 7fe44e5 into main Sep 28, 2026
12 checks passed
@vesperships
vesperships deleted the fix/207-async-cluster-hardcode branch September 28, 2026 02:32
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.

bug: hardcoded cluster on async migrations

1 participant