Clean up 'attachment service' names to storage controller (#7326)

The binary etc were renamed some time ago, but the path in the source
tree remained "attachment_service" to avoid disruption to ongoing PRs.
There aren't any big PRs out right now, so it's a good time to cut over.

- Rename `attachment_service` to `storage_controller`
- Move it to the top level for symmetry with `storage_broker` & to avoid
mixing the non-prod neon_local stuff (`control_plane/`) with the storage
controller which is a production component.
This commit is contained in:
John Spray
2024-04-05 16:18:00 +01:00
committed by GitHub
parent 55da8eff4f
commit 66fc465484
40 changed files with 73 additions and 67 deletions

View File

@@ -22,6 +22,7 @@
!s3_scrubber/ !s3_scrubber/
!safekeeper/ !safekeeper/
!storage_broker/ !storage_broker/
!storage_controller/
!trace/ !trace/
!vendor/postgres-*/ !vendor/postgres-*/
!workspace_hack/ !workspace_hack/

View File

@@ -1,5 +1,5 @@
/compute_tools/ @neondatabase/control-plane @neondatabase/compute /compute_tools/ @neondatabase/control-plane @neondatabase/compute
/control_plane/attachment_service @neondatabase/storage /storage_controller @neondatabase/storage
/libs/pageserver_api/ @neondatabase/storage /libs/pageserver_api/ @neondatabase/storage
/libs/postgres_ffi/ @neondatabase/compute @neondatabase/safekeepers /libs/postgres_ffi/ @neondatabase/compute @neondatabase/safekeepers
/libs/remote_storage/ @neondatabase/storage /libs/remote_storage/ @neondatabase/storage

78
Cargo.lock generated
View File

@@ -270,45 +270,6 @@ dependencies = [
"critical-section", "critical-section",
] ]
[[package]]
name = "attachment_service"
version = "0.1.0"
dependencies = [
"anyhow",
"aws-config",
"bytes",
"camino",
"clap",
"control_plane",
"diesel",
"diesel_migrations",
"fail",
"futures",
"git-version",
"hex",
"humantime",
"hyper",
"itertools",
"lasso",
"measured",
"metrics",
"once_cell",
"pageserver_api",
"pageserver_client",
"postgres_connection",
"r2d2",
"reqwest",
"routerify",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-util",
"tracing",
"utils",
"workspace_hack",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@@ -5623,6 +5584,45 @@ dependencies = [
"workspace_hack", "workspace_hack",
] ]
[[package]]
name = "storage_controller"
version = "0.1.0"
dependencies = [
"anyhow",
"aws-config",
"bytes",
"camino",
"clap",
"control_plane",
"diesel",
"diesel_migrations",
"fail",
"futures",
"git-version",
"hex",
"humantime",
"hyper",
"itertools",
"lasso",
"measured",
"metrics",
"once_cell",
"pageserver_api",
"pageserver_client",
"postgres_connection",
"r2d2",
"reqwest",
"routerify",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-util",
"tracing",
"utils",
"workspace_hack",
]
[[package]] [[package]]
name = "storcon_cli" name = "storcon_cli"
version = "0.1.0" version = "0.1.0"

View File

