Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"clickhouse-admin",
"clickhouse-admin/api",
"clickhouse-admin/test-utils",
"clickhouse-admin/types/versions",
"clients/bootstrap-agent-client",
"clients/clickhouse-admin-keeper-client",
"clients/clickhouse-admin-server-client",
Expand Down Expand Up @@ -168,6 +169,7 @@ default-members = [
"clickhouse-admin",
"clickhouse-admin/api",
"clickhouse-admin/types",
"clickhouse-admin/types/versions",
"clickhouse-admin/test-utils",
"clients/bootstrap-agent-client",
"clients/clickhouse-admin-keeper-client",
Expand Down Expand Up @@ -409,6 +411,7 @@ clickhouse-admin-keeper-client = { path = "clients/clickhouse-admin-keeper-clien
clickhouse-admin-server-client = { path = "clients/clickhouse-admin-server-client" }
clickhouse-admin-single-client = { path = "clients/clickhouse-admin-single-client" }
clickhouse-admin-types = { path = "clickhouse-admin/types" }
clickhouse-admin-types-versions = { path = "clickhouse-admin/types/versions" }
clickhouse-admin-test-utils = { path = "clickhouse-admin/test-utils" }
clickward = { git = "https://github.com/oxidecomputer/clickward", rev = "e3d9a1c35cf3cd04f9cb2e997b0ad88324d30737" }
cockroach-admin-api = { path = "cockroach-admin/api" }
Expand Down
2 changes: 1 addition & 1 deletion clickhouse-admin/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MPL-2.0"
workspace = true

[dependencies]
clickhouse-admin-types.workspace = true
clickhouse-admin-types-versions.workspace = true
dropshot.workspace = true
dropshot-api-manager-types.workspace = true
omicron-common.workspace = true
Expand Down
49 changes: 28 additions & 21 deletions clickhouse-admin/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use clickhouse_admin_types::{
ClickhouseKeeperClusterMembership, DistributedDdlQueue,
GenerateConfigResult, KeeperConf, KeeperConfigurableSettings, Lgif,
MetricInfoPath, RaftConfig, ServerConfigurableSettings, SystemTimeSeries,
TimeSeriesSettingsQuery,
};
use clickhouse_admin_types_versions::latest;
use dropshot::{
HttpError, HttpResponseCreated, HttpResponseOk,
HttpResponseUpdatedNoContent, Path, Query, RequestContext, TypedBody,
Expand Down Expand Up @@ -73,8 +68,11 @@ pub trait ClickhouseAdminKeeperApi {
}]
async fn generate_config_and_enable_svc(
rqctx: RequestContext<Self::Context>,
body: TypedBody<KeeperConfigurableSettings>,
) -> Result<HttpResponseCreated<GenerateConfigResult>, HttpError>;
body: TypedBody<latest::keeper::KeeperConfigurableSettings>,
) -> Result<
HttpResponseCreated<latest::config::GenerateConfigResult>,
HttpError,
>;

/// Retrieve the generation number of a configuration
#[endpoint {
Expand All @@ -94,7 +92,7 @@ pub trait ClickhouseAdminKeeperApi {
}]
async fn lgif(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Lgif>, HttpError>;
) -> Result<HttpResponseOk<latest::keeper::Lgif>, HttpError>;

/// Retrieve information from ClickHouse virtual node /keeper/config which
/// contains last committed cluster configuration.
Expand All @@ -104,7 +102,7 @@ pub trait ClickhouseAdminKeeperApi {
}]
async fn raft_config(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<RaftConfig>, HttpError>;
) -> Result<HttpResponseOk<latest::keeper::RaftConfig>, HttpError>;

/// Retrieve configuration information from a keeper node.
#[endpoint {
Expand All @@ -113,7 +111,7 @@ pub trait ClickhouseAdminKeeperApi {
}]
async fn keeper_conf(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<KeeperConf>, HttpError>;
) -> Result<HttpResponseOk<latest::keeper::KeeperConf>, HttpError>;

