Skip to content

Make local server metadata atomic and concurrency-safe - #516

Open
sdairs wants to merge 16 commits into
issue-473-omitted-server-selectionfrom
issue-472-atomic-server-metadata
Open

Make local server metadata atomic and concurrency-safe#516
sdairs wants to merge 16 commits into
issue-473-omitted-server-selectionfrom
issue-472-atomic-server-metadata

Conversation

@sdairs

@sdairs sdairs commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • write local server metadata through unique sibling temporary files with full writes, flush/sync, and atomic rename
  • serialize ClickHouse and Postgres lifecycle, recovery, removal, and stale-PID normalization with per-server cross-process locks so stale state cannot overwrite a restart
  • preserve selected metadata read, permission, parse, and write failures as distinct actionable human and structured errors
  • add deterministic corruption, invalid UTF-8, permission, interrupted-write, concurrent lifecycle/client/stop, and stale-normalization/restart coverage

Closes #472

Tests

  • cargo fmt --all --check
  • cargo build -p clickhousectl
  • cargo check -p clickhousectl --no-default-features
  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl --all-targets -- -D warnings

Stack

@sdairs sdairs changed the title issue 472 atomic server metadata Make local server metadata atomic and concurrency-safe Aug 24, 2026
Comment thread crates/clickhousectl/src/local/server.rs Outdated
Comment thread crates/clickhousectl/src/version_manager/install.rs Outdated
Comment thread crates/clickhousectl/src/local/server.rs
Comment thread crates/clickhousectl/src/local/postgres.rs
Comment thread crates/clickhousectl/src/local/docker.rs Outdated
Comment thread crates/clickhousectl/src/local/server.rs Outdated
Comment thread crates/clickhousectl/src/local/server.rs Outdated
@sdairs
sdairs force-pushed the issue-472-atomic-server-metadata branch from 5fbaee3 to c2c2303 Compare August 25, 2026 12:11
Comment thread crates/clickhousectl/src/local/server.rs
Comment thread crates/clickhousectl/src/local/postgres.rs Outdated
Comment thread crates/clickhousectl/src/local/server.rs
Comment thread crates/clickhousectl/src/local/server.rs
Comment thread crates/clickhousectl/src/local/server.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7ddc1a6. Configure here.

Comment thread crates/clickhousectl/src/local/discovery.rs Outdated
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.

Make local server metadata writes atomic and concurrency-safe

1 participant