diff --git a/pageserver/src/deletion_queue/list_writer.rs b/pageserver/src/deletion_queue/list_writer.rs index 21b8c356cd..6727957b2a 100644 --- a/pageserver/src/deletion_queue/list_writer.rs +++ b/pageserver/src/deletion_queue/list_writer.rs @@ -349,7 +349,7 @@ impl ListWriter { info!("Started deletion frontend worker"); // Synchronous, but we only do it once per process lifetime so it's tolerable - if let Err(e) = create_dir_all(&self.conf.deletion_prefix()) { + if let Err(e) = create_dir_all(self.conf.deletion_prefix()) { tracing::error!( "Failed to create deletion list directory {}, deletions will not be executed ({e})", self.conf.deletion_prefix(), diff --git a/pageserver/src/tenant/remote_timeline_client/index.rs b/pageserver/src/tenant/remote_timeline_client/index.rs index 05f9f5dcd2..7cf963ca9d 100644 --- a/pageserver/src/tenant/remote_timeline_client/index.rs +++ b/pageserver/src/tenant/remote_timeline_client/index.rs @@ -98,7 +98,7 @@ impl IndexPart { const LATEST_VERSION: usize = 4; // Versions we may see when reading from a bucket. - pub const KNOWN_VERSIONS: &[usize] = &[1, 2, 3, 4]; + pub const KNOWN_VERSIONS: &'static [usize] = &[1, 2, 3, 4]; pub const FILE_NAME: &'static str = "index_part.json"; diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 278290eef4..4608683c4a 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -1859,19 +1859,17 @@ impl Timeline { "aborted because task_mgr shutdown requested".to_string() }; - loop { - tokio::select! { - res = &mut calculation => { return res } - reason = timeline_state_cancellation => { - debug!(reason = reason, "cancelling calculation"); - cancel.cancel(); - return calculation.await; - } - reason = taskmgr_shutdown_cancellation => { - debug!(reason = reason, "cancelling calculation"); - cancel.cancel(); - return calculation.await; - } + tokio::select! { + res = &mut calculation => { res } + reason = timeline_state_cancellation => { + debug!(reason = reason, "cancelling calculation"); + cancel.cancel(); + calculation.await + } + reason = taskmgr_shutdown_cancellation => { + debug!(reason = reason, "cancelling calculation"); + cancel.cancel(); + calculation.await } } } diff --git a/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs b/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs index 0831b9ceda..3a6599ec55 100644 --- a/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs +++ b/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs @@ -122,7 +122,7 @@ pub(super) async fn handle_walreceiver_connection( // Connect to the database in replication mode. info!("connecting to {wal_source_connconf:?}"); - let (mut replication_client, connection) = { + let (replication_client, connection) = { let mut config = wal_source_connconf.to_tokio_postgres_config(); config.application_name("pageserver"); config.replication_mode(tokio_postgres::config::ReplicationMode::Physical); @@ -205,7 +205,7 @@ pub(super) async fn handle_walreceiver_connection( gauge.dec(); } - let identify = identify_system(&mut replication_client).await?; + let identify = identify_system(&replication_client).await?; info!("{identify:?}"); let end_of_wal = Lsn::from(u64::from(identify.xlogpos)); @@ -444,7 +444,7 @@ struct IdentifySystem { struct IdentifyError; /// Run the postgres `IDENTIFY_SYSTEM` command -async fn identify_system(client: &mut Client) -> anyhow::Result { +async fn identify_system(client: &Client) -> anyhow::Result { let query_str = "IDENTIFY_SYSTEM"; let response = client.simple_query(query_str).await?; diff --git a/pageserver/src/walingest.rs b/pageserver/src/walingest.rs index fb1dbcd6ba..23367928d3 100644 --- a/pageserver/src/walingest.rs +++ b/pageserver/src/walingest.rs @@ -443,7 +443,7 @@ impl<'a> WalIngest<'a> { &mut self, buf: &mut Bytes, modification: &mut DatadirModification<'_>, - decoded: &mut DecodedWALRecord, + decoded: &DecodedWALRecord, ctx: &RequestContext, ) -> anyhow::Result<()> { // Handle VM bit updates that are implicitly part of heap records. @@ -749,7 +749,7 @@ impl<'a> WalIngest<'a> { &mut self, buf: &mut Bytes, modification: &mut DatadirModification<'_>, - decoded: &mut DecodedWALRecord, + decoded: &DecodedWALRecord, ctx: &RequestContext, ) -> anyhow::Result<()> { // Handle VM bit updates that are implicitly part of heap records. diff --git a/proxy/src/config.rs b/proxy/src/config.rs index 96856ba051..9607ecd153 100644 --- a/proxy/src/config.rs +++ b/proxy/src/config.rs @@ -223,7 +223,7 @@ pub struct CacheOptions { impl CacheOptions { /// Default options for [`crate::console::provider::NodeInfoCache`]. - pub const DEFAULT_OPTIONS_NODE_INFO: &str = "size=4000,ttl=4m"; + pub const DEFAULT_OPTIONS_NODE_INFO: &'static str = "size=4000,ttl=4m"; /// Parse cache options passed via cmdline. /// Example: [`Self::DEFAULT_OPTIONS_NODE_INFO`]. diff --git a/safekeeper/src/timelines_global_map.rs b/safekeeper/src/timelines_global_map.rs index 1434644123..cbb3342e40 100644 --- a/safekeeper/src/timelines_global_map.rs +++ b/safekeeper/src/timelines_global_map.rs @@ -296,8 +296,8 @@ impl GlobalTimelines { global_lock .timelines .values() - .cloned() .filter(|t| !t.is_cancelled()) + .cloned() .collect() } diff --git a/safekeeper/src/wal_storage.rs b/safekeeper/src/wal_storage.rs index 2070122e8e..fa44b24258 100644 --- a/safekeeper/src/wal_storage.rs +++ b/safekeeper/src/wal_storage.rs @@ -188,7 +188,7 @@ impl PhysicalStorage { } /// Call fdatasync if config requires so. - async fn fdatasync_file(&mut self, file: &mut File) -> Result<()> { + async fn fdatasync_file(&mut self, file: &File) -> Result<()> { if !self.conf.no_sync { self.metrics .observe_flush_seconds(time_io_closure(file.sync_data()).await?); @@ -197,7 +197,7 @@ impl PhysicalStorage { } /// Call fsync if config requires so. - async fn fsync_file(&mut self, file: &mut File) -> Result<()> { + async fn fsync_file(&mut self, file: &File) -> Result<()> { if !self.conf.no_sync { self.metrics .observe_flush_seconds(time_io_closure(file.sync_all()).await?); @@ -231,7 +231,7 @@ impl PhysicalStorage { .with_context(|| format!("Failed to open log file {:?}", &wal_file_path))?; write_zeroes(&mut file, self.wal_seg_size).await?; - self.fsync_file(&mut file).await?; + self.fsync_file(&file).await?; Ok((file, true)) } } @@ -255,7 +255,7 @@ impl PhysicalStorage { if xlogoff + buf.len() == self.wal_seg_size { // If we reached the end of a WAL segment, flush and close it. - self.fdatasync_file(&mut file).await?; + self.fdatasync_file(&file).await?; // Rename partial file to completed file let (wal_file_path, wal_file_partial_path) = @@ -277,8 +277,8 @@ impl PhysicalStorage { async fn write_exact(&mut self, pos: Lsn, mut buf: &[u8]) -> Result<()> { if self.write_lsn != pos { // need to flush the file before discarding it - if let Some(mut file) = self.file.take() { - self.fdatasync_file(&mut file).await?; + if let Some(file) = self.file.take() { + self.fdatasync_file(&file).await?; } self.write_lsn = pos; @@ -367,8 +367,8 @@ impl Storage for PhysicalStorage { return Ok(()); } - if let Some(mut unflushed_file) = self.file.take() { - self.fdatasync_file(&mut unflushed_file).await?; + if let Some(unflushed_file) = self.file.take() { + self.fdatasync_file(&unflushed_file).await?; self.file = Some(unflushed_file); } else { // We have unflushed data (write_lsn != flush_lsn), but no file. @@ -410,8 +410,8 @@ impl Storage for PhysicalStorage { } // Close previously opened file, if any - if let Some(mut unflushed_file) = self.file.take() { - self.fdatasync_file(&mut unflushed_file).await?; + if let Some(unflushed_file) = self.file.take() { + self.fdatasync_file(&unflushed_file).await?; } let xlogoff = end_pos.segment_offset(self.wal_seg_size); @@ -425,7 +425,7 @@ impl Storage for PhysicalStorage { // Fill end with zeroes file.seek(SeekFrom::Start(xlogoff as u64)).await?; write_zeroes(&mut file, self.wal_seg_size - xlogoff).await?; - self.fdatasync_file(&mut file).await?; + self.fdatasync_file(&file).await?; if !is_partial { // Make segment partial once again