/// Retrieve cluster membership information from a keeper node.
#[endpoint {
Expand All @@ -122,7 +120,10 @@ pub trait ClickhouseAdminKeeperApi {
}]
async fn keeper_cluster_membership(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<ClickhouseKeeperClusterMembership>, HttpError>;
) -> Result<
HttpResponseOk<latest::keeper::ClickhouseKeeperClusterMembership>,
HttpError,
>;
}

/// API interface for our clickhouse-admin-server server
Expand All @@ -148,8 +149,11 @@ pub trait ClickhouseAdminServerApi {
}]
async fn generate_config_and_enable_svc(
rqctx: RequestContext<Self::Context>,
body: TypedBody<ServerConfigurableSettings>,
) -> Result<HttpResponseCreated<GenerateConfigResult>, HttpError>;
body: TypedBody<latest::server::ServerConfigurableSettings>,
) -> Result<
HttpResponseCreated<latest::config::GenerateConfigResult>,
HttpError,
>;

/// Retrieve the generation number of a configuration
#[endpoint {
Expand All @@ -168,7 +172,10 @@ pub trait ClickhouseAdminServerApi {
}]
async fn distributed_ddl_queue(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<DistributedDdlQueue>>, HttpError>;
) -> Result<
HttpResponseOk<Vec<latest::server::DistributedDdlQueue>>,
HttpError,
>;

/// Retrieve time series from the system database.
///
Expand All @@ -181,9 +188,9 @@ pub trait ClickhouseAdminServerApi {
}]
async fn system_timeseries_avg(
rqctx: RequestContext<Self::Context>,
path_params: Path<MetricInfoPath>,
query_params: Query<TimeSeriesSettingsQuery>,
) -> Result<HttpResponseOk<Vec<SystemTimeSeries>>, HttpError>;
path_params: Path<latest::server::MetricInfoPath>,
query_params: Query<latest::server::TimeSeriesSettingsQuery>,
) -> Result<HttpResponseOk<Vec<latest::server::SystemTimeSeries>>, HttpError>;

