pageseserver: rename cplane api to storage controller api (#11310)

## Problem

The pageserver upcall api was designed to work with control plane or the
storage controller.
We have completed the transition period and now the upcall api only
targets the storage controller.

## Summary of changes

Rename types accordingly and tweak some comments.
This commit is contained in:
Vlad Lazar
2025-03-19 16:29:52 +00:00
committed by GitHub
parent 518269ea6a
commit 9ce3704ab5
6 changed files with 21 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
//! Types in this file are for pageserver's upward-facing API calls to the control plane,
//! Types in this file are for pageserver's upward-facing API calls to the storage controller,
//! required for acquiring and validating tenant generation numbers.
//!
//! See docs/rfcs/025-generation-numbers.md

View File

@@ -16,7 +16,7 @@ use metrics::launch_timestamp::{LaunchTimestamp, set_launch_timestamp_metric};
use metrics::set_build_info_metric;
use nix::sys::socket::{setsockopt, sockopt};
use pageserver::config::{PageServerConf, PageserverIdentity};
use pageserver::controller_upcall_client::ControllerUpcallClient;
use pageserver::controller_upcall_client::StorageControllerUpcallClient;
use pageserver::deletion_queue::DeletionQueue;
use pageserver::disk_usage_eviction_task::{self, launch_disk_usage_global_eviction_task};
use pageserver::metrics::{STARTUP_DURATION, STARTUP_IS_LOADING};
@@ -427,7 +427,7 @@ fn start_pageserver(
// Set up deletion queue
let (deletion_queue, deletion_workers) = DeletionQueue::new(
remote_storage.clone(),
ControllerUpcallClient::new(conf, &shutdown_pageserver),
StorageControllerUpcallClient::new(conf, &shutdown_pageserver),
conf,
);
deletion_workers.spawn_with(BACKGROUND_RUNTIME.handle());

View File

@@ -21,10 +21,7 @@ use crate::virtual_file::on_fatal_io_error;
/// The Pageserver's client for using the storage controller upcall API: this is a small API
/// for dealing with generations (see docs/rfcs/025-generation-numbers.md).
///
/// The server presenting this API may either be the storage controller or some other
/// service (such as the Neon control plane) providing a store of generation numbers.
pub struct ControllerUpcallClient {
pub struct StorageControllerUpcallClient {
http_client: reqwest::Client,
base_url: Url,
node_id: NodeId,
@@ -37,7 +34,7 @@ pub enum RetryForeverError {
ShuttingDown,
}
pub trait ControlPlaneGenerationsApi {
pub trait StorageControllerUpcallApi {
fn re_attach(
&self,
conf: &PageServerConf,
@@ -50,7 +47,7 @@ pub trait ControlPlaneGenerationsApi {
) -> impl Future<Output = Result<HashMap<TenantShardId, bool>, RetryForeverError>> + Send;
}
impl ControllerUpcallClient {
impl StorageControllerUpcallClient {
/// A None return value indicates that the input `conf` object does not have control
/// plane API enabled.
pub fn new(conf: &'static PageServerConf, cancel: &CancellationToken) -> Option<Self> {
@@ -124,7 +121,7 @@ impl ControllerUpcallClient {
}
}
impl ControlPlaneGenerationsApi for ControllerUpcallClient {
impl StorageControllerUpcallApi for StorageControllerUpcallClient {
/// Block until we get a successful response, or error out if we are shut down
#[tracing::instrument(skip_all)] // so that warning logs from retry_http_forever have context
async fn re_attach(

View File

@@ -26,7 +26,7 @@ use self::deleter::Deleter;
use self::list_writer::{DeletionOp, ListWriter, RecoverOp};
use self::validator::Validator;
use crate::config::PageServerConf;
use crate::controller_upcall_client::ControlPlaneGenerationsApi;
use crate::controller_upcall_client::StorageControllerUpcallApi;
use crate::metrics;
use crate::tenant::remote_timeline_client::{LayerFileMetadata, remote_timeline_path};
use crate::tenant::storage_layer::LayerName;
@@ -76,7 +76,7 @@ pub struct DeletionQueue {
/// worker objects themselves public
pub struct DeletionQueueWorkers<C>
where
C: ControlPlaneGenerationsApi + Send + Sync,
C: StorageControllerUpcallApi + Send + Sync,
{
frontend: ListWriter,
backend: Validator<C>,
@@ -85,7 +85,7 @@ where
impl<C> DeletionQueueWorkers<C>
where
C: ControlPlaneGenerationsApi + Send + Sync + 'static,
C: StorageControllerUpcallApi + Send + Sync + 'static,
{
pub fn spawn_with(mut self, runtime: &tokio::runtime::Handle) -> tokio::task::JoinHandle<()> {
let jh_frontend = runtime.spawn(async move {
@@ -589,7 +589,7 @@ impl DeletionQueue {
conf: &'static PageServerConf,
) -> (Self, DeletionQueueWorkers<C>)
where
C: ControlPlaneGenerationsApi + Send + Sync,
C: StorageControllerUpcallApi + Send + Sync,
{
// Unbounded channel: enables non-async functions to submit deletions. The actual length is
// constrained by how promptly the ListWriter wakes up and drains it, which should be frequent
@@ -691,7 +691,7 @@ mod test {
harness: TenantHarness,
remote_fs_dir: Utf8PathBuf,
storage: GenericRemoteStorage,
mock_control_plane: MockControlPlane,
mock_control_plane: MockStorageController,
deletion_queue: DeletionQueue,
worker_join: JoinHandle<()>,
}
@@ -751,11 +751,11 @@ mod test {
}
#[derive(Debug, Clone)]
struct MockControlPlane {
struct MockStorageController {
pub latest_generation: std::sync::Arc<std::sync::Mutex<HashMap<TenantShardId, Generation>>>,
}
impl MockControlPlane {
impl MockStorageController {
fn new() -> Self {
Self {
latest_generation: Arc::default(),
@@ -763,7 +763,7 @@ mod test {
}
}
impl ControlPlaneGenerationsApi for MockControlPlane {
impl StorageControllerUpcallApi for MockStorageController {
async fn re_attach(
&self,
_conf: &PageServerConf,
@@ -810,7 +810,7 @@ mod test {
.await
.unwrap();
let mock_control_plane = MockControlPlane::new();
let mock_control_plane = MockStorageController::new();
let (deletion_queue, worker) = DeletionQueue::new(
storage.clone(),

View File

@@ -25,7 +25,7 @@ use tracing::{debug, info, warn};
use super::deleter::DeleterMessage;
use super::{DeletionHeader, DeletionList, DeletionQueueError, FlushOp, VisibleLsnUpdates};
use crate::config::PageServerConf;
use crate::controller_upcall_client::{ControlPlaneGenerationsApi, RetryForeverError};
use crate::controller_upcall_client::{RetryForeverError, StorageControllerUpcallApi};
use crate::metrics;
use crate::virtual_file::MaybeFatalIo;
@@ -46,7 +46,7 @@ pub(super) enum ValidatorQueueMessage {
}
pub(super) struct Validator<C>
where
C: ControlPlaneGenerationsApi,
C: StorageControllerUpcallApi,
{
conf: &'static PageServerConf,
rx: tokio::sync::mpsc::Receiver<ValidatorQueueMessage>,
@@ -80,7 +80,7 @@ where
impl<C> Validator<C>
where
C: ControlPlaneGenerationsApi,
C: StorageControllerUpcallApi,
{
pub(super) fn new(
conf: &'static PageServerConf,

View File

@@ -40,7 +40,7 @@ use super::{GlobalShutDown, TenantSharedResources};
use crate::config::PageServerConf;
use crate::context::{DownloadBehavior, RequestContext};
use crate::controller_upcall_client::{
ControlPlaneGenerationsApi, ControllerUpcallClient, RetryForeverError,
RetryForeverError, StorageControllerUpcallApi, StorageControllerUpcallClient,
};
use crate::deletion_queue::DeletionQueueClient;
use crate::http::routes::ACTIVE_TENANT_TIMEOUT;
@@ -344,7 +344,7 @@ async fn init_load_generations(
"Emergency mode! Tenants will be attached unsafely using their last known generation"
);
emergency_generations(tenant_confs)
} else if let Some(client) = ControllerUpcallClient::new(conf, cancel) {
} else if let Some(client) = StorageControllerUpcallClient::new(conf, cancel) {
info!("Calling {} API to re-attach tenants", client.base_url());
// If we are configured to use the control plane API, then it is the source of truth for what tenants to load.
match client.re_attach(conf).await {