-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use one Oximeter client per admin server #7171
Conversation
Keeps the admin server's connections to ClickHouse from growing without bound. Also: don't automatically initialize an already-initialized ClickHouse database. This prevents data loss when upgrading. Schema updates for populated databases must be performed manually, as they have been in the past.
clickhouse-admin/src/context.rs
Outdated
let log = clickhouse_cli | ||
.log | ||
.as_ref() | ||
.expect("should have configured logging via CLI or config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fishy to me; can we make clickhouse_cli.log
not optional so we don't need this unwrap? Or alternatively, could we accept a Logger
that we pass through to the client instead of relying on getting it from clickhouse_cli
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed fishy because it was; thanks. 922157b makes ClickhouseCli.log
non-optional.
"can't read ClickHouse version: {e}", | ||
)) | ||
})?; | ||
if version == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With apologies for this question possibly being more relevant to #6903 - how does this interact with Oximeter doing almost exactly (or maybe exactly exactly) this same check-if-0-and-initialize on startup, given the notes about initialization not being concurrency-safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll take this as a follow-up: #7173.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recently came across documentation for ClickHouse's "startup scripts" https://clickhouse.com/docs/en/operations/startup-scripts. Essentially, this would mean we can define the schema directly on the XML configuration files.
<clickhouse>
<startup_scripts>
<scripts>
<query>CREATE DATABASE IF NOT EXISTS oximeter;</query>
</scripts>
<!-- More queries -->
</startup_scripts>
</clickhouse>
Might be worth it to investigate if this works for us? If it does, we wouldn't have to initialize all the tables via the oximeter client.
1c282f9
to
922157b
Compare
Some positive results on
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested across an upgrade on london, and all looked great! 👍
Keeps the admin server's connections to ClickHouse from growing without bound.
Also: don't automatically initialize an already-initialized ClickHouse database. This prevents data loss when upgrading. Schema updates for populated databases must be performed manually, as they have been in the past.