Skip to content
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

[reconfigurator] Endpoint to retrieve keeper cluster membership #6758

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Generate OpenAPI spec
karencfv committed Oct 1, 2024
commit c5d9bfc1c07c08739901d78c906ccea2a0d77018
3 changes: 3 additions & 0 deletions clickhouse-admin/types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -910,8 +910,11 @@ impl KeeperConf {
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct ClickhouseKeeperClusterMembership {
/// Keeper ID of the keeper being queried
pub queried_keeper: KeeperId,
/// Index of the last committed log entry from the leader's perspective
pub leader_committed_log_index: u64,
/// Keeper IDs of all keepers in the cluster
pub raft_config: BTreeSet<KeeperId>,
}

Original file line number Diff line number Diff line change
@@ -5,12 +5,11 @@
//! A mechanism for allocating clickhouse keeper and server nodes for clustered
//! clickhouse setups during blueprint planning

use clickhouse_admin_types::KeeperId;
use clickhouse_admin_types::{ClickhouseKeeperClusterMembership, KeeperId};
use nexus_types::deployment::{
Blueprint, BlueprintZoneFilter, BlueprintZoneType, BlueprintZonesConfig,
ClickhouseClusterConfig,
};
use nexus_types::inventory::ClickhouseKeeperClusterMembership;
use omicron_uuid_kinds::{OmicronZoneUuid, SledUuid};
use slog::{error, Logger};
use std::collections::{BTreeMap, BTreeSet};
16 changes: 1 addition & 15 deletions nexus/types/src/inventory.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ use crate::external_api::params::PhysicalDiskKind;
use crate::external_api::params::UninitializedSledId;
use chrono::DateTime;
use chrono::Utc;
use clickhouse_admin_types::KeeperId;
use clickhouse_admin_types::ClickhouseKeeperClusterMembership;
pub use gateway_client::types::PowerState;
pub use gateway_client::types::RotImageError;
pub use gateway_client::types::RotSlot;
@@ -512,17 +512,3 @@ pub struct OmicronZonesFound {
pub sled_id: SledUuid,
pub zones: OmicronZonesConfig,
}

/// The configuration of the clickhouse keeper raft cluster returned from a
/// single keeper node
///
/// Each keeper is asked for its known raft configuration via `clickhouse-admin`
/// dropshot servers running in `ClickhouseKeeper` zones. state. We include the
/// leader committed log index known to the current keeper node (whether or not
/// it is the leader) to determine which configuration is newest.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct ClickhouseKeeperClusterMembership {
pub queried_keeper: KeeperId,
pub leader_committed_log_index: u64,
pub raft_config: BTreeSet<KeeperId>,
}
Comment on lines -515 to -528
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to move this to avoid a circular dependency

57 changes: 57 additions & 0 deletions openapi/clickhouse-admin.json
Original file line number Diff line number Diff line change
@@ -10,6 +10,30 @@
"version": "0.0.1"
},
"paths": {
"/keeper/cluster-membership": {
"get": {
"summary": "Retrieve cluster membership information from a keeper node.",
"operationId": "keeper_cluster_membership",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClickhouseKeeperClusterMembership"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/keeper/conf": {
"get": {
"summary": "Retrieve configuration information from a keeper node.",
@@ -199,6 +223,39 @@
}
]
},
"ClickhouseKeeperClusterMembership": {
"description": "The configuration of the clickhouse keeper raft cluster returned from a single keeper node\n\nEach keeper is asked for its known raft configuration via `clickhouse-admin` dropshot servers running in `ClickhouseKeeper` zones. state. We include the leader committed log index known to the current keeper node (whether or not it is the leader) to determine which configuration is newest.",
"type": "object",
"properties": {
"leader_committed_log_index": {
"description": "Index of the last committed log entry from the leader's perspective",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"queried_keeper": {
"description": "Keeper ID of the keeper being queried",
"allOf": [
{
"$ref": "#/components/schemas/KeeperId"
}
]
},
"raft_config": {
"description": "Keeper IDs of all keepers in the cluster",
"type": "array",
"items": {
"$ref": "#/components/schemas/KeeperId"
},
"uniqueItems": true
}
},
"required": [
"leader_committed_log_index",
"queried_keeper",
"raft_config"
]
},
"Error": {
"description": "Error information from a response.",
"type": "object",