Skip to content

Keep stopped ClickHouse servers discoverable - #356

Open
sdairs wants to merge 4 commits into
codex/issue-326-default-local-instancefrom
codex/issue-324-list-stopped-servers
Open

Keep stopped ClickHouse servers discoverable#356
sdairs wants to merge 4 commits into
codex/issue-326-default-local-instancefrom
codex/issue-324-list-stopped-servers

Conversation

@sdairs

@sdairs sdairs commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • retain ClickHouse server identity metadata with pid: 0 after clean stops, foreground exits, failed starts, and stale-process detection
  • clear and omit transient ClickHouse version and port details while stopped because each start resolves them again
  • reject client and dotenv connections to stopped entries
  • add subprocess coverage for start/stop/list, stale metadata normalization, and stopped connection commands
  • document retained identity metadata and stopped-server listing

Stack

This PR is stacked on #355 and should be reviewed as the delta from codex/issue-326-default-local-instance.

Closes #324.

Validation

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Retains ClickHouse local-server metadata after a server stops so stopped instances remain discoverable in clickhousectl local server list, while clearing transient runtime details (PID/version/ports) for stopped ClickHouse entries and preventing connection helpers from using stopped metadata.

Changes:

  • Preserve ClickHouse server metadata on stop/foreground-exit/failed-start and normalize stale PID metadata to a stopped sentinel (pid: 0, cleared ports/version).
  • Hide ClickHouse version/ports in list output when stopped, and reject local client / local server dotenv lookups against stopped entries.
  • Add subprocess regression tests covering stop/list normalization and stopped-connection failures; update README docs accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents retained identity metadata for stopped servers and listing behavior.
crates/clickhousectl/tests/local_server_stopped_test.rs Adds subprocess regression coverage for stopped metadata retention/normalization and connection rejection.
crates/clickhousectl/src/local/server.rs Introduces mark_server_stopped, keeps metadata on stop, and normalizes stale ClickHouse PIDs to “stopped”.
crates/clickhousectl/src/local/mod.rs Rejects client/dotenv commands for stopped entries; suppresses ClickHouse runtime fields in list output when stopped; keeps metadata after foreground exit.
crates/clickhousectl/src/local/cli.rs Updates CLI help text for list/stop/stop-all to reflect preserved metadata behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/clickhousectl/src/local/cli.rs Outdated
@sdairs
sdairs force-pushed the codex/issue-324-list-stopped-servers branch from 5d3bfe9 to 68db554 Compare August 3, 2026 18:42
@sdairs
sdairs force-pushed the codex/issue-324-list-stopped-servers branch from 68db554 to 9f4adcf Compare August 3, 2026 19:34
@sdairs
sdairs force-pushed the codex/issue-324-list-stopped-servers branch from 9f4adcf to 8409efb Compare August 3, 2026 20:04
@sdairs
sdairs marked this pull request as ready for review August 3, 2026 20:25
@sdairs
sdairs requested review from iskakaushik and rndD as code owners August 3, 2026 20:25

@iskakaushik iskakaushik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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.

Stopped ClickHouse servers vanish from server list despite "running and stopped" help text

3 participants