pageserver: refuse to run without remote storage (#7722)

## Problem

Since https://github.com/neondatabase/neon/pull/6769, the pageserver is
intentionally not usable without remote storage: it's purpose is to act
as a cache to an object store, rather than as a source of truth in its
own right.

## Summary of changes

- Make remote storage configuration mandatory: the pageserver will
refuse to start if it is not provided.

This is a precursor that will make it safe to subsequently remove all
the internal Option<>s
This commit is contained in:
John Spray
2024-05-13 13:05:46 +01:00
committed by GitHub
parent b58a615197
commit f50ff14560

View File

@@ -383,7 +383,7 @@ fn start_pageserver(
let shutdown_pageserver = tokio_util::sync::CancellationToken::new(); let shutdown_pageserver = tokio_util::sync::CancellationToken::new();
// Set up remote storage client // Set up remote storage client
let remote_storage = create_remote_storage_client(conf)?; let remote_storage = Some(create_remote_storage_client(conf)?);
// Set up deletion queue // Set up deletion queue
let (deletion_queue, deletion_workers) = DeletionQueue::new( let (deletion_queue, deletion_workers) = DeletionQueue::new(
@@ -708,12 +708,11 @@ fn start_pageserver(
fn create_remote_storage_client( fn create_remote_storage_client(
conf: &'static PageServerConf, conf: &'static PageServerConf,
) -> anyhow::Result<Option<GenericRemoteStorage>> { ) -> anyhow::Result<GenericRemoteStorage> {
let config = if let Some(config) = &conf.remote_storage_config { let config = if let Some(config) = &conf.remote_storage_config {
config config
} else { } else {
tracing::warn!("no remote storage configured, this is a deprecated configuration"); anyhow::bail!("no remote storage configured, this is a deprecated configuration");
return Ok(None);
}; };
// Create the client // Create the client
@@ -733,7 +732,7 @@ fn create_remote_storage_client(
GenericRemoteStorage::unreliable_wrapper(remote_storage, conf.test_remote_failures); GenericRemoteStorage::unreliable_wrapper(remote_storage, conf.test_remote_failures);
} }
Ok(Some(remote_storage)) Ok(remote_storage)
} }
fn cli() -> Command { fn cli() -> Command {