Skip to content
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8138c4c
generate replica files with generation number
karencfv Jan 15, 2025
50ab66c
generation number for keepers
karencfv Jan 15, 2025
2b3f10f
parse gen number from file
karencfv Jan 16, 2025
dd0a9b1
add some tests
karencfv Jan 16, 2025
96ac8cf
Extract server context for single node
karencfv Jan 16, 2025
948fc93
check incoming generation number is larger
karencfv Jan 17, 2025
2937b66
return init context error
karencfv Jan 17, 2025
30155e0
server context refactor
karencfv Jan 17, 2025
608b911
small refactor in SMF services structure
karencfv Jan 20, 2025
0cd9654
save generation to cache
karencfv Jan 20, 2025
be1afc7
use tokio mutex
karencfv Jan 20, 2025
6a500e6
clean up
karencfv Jan 21, 2025
779a549
remove tokio mutex
karencfv Jan 23, 2025
eb69ee5
change error messages
karencfv Jan 23, 2025
df4ba8d
hold the lock
karencfv Jan 24, 2025
c36522e
poc for long running task
karencfv Jan 24, 2025
e961a60
Use tokio task for generation
karencfv Jan 24, 2025
d279711
fmt
karencfv Jan 24, 2025
ef04ac7
use task for generating config
karencfv Jan 24, 2025
7d335b6
add init_db to task
karencfv Jan 27, 2025
b6e63fa
clean up
karencfv Jan 27, 2025
d067a71
same functionality for single node
karencfv Jan 27, 2025
861875d
remove handles
karencfv Jan 28, 2025
a75ebb9
use flume channel
karencfv Jan 28, 2025
def40c2
clean up
karencfv Jan 28, 2025
810e88b
extract methods into functions
karencfv Jan 29, 2025
c59d90f
slim down the implementation
karencfv Jan 29, 2025
cb21b84
add logging
karencfv Jan 29, 2025
cbff5cd
Begin expanding funciton parameters instead of taking a function
karencfv Jan 29, 2025
33ab408
initialise oximteter client differently
karencfv Jan 30, 2025
b8954ab
watcher for generation
karencfv Jan 30, 2025
cde78c3
same for keeper
karencfv Jan 30, 2025
089a2a4
Clean up
karencfv Jan 30, 2025
56b1fcc
Separate tasks
karencfv Jan 30, 2025
169a923
fmt
karencfv Jan 30, 2025
ca6b4c3
use try_send
karencfv Feb 3, 2025
f30ed7d
clean up
karencfv Feb 3, 2025
cc0f280
restructure watch channel
karencfv Feb 3, 2025
f5f78d4
unify long running task
karencfv Feb 3, 2025
ec8c12b
implement keeper
karencfv Feb 3, 2025
5057b8e
clean up
karencfv Feb 3, 2025
81b564c
clean up generation
karencfv Feb 4, 2025
9875341
error handling and clean up
karencfv Feb 4, 2025
7a974a7
fix tests
karencfv Feb 4, 2025
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions clickhouse-admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ clap.workspace = true
clickhouse-admin-api.workspace = true
clickhouse-admin-types.workspace = true
dropshot.workspace = true
flume = {workspace = true, features = ["async"]}
http.workspace = true
illumos-utils.workspace = true
omicron-common.workspace = true
Expand Down
29 changes: 24 additions & 5 deletions clickhouse-admin/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use clickhouse_admin_types::{
ClickhouseKeeperClusterMembership, DistributedDdlQueue, KeeperConf,
KeeperConfig, KeeperConfigurableSettings, Lgif, MetricInfoPath, RaftConfig,
ReplicaConfig, ServerConfigurableSettings, SystemTimeSeries,
ClickhouseKeeperClusterMembership, DistributedDdlQueue,
GenerateConfigResult, KeeperConf, KeeperConfigurableSettings, Lgif,
MetricInfoPath, RaftConfig, ServerConfigurableSettings, SystemTimeSeries,
TimeSeriesSettingsQuery,
};
use dropshot::{
HttpError, HttpResponseCreated, HttpResponseOk,
HttpResponseUpdatedNoContent, Path, Query, RequestContext, TypedBody,
};
use omicron_common::api::external::Generation;

/// API interface for our clickhouse-admin-keeper server
///
Expand Down Expand Up @@ -40,7 +41,16 @@ pub trait ClickhouseAdminKeeperApi {
async fn generate_config_and_enable_svc(
rqctx: RequestContext<Self::Context>,
body: TypedBody<KeeperConfigurableSettings>,
) -> Result<HttpResponseCreated<KeeperConfig>, HttpError>;
) -> Result<HttpResponseCreated<GenerateConfigResult>, HttpError>;

/// Retrieve the generation number of a configuration
#[endpoint {
method = GET,
path = "/generation",
}]
async fn generation(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Generation>, HttpError>;

/// Retrieve a logically grouped information file from a keeper node.
/// This information is used internally by ZooKeeper to manage snapshots
Expand Down Expand Up @@ -106,7 +116,16 @@ pub trait ClickhouseAdminServerApi {
async fn generate_config_and_enable_svc(
rqctx: RequestContext<Self::Context>,
body: TypedBody<ServerConfigurableSettings>,
) -> Result<HttpResponseCreated<ReplicaConfig>, HttpError>;
) -> Result<HttpResponseCreated<GenerateConfigResult>, HttpError>;

/// Retrieve the generation number of a configuration
#[endpoint {
method = GET,
path = "/generation",
}]
async fn generation(
rqctx: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Generation>, HttpError>;

/// Contains information about distributed ddl queries (ON CLUSTER clause)
/// that were executed on a cluster.
Expand Down
3 changes: 2 additions & 1 deletion clickhouse-admin/src/clickhouse_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ impl ClickhouseCli {
pub fn new(
binary_path: Utf8PathBuf,
listen_address: SocketAddrV6,
log: Logger,
log: &Logger,
) -> Self {
let log = log.new(slog::o!("component" => "ClickhouseCli"));
Comment on lines +96 to +98
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of the refactoring, the logs were a bit of a mess.

Self { binary_path, listen_address, log }
}

Expand Down
9 changes: 5 additions & 4 deletions clickhouse-admin/src/clickward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use clickhouse_admin_types::{
KeeperConfig, KeeperSettings, ReplicaConfig, ServerSettings,
KeeperConfig, KeeperConfigurableSettings, ReplicaConfig,
ServerConfigurableSettings,
};
use dropshot::HttpError;
use slog_error_chain::{InlineErrorChain, SlogInlineError};
Expand Down Expand Up @@ -33,7 +34,7 @@ impl From<ClickwardError> for HttpError {
}
}

#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct Clickward {}

impl Clickward {
Expand All @@ -43,7 +44,7 @@ impl Clickward {

pub fn generate_server_config(
&self,
settings: ServerSettings,
settings: &ServerConfigurableSettings,
) -> Result<ReplicaConfig, ClickwardError> {
let replica_config = settings
.generate_xml_file()
Expand All @@ -54,7 +55,7 @@ impl Clickward {

pub fn generate_keeper_config(
&self,
settings: KeeperSettings,
settings: &KeeperConfigurableSettings,
) -> Result<KeeperConfig, ClickwardError> {
let keeper_config = settings
.generate_xml_file()
Expand Down
Loading
Loading