diff --git a/pageserver/src/config.rs b/pageserver/src/config.rs index 2046d27b1e..f870c85355 100644 --- a/pageserver/src/config.rs +++ b/pageserver/src/config.rs @@ -570,21 +570,21 @@ impl PageServerConf { .join(TENANT_ATTACHING_MARKER_FILENAME) } - pub fn tenant_ignore_mark_file_path(&self, tenant_id: TenantId) -> PathBuf { - self.tenant_path(&tenant_id).join(IGNORED_TENANT_FILE_NAME) + pub fn tenant_ignore_mark_file_path(&self, tenant_id: &TenantId) -> PathBuf { + self.tenant_path(tenant_id).join(IGNORED_TENANT_FILE_NAME) } /// Points to a place in pageserver's local directory, /// where certain tenant's tenantconf file should be located. - pub fn tenant_config_path(&self, tenant_id: TenantId) -> PathBuf { - self.tenant_path(&tenant_id).join(TENANT_CONFIG_NAME) + pub fn tenant_config_path(&self, tenant_id: &TenantId) -> PathBuf { + self.tenant_path(tenant_id).join(TENANT_CONFIG_NAME) } pub fn timelines_path(&self, tenant_id: &TenantId) -> PathBuf { self.tenant_path(tenant_id).join(TIMELINES_SEGMENT_NAME) } - pub fn timeline_path(&self, timeline_id: &TimelineId, tenant_id: &TenantId) -> PathBuf { + pub fn timeline_path(&self, tenant_id: &TenantId, timeline_id: &TimelineId) -> PathBuf { self.timelines_path(tenant_id).join(timeline_id.to_string()) } @@ -594,7 +594,7 @@ impl PageServerConf { timeline_id: TimelineId, ) -> PathBuf { path_with_suffix_extension( - self.timeline_path(&timeline_id, &tenant_id), + self.timeline_path(&tenant_id, &timeline_id), TIMELINE_UNINIT_MARK_SUFFIX, ) } @@ -617,8 +617,8 @@ impl PageServerConf { /// Points to a place in pageserver's local directory, /// where certain timeline's metadata file should be located. - pub fn metadata_path(&self, timeline_id: TimelineId, tenant_id: TenantId) -> PathBuf { - self.timeline_path(&timeline_id, &tenant_id) + pub fn metadata_path(&self, tenant_id: &TenantId, timeline_id: &TimelineId) -> PathBuf { + self.timeline_path(tenant_id, timeline_id) .join(METADATA_FILE_NAME) } diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 1650b267f1..5e207408cc 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -421,8 +421,8 @@ impl Tenant { if !picked_local { save_metadata( self.conf, - timeline_id, - tenant_id, + &tenant_id, + &timeline_id, up_to_date_metadata, first_save, ) @@ -451,7 +451,7 @@ impl Tenant { ) -> anyhow::Result> { // TODO dedup with spawn_load let tenant_conf = - Self::load_tenant_config(conf, tenant_id).context("load tenant config")?; + Self::load_tenant_config(conf, &tenant_id).context("load tenant config")?; let wal_redo_manager = Arc::new(PostgresRedoManager::new(conf, tenant_id)); let tenant = Arc::new(Tenant::new( @@ -646,7 +646,7 @@ impl Tenant { span::debug_assert_current_span_has_tenant_id(); info!("downloading index file for timeline {}", timeline_id); - tokio::fs::create_dir_all(self.conf.timeline_path(&timeline_id, &self.tenant_id)) + tokio::fs::create_dir_all(self.conf.timeline_path(&self.tenant_id, &timeline_id)) .await .context("Failed to create new timeline directory")?; @@ -724,7 +724,7 @@ impl Tenant { ) -> Arc { span::debug_assert_current_span_has_tenant_id(); - let tenant_conf = match Self::load_tenant_config(conf, tenant_id) { + let tenant_conf = match Self::load_tenant_config(conf, &tenant_id) { Ok(conf) => conf, Err(e) => { error!("load tenant config failed: {:?}", e); @@ -835,7 +835,7 @@ impl Tenant { timeline_uninit_mark_file.display() ) })?; - let timeline_dir = self.conf.timeline_path(&timeline_id, &self.tenant_id); + let timeline_dir = self.conf.timeline_path(&self.tenant_id, &timeline_id); if let Err(e) = remove_timeline_and_uninit_mark(&timeline_dir, timeline_uninit_mark_file) { @@ -880,7 +880,7 @@ impl Tenant { if let Ok(timeline_id) = file_name.to_str().unwrap_or_default().parse::() { - let metadata = load_metadata(self.conf, timeline_id, self.tenant_id) + let metadata = load_metadata(self.conf, &self.tenant_id, &timeline_id) .context("failed to load metadata")?; timelines_to_load.insert(timeline_id, metadata); } else { @@ -1445,7 +1445,7 @@ impl Tenant { let local_timeline_directory = self .conf - .timeline_path(&timeline.timeline_id, &self.tenant_id); + .timeline_path(&self.tenant_id, &timeline.timeline_id); fail::fail_point!("timeline-delete-before-rm", |_| { Err(anyhow::anyhow!("failpoint: timeline-delete-before-rm"))? @@ -2226,7 +2226,7 @@ impl Tenant { /// Locate and load config pub(super) fn load_tenant_config( conf: &'static PageServerConf, - tenant_id: TenantId, + tenant_id: &TenantId, ) -> anyhow::Result { let target_config_path = conf.tenant_config_path(tenant_id); let target_config_display = target_config_path.display(); @@ -2813,7 +2813,7 @@ impl Tenant { timeline_struct.init_empty_layer_map(start_lsn); if let Err(e) = - self.create_timeline_files(&uninit_mark.timeline_path, new_timeline_id, new_metadata) + self.create_timeline_files(&uninit_mark.timeline_path, &new_timeline_id, new_metadata) { error!("Failed to create initial files for timeline {tenant_id}/{new_timeline_id}, cleaning up: {e:?}"); cleanup_timeline_directory(uninit_mark); @@ -2832,7 +2832,7 @@ impl Tenant { fn create_timeline_files( &self, timeline_path: &Path, - new_timeline_id: TimelineId, + new_timeline_id: &TimelineId, new_metadata: &TimelineMetadata, ) -> anyhow::Result<()> { crashsafe::create_dir(timeline_path).context("Failed to create timeline directory")?; @@ -2843,8 +2843,8 @@ impl Tenant { save_metadata( self.conf, + &self.tenant_id, new_timeline_id, - self.tenant_id, new_metadata, true, ) @@ -2867,7 +2867,7 @@ impl Tenant { timelines.get(&timeline_id).is_none(), "Timeline {tenant_id}/{timeline_id} already exists in pageserver's memory" ); - let timeline_path = self.conf.timeline_path(&timeline_id, &tenant_id); + let timeline_path = self.conf.timeline_path(&tenant_id, &timeline_id); anyhow::ensure!( !timeline_path.exists(), "Timeline {} already exists, cannot create its uninit mark file", @@ -2998,10 +2998,10 @@ pub(crate) enum CreateTenantFilesMode { pub(crate) fn create_tenant_files( conf: &'static PageServerConf, tenant_conf: TenantConfOpt, - tenant_id: TenantId, + tenant_id: &TenantId, mode: CreateTenantFilesMode, ) -> anyhow::Result { - let target_tenant_directory = conf.tenant_path(&tenant_id); + let target_tenant_directory = conf.tenant_path(tenant_id); anyhow::ensure!( !target_tenant_directory .try_exists() @@ -3052,7 +3052,7 @@ pub(crate) fn create_tenant_files( fn try_create_target_tenant_dir( conf: &'static PageServerConf, tenant_conf: TenantConfOpt, - tenant_id: TenantId, + tenant_id: &TenantId, mode: CreateTenantFilesMode, temporary_tenant_dir: &Path, target_tenant_directory: &Path, @@ -3076,7 +3076,7 @@ fn try_create_target_tenant_dir( } let temporary_tenant_timelines_dir = rebase_directory( - &conf.timelines_path(&tenant_id), + &conf.timelines_path(tenant_id), target_tenant_directory, temporary_tenant_dir, ) @@ -3088,7 +3088,7 @@ fn try_create_target_tenant_dir( ) .with_context(|| format!("resolve tenant {tenant_id} temporary config path"))?; - Tenant::persist_tenant_config(&tenant_id, &temporary_tenant_config_path, tenant_conf, true)?; + Tenant::persist_tenant_config(tenant_id, &temporary_tenant_config_path, tenant_conf, true)?; crashsafe::create_dir(&temporary_tenant_timelines_dir).with_context(|| { format!( @@ -3376,7 +3376,7 @@ pub mod harness { } pub fn timeline_path(&self, timeline_id: &TimelineId) -> PathBuf { - self.conf.timeline_path(timeline_id, &self.tenant_id) + self.conf.timeline_path(&self.tenant_id, timeline_id) } } @@ -4370,7 +4370,7 @@ mod tests { assert!(!harness .conf - .timeline_path(&TIMELINE_ID, &tenant.tenant_id) + .timeline_path(&tenant.tenant_id, &TIMELINE_ID) .exists()); assert!(!harness diff --git a/pageserver/src/tenant/ephemeral_file.rs b/pageserver/src/tenant/ephemeral_file.rs index 4379438896..0d3c5da91c 100644 --- a/pageserver/src/tenant/ephemeral_file.rs +++ b/pageserver/src/tenant/ephemeral_file.rs @@ -55,7 +55,7 @@ impl EphemeralFile { l.next_file_id += 1; let filename = conf - .timeline_path(&timeline_id, &tenant_id) + .timeline_path(&tenant_id, &timeline_id) .join(PathBuf::from(format!("ephemeral-{}", file_id))); let file = VirtualFile::open_with_options( @@ -346,7 +346,7 @@ mod tests { let tenant_id = TenantId::from_str("11000000000000000000000000000000").unwrap(); let timeline_id = TimelineId::from_str("22000000000000000000000000000000").unwrap(); - fs::create_dir_all(conf.timeline_path(&timeline_id, &tenant_id))?; + fs::create_dir_all(conf.timeline_path(&tenant_id, &timeline_id))?; Ok((conf, tenant_id, timeline_id)) } diff --git a/pageserver/src/tenant/metadata.rs b/pageserver/src/tenant/metadata.rs index 1ea61fa26b..0ce10c7bc8 100644 --- a/pageserver/src/tenant/metadata.rs +++ b/pageserver/src/tenant/metadata.rs @@ -232,13 +232,13 @@ impl TimelineMetadata { /// Save timeline metadata to file pub fn save_metadata( conf: &'static PageServerConf, - timeline_id: TimelineId, - tenant_id: TenantId, + tenant_id: &TenantId, + timeline_id: &TimelineId, data: &TimelineMetadata, first_save: bool, ) -> anyhow::Result<()> { let _enter = info_span!("saving metadata").entered(); - let path = conf.metadata_path(timeline_id, tenant_id); + let path = conf.metadata_path(tenant_id, timeline_id); // use OpenOptions to ensure file presence is consistent with first_save let mut file = VirtualFile::open_with_options( &path, @@ -267,10 +267,10 @@ pub fn save_metadata( pub fn load_metadata( conf: &'static PageServerConf, - timeline_id: TimelineId, - tenant_id: TenantId, + tenant_id: &TenantId, + timeline_id: &TimelineId, ) -> anyhow::Result { - let metadata_path = conf.metadata_path(timeline_id, tenant_id); + let metadata_path = conf.metadata_path(tenant_id, timeline_id); let metadata_bytes = std::fs::read(&metadata_path).with_context(|| { format!( "Failed to read metadata bytes from path {}", diff --git a/pageserver/src/tenant/mgr.rs b/pageserver/src/tenant/mgr.rs index 09b825d2e9..8e31cc2ef1 100644 --- a/pageserver/src/tenant/mgr.rs +++ b/pageserver/src/tenant/mgr.rs @@ -184,9 +184,9 @@ pub fn schedule_local_tenant_processing( format!("Could not parse tenant id out of the tenant dir name in path {tenant_path:?}") })?; - let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(tenant_id); + let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(&tenant_id); anyhow::ensure!( - !conf.tenant_ignore_mark_file_path(tenant_id).exists(), + !conf.tenant_ignore_mark_file_path(&tenant_id).exists(), "Cannot load tenant, ignore mark found at {tenant_ignore_mark:?}" ); @@ -310,7 +310,7 @@ pub async fn create_tenant( // We're holding the tenants lock in write mode while doing local IO. // If this section ever becomes contentious, introduce a new `TenantState::Creating` // and do the work in that state. - let tenant_directory = super::create_tenant_files(conf, tenant_conf, tenant_id, CreateTenantFilesMode::Create)?; + let tenant_directory = super::create_tenant_files(conf, tenant_conf, &tenant_id, CreateTenantFilesMode::Create)?; // TODO: tenant directory remains on disk if we bail out from here on. // See https://github.com/neondatabase/neon/issues/4233 @@ -344,14 +344,9 @@ pub async fn set_new_tenant_config( info!("configuring tenant {tenant_id}"); let tenant = get_tenant(tenant_id, true).await?; - let tenant_config_path = conf.tenant_config_path(tenant_id); - Tenant::persist_tenant_config( - &tenant.tenant_id(), - &tenant_config_path, - new_tenant_conf, - false, - ) - .map_err(SetNewTenantConfigError::Persist)?; + let tenant_config_path = conf.tenant_config_path(&tenant_id); + Tenant::persist_tenant_config(&tenant_id, &tenant_config_path, new_tenant_conf, false) + .map_err(SetNewTenantConfigError::Persist)?; tenant.set_new_tenant_config(new_tenant_conf); Ok(()) } @@ -435,7 +430,7 @@ pub async fn detach_tenant( // Ignored tenants are not present in memory and will bail the removal from memory operation. // Before returning the error, check for ignored tenant removal case — we only need to clean its local files then. if detach_ignored && matches!(removal_result, Err(TenantStateError::NotFound(_))) { - let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(tenant_id); + let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(&tenant_id); if tenant_ignore_mark.exists() { info!("Detaching an ignored tenant"); local_files_cleanup_operation(tenant_id) @@ -457,7 +452,7 @@ pub async fn load_tenant( ) -> Result<(), TenantMapInsertError> { tenant_map_insert(tenant_id, || { let tenant_path = conf.tenant_path(&tenant_id); - let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(tenant_id); + let tenant_ignore_mark = conf.tenant_ignore_mark_file_path(&tenant_id); if tenant_ignore_mark.exists() { std::fs::remove_file(&tenant_ignore_mark) .with_context(|| format!("Failed to remove tenant ignore mark {tenant_ignore_mark:?} during tenant loading"))?; @@ -478,7 +473,7 @@ pub async fn ignore_tenant( tenant_id: TenantId, ) -> Result<(), TenantStateError> { remove_tenant_from_memory(tenant_id, async { - let ignore_mark_file = conf.tenant_ignore_mark_file_path(tenant_id); + let ignore_mark_file = conf.tenant_ignore_mark_file_path(&tenant_id); fs::File::create(&ignore_mark_file) .await .context("Failed to create ignore mark file") @@ -525,7 +520,7 @@ pub async fn attach_tenant( ctx: &RequestContext, ) -> Result<(), TenantMapInsertError> { tenant_map_insert(tenant_id, || { - let tenant_dir = create_tenant_files(conf, tenant_conf, tenant_id, CreateTenantFilesMode::Attach)?; + let tenant_dir = create_tenant_files(conf, tenant_conf, &tenant_id, CreateTenantFilesMode::Attach)?; // TODO: tenant directory remains on disk if we bail out from here on. // See https://github.com/neondatabase/neon/issues/4233 diff --git a/pageserver/src/tenant/remote_timeline_client.rs b/pageserver/src/tenant/remote_timeline_client.rs index 964a3ebe3f..bc185b4f7a 100644 --- a/pageserver/src/tenant/remote_timeline_client.rs +++ b/pageserver/src/tenant/remote_timeline_client.rs @@ -442,8 +442,8 @@ impl RemoteTimelineClient { let index_part = download::download_index_part( self.conf, &self.storage_impl, - self.tenant_id, - self.timeline_id, + &self.tenant_id, + &self.timeline_id, ) .measure_remote_op( self.tenant_id, @@ -765,8 +765,8 @@ impl RemoteTimelineClient { upload::upload_index_part( self.conf, &self.storage_impl, - self.tenant_id, - self.timeline_id, + &self.tenant_id, + &self.timeline_id, &index_part_with_deleted_at, ) .await?; @@ -841,7 +841,7 @@ impl RemoteTimelineClient { // Do not delete index part yet, it is needed for possible retry. If we remove it first // and retry will arrive to different pageserver there wont be any traces of it on remote storage - let timeline_path = self.conf.timeline_path(&self.timeline_id, &self.tenant_id); + let timeline_path = self.conf.timeline_path(&self.tenant_id, &self.timeline_id); let timeline_storage_path = self.conf.remote_path(&timeline_path)?; let remaining = self @@ -1003,7 +1003,7 @@ impl RemoteTimelineClient { UploadOp::UploadLayer(ref layer_file_name, ref layer_metadata) => { let path = &self .conf - .timeline_path(&self.timeline_id, &self.tenant_id) + .timeline_path(&self.tenant_id, &self.timeline_id) .join(layer_file_name.file_name()); upload::upload_timeline_layer( self.conf, @@ -1024,8 +1024,8 @@ impl RemoteTimelineClient { let res = upload::upload_index_part( self.conf, &self.storage_impl, - self.tenant_id, - self.timeline_id, + &self.tenant_id, + &self.timeline_id, index_part, ) .measure_remote_op( @@ -1044,7 +1044,7 @@ impl RemoteTimelineClient { UploadOp::Delete(delete) => { let path = &self .conf - .timeline_path(&self.timeline_id, &self.tenant_id) + .timeline_path(&self.tenant_id, &self.timeline_id) .join(delete.layer_file_name.file_name()); delete::delete_layer(self.conf, &self.storage_impl, path) .measure_remote_op( diff --git a/pageserver/src/tenant/remote_timeline_client/download.rs b/pageserver/src/tenant/remote_timeline_client/download.rs index 87b1026a76..64f4a0a113 100644 --- a/pageserver/src/tenant/remote_timeline_client/download.rs +++ b/pageserver/src/tenant/remote_timeline_client/download.rs @@ -46,7 +46,7 @@ pub async fn download_layer_file<'a>( ) -> Result { debug_assert_current_span_has_tenant_and_timeline_id(); - let timeline_path = conf.timeline_path(&timeline_id, &tenant_id); + let timeline_path = conf.timeline_path(&tenant_id, &timeline_id); let local_path = timeline_path.join(layer_file_name.file_name()); @@ -229,11 +229,11 @@ pub async fn list_remote_timelines<'a>( pub(super) async fn download_index_part( conf: &'static PageServerConf, storage: &GenericRemoteStorage, - tenant_id: TenantId, - timeline_id: TimelineId, + tenant_id: &TenantId, + timeline_id: &TimelineId, ) -> Result { let index_part_path = conf - .metadata_path(timeline_id, tenant_id) + .metadata_path(tenant_id, timeline_id) .with_file_name(IndexPart::FILE_NAME); let part_storage_path = conf .remote_path(&index_part_path) diff --git a/pageserver/src/tenant/remote_timeline_client/upload.rs b/pageserver/src/tenant/remote_timeline_client/upload.rs index b520bb4b0c..098c661622 100644 --- a/pageserver/src/tenant/remote_timeline_client/upload.rs +++ b/pageserver/src/tenant/remote_timeline_client/upload.rs @@ -15,8 +15,8 @@ use super::index::LayerFileMetadata; pub(super) async fn upload_index_part<'a>( conf: &'static PageServerConf, storage: &'a GenericRemoteStorage, - tenant_id: TenantId, - timeline_id: TimelineId, + tenant_id: &TenantId, + timeline_id: &TimelineId, index_part: &'a IndexPart, ) -> anyhow::Result<()> { tracing::trace!("uploading new index part"); @@ -31,7 +31,7 @@ pub(super) async fn upload_index_part<'a>( let index_part_bytes = tokio::io::BufReader::new(std::io::Cursor::new(index_part_bytes)); let index_part_path = conf - .metadata_path(timeline_id, tenant_id) + .metadata_path(tenant_id, timeline_id) .with_file_name(IndexPart::FILE_NAME); let storage_path = conf.remote_path(&index_part_path)?; diff --git a/pageserver/src/tenant/storage_layer/delta_layer.rs b/pageserver/src/tenant/storage_layer/delta_layer.rs index c92a2898e4..78b8910921 100644 --- a/pageserver/src/tenant/storage_layer/delta_layer.rs +++ b/pageserver/src/tenant/storage_layer/delta_layer.rs @@ -459,22 +459,22 @@ impl PersistentLayer for DeltaLayer { impl DeltaLayer { fn path_for( path_or_conf: &PathOrConf, - timeline_id: TimelineId, - tenant_id: TenantId, + tenant_id: &TenantId, + timeline_id: &TimelineId, fname: &DeltaFileName, ) -> PathBuf { match path_or_conf { PathOrConf::Path(path) => path.clone(), PathOrConf::Conf(conf) => conf - .timeline_path(&timeline_id, &tenant_id) + .timeline_path(tenant_id, timeline_id) .join(fname.to_string()), } } fn temp_path_for( conf: &PageServerConf, - timeline_id: TimelineId, - tenant_id: TenantId, + tenant_id: &TenantId, + timeline_id: &TimelineId, key_start: Key, lsn_range: &Range, ) -> PathBuf { @@ -484,7 +484,7 @@ impl DeltaLayer { .map(char::from) .collect(); - conf.timeline_path(&timeline_id, &tenant_id).join(format!( + conf.timeline_path(tenant_id, timeline_id).join(format!( "{}-XXX__{:016X}-{:016X}.{}.{}", key_start, u64::from(lsn_range.start), @@ -606,8 +606,8 @@ impl DeltaLayer { pub fn path(&self) -> PathBuf { Self::path_for( &self.path_or_conf, - self.desc.timeline_id, - self.desc.tenant_id, + &self.desc.tenant_id, + &self.desc.timeline_id, &self.layer_name(), ) } @@ -655,7 +655,7 @@ impl DeltaLayerWriterInner { // // Note: This overwrites any existing file. There shouldn't be any. // FIXME: throw an error instead? - let path = DeltaLayer::temp_path_for(conf, timeline_id, tenant_id, key_start, &lsn_range); + let path = DeltaLayer::temp_path_for(conf, &tenant_id, &timeline_id, key_start, &lsn_range); let mut file = VirtualFile::create(&path)?; // make room for the header block @@ -770,8 +770,8 @@ impl DeltaLayerWriterInner { // FIXME: throw an error instead? let final_path = DeltaLayer::path_for( &PathOrConf::Conf(self.conf), - self.timeline_id, - self.tenant_id, + &self.tenant_id, + &self.timeline_id, &DeltaFileName { key_range: self.key_start..key_end, lsn_range: self.lsn_range, diff --git a/pageserver/src/tenant/storage_layer/image_layer.rs b/pageserver/src/tenant/storage_layer/image_layer.rs index 30a7d2f179..cef04df523 100644 --- a/pageserver/src/tenant/storage_layer/image_layer.rs +++ b/pageserver/src/tenant/storage_layer/image_layer.rs @@ -288,7 +288,7 @@ impl ImageLayer { match path_or_conf { PathOrConf::Path(path) => path.to_path_buf(), PathOrConf::Conf(conf) => conf - .timeline_path(&timeline_id, &tenant_id) + .timeline_path(&tenant_id, &timeline_id) .join(fname.to_string()), } } @@ -305,7 +305,7 @@ impl ImageLayer { .map(char::from) .collect(); - conf.timeline_path(&timeline_id, &tenant_id) + conf.timeline_path(&tenant_id, &timeline_id) .join(format!("{fname}.{rand_string}.{TEMP_FILE_SUFFIX}")) } diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 626729859c..626fdad0cf 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -1613,7 +1613,7 @@ impl Timeline { // Scan timeline directory and create ImageFileName and DeltaFilename // structs representing all files on disk - let timeline_path = self.conf.timeline_path(&self.timeline_id, &self.tenant_id); + let timeline_path = self.conf.timeline_path(&self.tenant_id, &self.timeline_id); // total size of layer files in the current timeline directory let mut total_physical_size = 0; @@ -2208,7 +2208,7 @@ impl Timeline { fail::fail_point!("timeline-calculate-logical-size-check-dir-exists", |_| { if !self .conf - .metadata_path(self.timeline_id, self.tenant_id) + .metadata_path(&self.tenant_id, &self.timeline_id) .exists() { error!("timeline-calculate-logical-size-pre metadata file does not exist") @@ -3003,8 +3003,8 @@ impl Timeline { save_metadata( self.conf, - self.timeline_id, - self.tenant_id, + &self.tenant_id, + &self.timeline_id, &metadata, false, ) @@ -3053,7 +3053,7 @@ impl Timeline { par_fsync::par_fsync(&[new_delta_path]).context("fsync of delta layer")?; par_fsync::par_fsync(&[self_clone .conf - .timeline_path(&self_clone.timeline_id, &self_clone.tenant_id)]) + .timeline_path(&self_clone.tenant_id, &self_clone.timeline_id)]) .context("fsync of timeline dir")?; anyhow::Ok(new_delta) @@ -3296,7 +3296,7 @@ impl Timeline { .await .context("fsync of newly created layer files")?; - par_fsync::par_fsync_async(&[self.conf.timeline_path(&self.timeline_id, &self.tenant_id)]) + par_fsync::par_fsync_async(&[self.conf.timeline_path(&self.tenant_id, &self.timeline_id)]) .await .context("fsync of timeline dir")?; @@ -3305,7 +3305,7 @@ impl Timeline { let mut guard = self.layers.write().await; let (layers, mapping) = &mut *guard; let mut updates = layers.batch_update(); - let timeline_path = self.conf.timeline_path(&self.timeline_id, &self.tenant_id); + let timeline_path = self.conf.timeline_path(&self.tenant_id, &self.timeline_id); for l in image_layers { let path = l.filename(); @@ -3820,7 +3820,7 @@ impl Timeline { // minimize latency. par_fsync::par_fsync(&layer_paths).context("fsync all new layers")?; - par_fsync::par_fsync(&[self.conf.timeline_path(&self.timeline_id, &self.tenant_id)]) + par_fsync::par_fsync(&[self.conf.timeline_path(&self.tenant_id, &self.timeline_id)]) .context("fsync of timeline dir")?; layer_paths.pop().unwrap();