Skip to content

Commit

Permalink
Pass timeline as an arg
Browse files Browse the repository at this point in the history
  • Loading branch information
arpad-m committed Feb 11, 2025
1 parent 42f38bb commit 1d7a883
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions pageserver/src/tenant/timeline/detach_ancestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::{
virtual_file::{MaybeFatalIo, VirtualFile},
};
use anyhow::Context;
use camino::Utf8Path;
use pageserver_api::{models::detach_ancestor::AncestorDetached, shard::ShardIdentity};
use tokio::sync::Semaphore;
use tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -354,13 +353,7 @@ pub(super) async fn prepare(

// FIXME: the fsync should be mandatory, after both rewrites and copies
if wrote_any {
fsync_timeline_dir(
&detached
.conf
.timeline_path(&detached.tenant_shard_id, &detached.timeline_id),
ctx,
)
.await;
fsync_timeline_dir(&detached, ctx).await;
}
}

Expand Down Expand Up @@ -407,13 +400,7 @@ pub(super) async fn prepare(

// fsync directory again if we hardlinked something
if should_fsync {
fsync_timeline_dir(
&detached
.conf
.timeline_path(&detached.tenant_shard_id, &detached.timeline_id),
ctx,
)
.await;
fsync_timeline_dir(&detached, ctx).await;
}

let prepared = PreparedTimelineDetach { layers: new_layers };
Expand Down Expand Up @@ -1030,8 +1017,11 @@ fn check_no_archived_children_of_ancestor(
Ok(())
}

async fn fsync_timeline_dir(path: impl AsRef<Utf8Path>, ctx: &RequestContext) {
let timeline_dir = VirtualFile::open(path, ctx)
async fn fsync_timeline_dir(timeline: &Timeline, ctx: &RequestContext) {
let path = &timeline
.conf
.timeline_path(&timeline.tenant_shard_id, &timeline.timeline_id);
let timeline_dir = VirtualFile::open(&path, ctx)
.await
.fatal_err("VirtualFile::open for timeline dir fsync");
timeline_dir
Expand Down

0 comments on commit 1d7a883

Please sign in to comment.