Revert "WIP: solution approach 1: propagate cancellationtoken from tenant"

This reverts commit 5202d2dc98.
This commit is contained in:
Christian Schwarz
2024-06-24 19:04:02 +00:00
parent 5202d2dc98
commit 6779c908eb
2 changed files with 7 additions and 17 deletions

View File

@@ -658,6 +658,11 @@ impl Tenant {
walredo_global_state,
} = resources;
let wal_redo_manager = Arc::new(WalRedoManager::from(PostgresRedoManager::new(
walredo_global_state,
tenant_shard_id,
)));
let attach_mode = attached_conf.location.attach_mode;
let generation = attached_conf.location.generation;
@@ -2487,22 +2492,11 @@ impl Tenant {
conf: &'static PageServerConf,
attached_conf: AttachedTenantConf,
shard_identity: ShardIdentity,
walredo_mgr: Option<Arc<WalRedoManager>>,
tenant_shard_id: TenantShardId,
remote_storage: GenericRemoteStorage,
deletion_queue_client: DeletionQueueClient,
) -> Tenant {
let cancel = CancellationToken::default();
let walredo_mgr = if let TenantState::Broken { .. } = &state {
None
} else {
Some(Arc::new(WalRedoManager::from(PostgresRedoManager::new(
walredo_global_state,
tenant_shard_id,
cancel.child_token(),
))))
};
let (state, mut rx) = watch::channel(state);
tokio::spawn(async move {
@@ -2577,7 +2571,7 @@ impl Tenant {
cached_synthetic_tenant_size: Arc::new(AtomicU64::new(0)),
eviction_task_tenant_state: tokio::sync::Mutex::new(EvictionTaskTenantState::default()),
activate_now_sem: tokio::sync::Semaphore::new(0),
cancel,
cancel: CancellationToken::default(),
gate: Gate::default(),
timeline_get_throttle: Arc::new(throttle::Throttle::new(
Tenant::get_timeline_get_throttle_config(conf, &attached_conf.tenant_conf),

View File

@@ -35,7 +35,6 @@ use anyhow::Context;
use bytes::{Bytes, BytesMut};
use pageserver_api::models::{WalRedoManagerProcessStatus, WalRedoManagerStatus};
use pageserver_api::shard::TenantShardId;
use tokio_util::sync::CancellationToken;
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
@@ -75,7 +74,6 @@ impl GlobalState {
pub struct PostgresRedoManager {
global_state: Arc<GlobalState>,
tenant_shard_id: TenantShardId,
cancel: CancellationToken,
last_redo_at: std::sync::Mutex<Option<Instant>>,
/// The current [`process::WalRedoProcess`] that is used by new redo requests.
/// We use [`heavier_once_cell`] for coalescing the spawning, but the redo
@@ -202,12 +200,10 @@ impl PostgresRedoManager {
pub fn new(
global_state: Arc<GlobalState>,
tenant_shard_id: TenantShardId,
cancel: CancellationToken,
) -> PostgresRedoManager {
// The actual process is launched lazily, on first request.
PostgresRedoManager {
global_state,
cancel,
tenant_shard_id,
last_redo_at: std::sync::Mutex::default(),
redo_process: heavier_once_cell::OnceCell::default(),