/// Idempotently initialize a replicated ClickHouse cluster database.
#[endpoint {
Expand Down Expand Up @@ -225,7 +232,7 @@ pub trait ClickhouseAdminSingleApi {
}]
async fn system_timeseries_avg(
rqctx: RequestContext<Self::Context>,
path_params: Path<MetricInfoPath>,
query_params: Query<TimeSeriesSettingsQuery>,
) -> Result<HttpResponseOk<Vec<SystemTimeSeries>>, HttpError>;
path_params: Path<latest::server::MetricInfoPath>,
query_params: Query<latest::server::TimeSeriesSettingsQuery>,
) -> Result<HttpResponseOk<Vec<latest::server::SystemTimeSeries>>, HttpError>;
}
10 changes: 6 additions & 4 deletions clickhouse-admin/src/clickhouse_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use anyhow::Result;
use camino::Utf8PathBuf;
use clickhouse_admin_types::{
ClickhouseKeeperClusterMembership, DistributedDdlQueue, KeeperConf,
KeeperId, Lgif, OXIMETER_CLUSTER, RaftConfig, SystemTimeSeries,
SystemTimeSeriesSettings,
use clickhouse_admin_types::OXIMETER_CLUSTER;
use clickhouse_admin_types::keeper::{
ClickhouseKeeperClusterMembership, KeeperConf, KeeperId, Lgif, RaftConfig,
};
use clickhouse_admin_types::server::{
DistributedDdlQueue, SystemTimeSeries, SystemTimeSeriesSettings,
};
use dropshot::HttpError;
use illumos_utils::{ExecutionError, output_to_exec_error};
Expand Down
7 changes: 3 additions & 4 deletions clickhouse-admin/src/clickward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use clickhouse_admin_types::{
KeeperConfig, KeeperConfigurableSettings, ReplicaConfig,
ServerConfigurableSettings,
};
use clickhouse_admin_types::config::{KeeperConfig, ReplicaConfig};
use clickhouse_admin_types::keeper::KeeperConfigurableSettings;
use clickhouse_admin_types::server::ServerConfigurableSettings;
use dropshot::HttpError;
use slog_error_chain::{InlineErrorChain, SlogInlineError};

Expand Down
5 changes: 3 additions & 2 deletions clickhouse-admin/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use crate::{ClickhouseCli, Clickward};

use anyhow::{Context, Result, anyhow, bail};
use camino::Utf8PathBuf;
use clickhouse_admin_types::config::GenerateConfigResult;
use clickhouse_admin_types::keeper::KeeperConfigurableSettings;
use clickhouse_admin_types::server::ServerConfigurableSettings;
use clickhouse_admin_types::{
CLICKHOUSE_KEEPER_CONFIG_DIR, CLICKHOUSE_KEEPER_CONFIG_FILE,
CLICKHOUSE_SERVER_CONFIG_DIR, CLICKHOUSE_SERVER_CONFIG_FILE,
GenerateConfigResult, KeeperConfigurableSettings,
ServerConfigurableSettings,
};
use dropshot::{ClientErrorStatusCode, HttpError};
use flume::{Receiver, Sender, TrySendError};
Expand Down
13 changes: 8 additions & 5 deletions clickhouse-admin/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

use crate::context::{KeeperServerContext, ServerContext};
use clickhouse_admin_api::*;
use clickhouse_admin_types::{
ClickhouseKeeperClusterMembership, DistributedDdlQueue,
GenerateConfigResult, KeeperConf, KeeperConfigurableSettings, Lgif,
MetricInfoPath, RaftConfig, ServerConfigurableSettings, SystemTimeSeries,
SystemTimeSeriesSettings, TimeSeriesSettingsQuery,
use clickhouse_admin_types::config::GenerateConfigResult;
use clickhouse_admin_types::keeper::{
ClickhouseKeeperClusterMembership, KeeperConf, KeeperConfigurableSettings,
Lgif, RaftConfig,
};
use clickhouse_admin_types::server::{
DistributedDdlQueue, MetricInfoPath, ServerConfigurableSettings,
SystemTimeSeries, SystemTimeSeriesSettings, TimeSeriesSettingsQuery,
};
use dropshot::{
ApiDescription, ClientErrorStatusCode, HttpError, HttpResponseCreated,
Expand Down
9 changes: 5 additions & 4 deletions clickhouse-admin/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use clickhouse_admin_test_utils::{
default_clickhouse_cluster_test_deployment,
default_clickhouse_log_ctx_and_path,
};
use clickhouse_admin_types::{
ClickhouseHost, ClickhouseKeeperClusterMembership, KeeperId,
KeeperServerInfo, KeeperServerType, RaftConfig,
use clickhouse_admin_types::config::ClickhouseHost;
use clickhouse_admin_types::keeper::{
ClickhouseKeeperClusterMembership, KeeperId, KeeperServerInfo,
KeeperServerType, RaftConfig,
};
use omicron_clickhouse_admin::ClickhouseCli;
use slog::{Drain, info, o};
Expand Down Expand Up @@ -83,7 +84,7 @@ async fn test_raft_config_parsing() -> anyhow::Result<()> {
for i in 1..=num_keepers {
let raft_port = get_keeper_raft_port(KeeperId(i));
keeper_servers.insert(KeeperServerInfo {
server_id: clickhouse_admin_types::KeeperId(i),
server_id: KeeperId(i),
host: ClickhouseHost::Ipv6("::1".parse().unwrap()),
raft_port,
server_type: KeeperServerType::Participant,
Expand Down
19 changes: 1 addition & 18 deletions clickhouse-admin/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,5 @@ license = "MPL-2.0"
workspace = true

[dependencies]
anyhow.workspace = true
atomicwrites.workspace = true
camino.workspace = true
camino-tempfile.workspace = true
chrono.workspace = true
derive_more.workspace = true
daft.workspace = true
itertools.workspace = true
omicron-common.workspace = true
clickhouse-admin-types-versions.workspace = true
omicron-workspace-hack.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
expectorate.workspace = true

[dev-dependencies]
slog-async.workspace = true
slog-term.workspace = true
Loading
Loading