diff --git a/libs/utils/src/seqwait.rs b/libs/utils/src/seqwait.rs index 014887392edb..5bc7ca91d691 100644 --- a/libs/utils/src/seqwait.rs +++ b/libs/utils/src/seqwait.rs @@ -58,7 +58,7 @@ where // to get that. impl PartialOrd for Waiter { fn partial_cmp(&self, other: &Self) -> Option { - other.wake_num.partial_cmp(&self.wake_num) + Some(self.cmp(other)) } } diff --git a/pageserver/src/deletion_queue.rs b/pageserver/src/deletion_queue.rs index 487a9d47ee75..e49ed34215d1 100644 --- a/pageserver/src/deletion_queue.rs +++ b/pageserver/src/deletion_queue.rs @@ -186,7 +186,7 @@ where V: Serialize, I: AsRef<[u8]>, { - let transformed = input.iter().map(|(k, v)| (hex::encode(k), v.clone())); + let transformed = input.iter().map(|(k, v)| (hex::encode(k), v)); transformed .collect::>() @@ -325,10 +325,7 @@ impl DeletionList { return false; } - let timeline_entry = tenant_entry - .timelines - .entry(*timeline) - .or_insert_with(Vec::new); + let timeline_entry = tenant_entry.timelines.entry(*timeline).or_default(); let timeline_remote_path = remote_timeline_path(tenant, timeline); diff --git a/pageserver/src/metrics.rs b/pageserver/src/metrics.rs index 1dc85fd76fee..c154b4a4ca3b 100644 --- a/pageserver/src/metrics.rs +++ b/pageserver/src/metrics.rs @@ -691,10 +691,9 @@ impl StorageIoTime { .expect("failed to define a metric"); let metrics = std::array::from_fn(|i| { let op = StorageIoOperation::from_repr(i).unwrap(); - let metric = storage_io_histogram_vec + storage_io_histogram_vec .get_metric_with_label_values(&[op.as_str()]) - .unwrap(); - metric + .unwrap() }); Self { metrics } } diff --git a/pageserver/src/tenant/storage_layer/delta_layer.rs b/pageserver/src/tenant/storage_layer/delta_layer.rs index 8f0f3780c2da..55fb491b6541 100644 --- a/pageserver/src/tenant/storage_layer/delta_layer.rs +++ b/pageserver/src/tenant/storage_layer/delta_layer.rs @@ -511,8 +511,7 @@ impl DeltaLayer { /// /// This variant is only used for debugging purposes, by the 'pagectl' binary. pub fn new_for_path(path: &Utf8Path, file: File) -> Result { - let mut summary_buf = Vec::new(); - summary_buf.resize(PAGE_SZ, 0); + let mut summary_buf = vec![0; PAGE_SZ]; file.read_exact_at(&mut summary_buf, 0)?; let summary = Summary::des_prefix(&summary_buf)?; diff --git a/pageserver/src/tenant/storage_layer/image_layer.rs b/pageserver/src/tenant/storage_layer/image_layer.rs index 3608cfbfda11..94138a078626 100644 --- a/pageserver/src/tenant/storage_layer/image_layer.rs +++ b/pageserver/src/tenant/storage_layer/image_layer.rs @@ -400,8 +400,7 @@ impl ImageLayer { /// /// This variant is only used for debugging purposes, by the 'pagectl' binary. pub fn new_for_path(path: &Utf8Path, file: File) -> Result { - let mut summary_buf = Vec::new(); - summary_buf.resize(PAGE_SZ, 0); + let mut summary_buf = vec![0; PAGE_SZ]; file.read_exact_at(&mut summary_buf, 0)?; let summary = Summary::des_prefix(&summary_buf)?; let metadata = file diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 4f28b03c674d..4dddb7b2fd1a 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -158,7 +158,7 @@ pub struct Timeline { /// The generation of the tenant that instantiated us: this is used for safety when writing remote objects. /// Never changes for the lifetime of this [`Timeline`] object. - /// + /// /// This duplicates the generation stored in LocationConf, but that structure is mutable: /// this copy enforces the invariant that generatio doesn't change during a Tenant's lifetime. generation: Generation, @@ -2363,7 +2363,7 @@ impl Timeline { // during branch creation. match ancestor.wait_to_become_active(ctx).await { Ok(()) => {} - Err(state) if state == TimelineState::Stopping => { + Err(TimelineState::Stopping) => { return Err(PageReconstructError::AncestorStopping(ancestor.timeline_id)); } Err(state) => { diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index 370bf6242ddd..23433fa69456 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -825,7 +825,7 @@ impl PostgresRedoManager { while nwrite < writebuf.len() { let n = loop { match nix::poll::poll(&mut pollfds[0..2], wal_redo_timeout.as_millis() as i32) { - Err(e) if e == nix::errno::Errno::EINTR => continue, + Err(nix::errno::Errno::EINTR) => continue, res => break res, } }?; @@ -917,7 +917,7 @@ impl PostgresRedoManager { // and forward any logging information that the child writes to its stderr to the page server's log. let n = loop { match nix::poll::poll(&mut pollfds[1..3], wal_redo_timeout.as_millis() as i32) { - Err(e) if e == nix::errno::Errno::EINTR => continue, + Err(nix::errno::Errno::EINTR) => continue, res => break res, } }?; diff --git a/safekeeper/src/timeline.rs b/safekeeper/src/timeline.rs index 319e4047eee1..37821eae23f0 100644 --- a/safekeeper/src/timeline.rs +++ b/safekeeper/src/timeline.rs @@ -723,9 +723,9 @@ impl Timeline { if horizon_segno <= 1 || horizon_segno <= shared_state.last_removed_segno { return Ok(()); // nothing to do } - let remover = shared_state.sk.wal_store.remove_up_to(horizon_segno - 1); + // release the lock before removing - remover + shared_state.sk.wal_store.remove_up_to(horizon_segno - 1) }; // delete old WAL files