rename DeleteGuard -> LayerDeletionGuard

Signed-off-by: Alex Chi <chi@neon.tech>
This commit is contained in:
Alex Chi
2023-06-27 16:57:11 -04:00
parent 113a4256d4
commit f2d7baf0ba
2 changed files with 9 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ pub struct LayerInUseWrite(tokio::sync::OwnedRwLockWriteGuard<()>);
pub struct LayerInUseRead(tokio::sync::OwnedRwLockReadGuard<()>);
#[derive(Clone)]
pub struct DeleteGuard(Arc<tokio::sync::OwnedMutexGuard<()>>);
pub struct LayerDeletionGuard(Arc<tokio::sync::OwnedMutexGuard<()>>);
impl LayerCache {
pub fn new(timeline: Weak<Timeline>) -> Self {
@@ -63,8 +63,8 @@ impl LayerCache {
}
/// Ensures only one of compaction / gc can happen at a time.
pub async fn delete_guard(&self) -> DeleteGuard {
DeleteGuard(Arc::new(
pub async fn delete_guard(&self) -> LayerDeletionGuard {
LayerDeletionGuard(Arc::new(
self.layers_removal_lock.clone().lock_owned().await,
))
}

View File

@@ -82,7 +82,7 @@ use self::eviction_task::EvictionTaskTimelineState;
use self::walreceiver::{WalReceiver, WalReceiverConf};
use super::config::TenantConf;
use super::layer_cache::{DeleteGuard, LayerCache};
use super::layer_cache::{LayerCache, LayerDeletionGuard};
use super::layer_map::BatchedUpdates;
use super::remote_timeline_client::index::IndexPart;
use super::remote_timeline_client::RemoteTimelineClient;
@@ -1208,7 +1208,7 @@ impl Timeline {
fn evict_layer_batch_impl(
&self,
_layer_removal_cs: &DeleteGuard,
_layer_removal_cs: &LayerDeletionGuard,
local_layer: &Arc<dyn PersistentLayer>,
batch_updates: &mut BatchedUpdates<'_>,
) -> anyhow::Result<bool> {
@@ -2307,7 +2307,7 @@ impl Timeline {
fn delete_historic_layer(
&self,
// we cannot remove layers otherwise, since gc and compaction will race
_layer_removal_cs: DeleteGuard,
_layer_removal_cs: LayerDeletionGuard,
layer: Arc<PersistentLayerDesc>,
updates: &mut BatchedUpdates<'_>,
) -> anyhow::Result<()> {
@@ -3499,7 +3499,7 @@ impl TryFrom<CompactLevel0Phase1StatsBuilder> for CompactLevel0Phase1Stats {
impl Timeline {
fn compact_level0_phase1(
self: Arc<Self>,
_layer_removal_cs: DeleteGuard,
_layer_removal_cs: LayerDeletionGuard,
guard: tokio::sync::OwnedRwLockReadGuard<(LayerMap, LayerFileManager)>,
mut stats: CompactLevel0Phase1StatsBuilder,
target_file_size: u64,
@@ -3872,7 +3872,7 @@ impl Timeline {
///
async fn compact_level0(
self: &Arc<Self>,
layer_removal_cs: DeleteGuard,
layer_removal_cs: LayerDeletionGuard,
target_file_size: u64,
ctx: &RequestContext,
) -> Result<(), CompactionError> {
@@ -4127,7 +4127,7 @@ impl Timeline {
async fn gc_timeline(
&self,
layer_removal_cs: DeleteGuard,
layer_removal_cs: LayerDeletionGuard,
horizon_cutoff: Lsn,
pitr_cutoff: Lsn,
retain_lsns: Vec<Lsn>,