-
Notifications
You must be signed in to change notification settings - Fork 39
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
Single node clickhouse init #6903
base: clickhouse-admin-smf-package-cleanup
Are you sure you want to change the base?
Single node clickhouse init #6903
Conversation
Uses new internal nexus API endpoints.
cf515bc
to
e725a76
Compare
let admin_url = format!("http://{admin_addr}"); | ||
let log = opctx.log.new(slog::o!("admin_url" => admin_url.clone())); | ||
let client = ClickhouseSingleClient::new(&admin_url, log.clone()); | ||
client.init_db().await.map(|_| ()).map_err(|e| { |
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's unclear to me if this is the right place to try to do this initialization, since we'll presumably have just spun up the server. It might be better to wait until the single-node server appears in an inventory collection, like the multi-node server does. OTOH, it shouldn't take long to start an uninitialized database, so we might be able to get away with a small retry loop and some longish timeouts, which seems significantly simpler. Opinions welcome.
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.
You could ping
the server and wait for that to succeed before trying this. The init_db()
call also returns an error indicating the server isn't available, so you might be able to just retry this call itself. The SQL it applies is idempotent.
63d3ba4
to
79713cb
Compare
Depends on #6894, replaces #6878, fixes #6826 on the server side.
Adds a new Dropshot server,
clickhouse-admin-single
, analogous toclickhouse-admin-keeper
andclickhouse-admin-server
(which were split off fromclickhouse-admin
in #6837). Its sole purpose is to initialize the single-node ClickHouse database with the current Oximeter schema. We use a single in-memory lock (atokio::sync::Mutex
) to serialize initialization requests. Multi-node ClickHouse clusters will need something analogous as a follow-up.Still needs testing. My
a4x2
cluster is currently being uncooperative, and so this has not been through a successful "spin-up, expunge ClickHouse, regenerate" cycle. Also missing unit tests.