@@ -3,7 +3,6 @@ resolver = "2"
members = [ members = [
"compute_tools", "compute_tools",
"control_plane", "control_plane",
"control_plane/attachment_service",
"control_plane/storcon_cli", "control_plane/storcon_cli",
"pageserver", "pageserver",
"pageserver/compaction", "pageserver/compaction",
@@ -13,6 +12,7 @@ members = [
"proxy", "proxy",
"safekeeper", "safekeeper",
"storage_broker", "storage_broker",
"storage_controller",
"s3_scrubber", "s3_scrubber",
"workspace_hack", "workspace_hack",
"trace", "trace",

View File

@@ -223,7 +223,7 @@ impl Client {
} }
} }
/// Simple HTTP request wrapper for calling into attachment service /// Simple HTTP request wrapper for calling into storage controller
async fn dispatch<RQ, RS>( async fn dispatch<RQ, RS>(
&self, &self,
method: hyper::Method, method: hyper::Method,

View File

@@ -2,8 +2,8 @@
# see https://diesel.rs/guides/configuring-diesel-cli # see https://diesel.rs/guides/configuring-diesel-cli
[print_schema] [print_schema]
file = "control_plane/attachment_service/src/schema.rs" file = "storage_controller/src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"] custom_type_derives = ["diesel::query_builder::QueryId"]
[migrations_directory] [migrations_directory]
dir = "control_plane/attachment_service/migrations" dir = "storage_controller/migrations"

View File

@@ -7,6 +7,11 @@ Below you will find a brief overview of each subdir in the source tree in alphab
Neon storage broker, providing messaging between safekeepers and pageservers. Neon storage broker, providing messaging between safekeepers and pageservers.
[storage_broker.md](./storage_broker.md) [storage_broker.md](./storage_broker.md)
`storage_controller`:
Neon storage controller, manages a cluster of pageservers and exposes an API that enables
managing a many-sharded tenant as a single entity.
`/control_plane`: `/control_plane`:
Local control plane. Local control plane.

View File

@@ -2,7 +2,7 @@ use std::str::FromStr;
/// Request/response types for the storage controller /// Request/response types for the storage controller
/// API (`/control/v1` prefix). Implemented by the server /// API (`/control/v1` prefix). Implemented by the server
/// in [`attachment_service::http`] /// in [`storage_controller::http`]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use utils::id::{NodeId, TenantId}; use utils::id::{NodeId, TenantId};

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "attachment_service" name = "storage_controller"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
@@ -45,8 +45,8 @@ diesel = { version = "2.1.4", features = ["serde_json", "postgres", "r2d2"] }
diesel_migrations = { version = "2.1.0" } diesel_migrations = { version = "2.1.0" }
r2d2 = { version = "0.8.10" } r2d2 = { version = "0.8.10" }
utils = { path = "../../libs/utils/" } utils = { path = "../libs/utils/" }
metrics = { path = "../../libs/metrics/" } metrics = { path = "../libs/metrics/" }
control_plane = { path = ".." } control_plane = { path = "../control_plane" }
workspace_hack = { version = "0.1", path = "../../workspace_hack" } workspace_hack = { version = "0.1", path = "../workspace_hack" }

View File

@@ -1,13 +1,13 @@
use anyhow::{anyhow, Context}; use anyhow::{anyhow, Context};
use attachment_service::http::make_router;
use attachment_service::metrics::preinitialize_metrics;
use attachment_service::persistence::Persistence;
use attachment_service::service::{Config, Service, MAX_UNAVAILABLE_INTERVAL_DEFAULT};
use camino::Utf8PathBuf; use camino::Utf8PathBuf;
use clap::Parser; use clap::Parser;
use diesel::Connection; use diesel::Connection;
use metrics::launch_timestamp::LaunchTimestamp; use metrics::launch_timestamp::LaunchTimestamp;
use std::sync::Arc; use std::sync::Arc;
use storage_controller::http::make_router;
use storage_controller::metrics::preinitialize_metrics;
use storage_controller::persistence::Persistence;
use storage_controller::service::{Config, Service, MAX_UNAVAILABLE_INTERVAL_DEFAULT};
use tokio::signal::unix::SignalKind; use tokio::signal::unix::SignalKind;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use utils::auth::{JwtAuth, SwappableJwtAuth}; use utils::auth::{JwtAuth, SwappableJwtAuth};
@@ -51,7 +51,7 @@ struct Cli {
#[arg(short, long)] #[arg(short, long)]
path: Option<Utf8PathBuf>, path: Option<Utf8PathBuf>,
/// URL to connect to postgres, like postgresql://localhost:1234/attachment_service /// URL to connect to postgres, like postgresql://localhost:1234/storage_controller
#[arg(long)] #[arg(long)]
database_url: Option<String>, database_url: Option<String>,

View File

@@ -42,11 +42,11 @@ def get_node_shard_counts(env: NeonEnv, tenant_ids):
return counts return counts
def test_sharding_service_smoke( def test_storage_controller_smoke(
neon_env_builder: NeonEnvBuilder, neon_env_builder: NeonEnvBuilder,
): ):
""" """
Test the basic lifecycle of a sharding service: Test the basic lifecycle of a storage controller:
- Restarting - Restarting
- Restarting a pageserver - Restarting a pageserver
- Creating and deleting tenants and timelines - Creating and deleting tenants and timelines
@@ -204,7 +204,7 @@ def test_node_status_after_restart(
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_passthrough( def test_storage_controller_passthrough(
neon_env_builder: NeonEnvBuilder, neon_env_builder: NeonEnvBuilder,
): ):
""" """
@@ -231,7 +231,7 @@ def test_sharding_service_passthrough(
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_restart(neon_env_builder: NeonEnvBuilder): def test_storage_controller_restart(neon_env_builder: NeonEnvBuilder):
env = neon_env_builder.init_start() env = neon_env_builder.init_start()
tenant_a = env.initial_tenant tenant_a = env.initial_tenant
tenant_b = TenantId.generate() tenant_b = TenantId.generate()
@@ -266,7 +266,7 @@ def test_sharding_service_restart(neon_env_builder: NeonEnvBuilder):
@pytest.mark.parametrize("warm_up", [True, False]) @pytest.mark.parametrize("warm_up", [True, False])
def test_sharding_service_onboarding(neon_env_builder: NeonEnvBuilder, warm_up: bool): def test_storage_controller_onboarding(neon_env_builder: NeonEnvBuilder, warm_up: bool):
""" """
We onboard tenants to the sharding service by treating it as a 'virtual pageserver' We onboard tenants to the sharding service by treating it as a 'virtual pageserver'
which provides the /location_config API. This is similar to creating a tenant, which provides the /location_config API. This is similar to creating a tenant,
@@ -420,7 +420,7 @@ def test_sharding_service_onboarding(neon_env_builder: NeonEnvBuilder, warm_up:
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_compute_hook( def test_storage_controller_compute_hook(
httpserver: HTTPServer, httpserver: HTTPServer,
neon_env_builder: NeonEnvBuilder, neon_env_builder: NeonEnvBuilder,
httpserver_listen_address, httpserver_listen_address,
@@ -533,7 +533,7 @@ def test_sharding_service_compute_hook(
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_debug_apis(neon_env_builder: NeonEnvBuilder): def test_storage_controller_debug_apis(neon_env_builder: NeonEnvBuilder):
""" """
Verify that occasional-use debug APIs work as expected. This is a lightweight test Verify that occasional-use debug APIs work as expected. This is a lightweight test
that just hits the endpoints to check that they don't bitrot. that just hits the endpoints to check that they don't bitrot.
@@ -594,7 +594,7 @@ def test_sharding_service_debug_apis(neon_env_builder: NeonEnvBuilder):
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_s3_time_travel_recovery( def test_storage_controller_s3_time_travel_recovery(
neon_env_builder: NeonEnvBuilder, neon_env_builder: NeonEnvBuilder,
pg_bin: PgBin, pg_bin: PgBin,
): ):
@@ -704,7 +704,7 @@ def test_sharding_service_s3_time_travel_recovery(
env.storage_controller.consistency_check() env.storage_controller.consistency_check()
def test_sharding_service_auth(neon_env_builder: NeonEnvBuilder): def test_storage_controller_auth(neon_env_builder: NeonEnvBuilder):
neon_env_builder.auth_enabled = True neon_env_builder.auth_enabled = True
env = neon_env_builder.init_start() env = neon_env_builder.init_start()
svc = env.storage_controller svc = env.storage_controller
@@ -773,7 +773,7 @@ def test_sharding_service_auth(neon_env_builder: NeonEnvBuilder):
) )
def test_sharding_service_tenant_conf(neon_env_builder: NeonEnvBuilder): def test_storage_controller_tenant_conf(neon_env_builder: NeonEnvBuilder):
""" """
Validate the pageserver-compatible API endpoints for setting and getting tenant conf, without Validate the pageserver-compatible API endpoints for setting and getting tenant conf, without
supplying the whole LocationConf. supplying the whole LocationConf.
@@ -876,7 +876,7 @@ def build_node_to_tenants_map(env: NeonEnv) -> dict[int, list[TenantId]]:
PageserverFailpoint(pageserver_id=1, failpoint="get-utilization-http-handler"), PageserverFailpoint(pageserver_id=1, failpoint="get-utilization-http-handler"),
], ],
) )
def test_sharding_service_heartbeats( def test_storage_controller_heartbeats(
neon_env_builder: NeonEnvBuilder, pg_bin: PgBin, failure: Failure neon_env_builder: NeonEnvBuilder, pg_bin: PgBin, failure: Failure
): ):
neon_env_builder.num_pageservers = 2 neon_env_builder.num_pageservers = 2
@@ -986,7 +986,7 @@ def test_sharding_service_heartbeats(
wait_until(10, 1, storage_controller_consistent) wait_until(10, 1, storage_controller_consistent)
def test_sharding_service_re_attach(neon_env_builder: NeonEnvBuilder): def test_storage_controller_re_attach(neon_env_builder: NeonEnvBuilder):
""" """
Exercise the behavior of the /re-attach endpoint on pageserver startup when Exercise the behavior of the /re-attach endpoint on pageserver startup when
pageservers have a mixture of attached and secondary locations pageservers have a mixture of attached and secondary locations