Skip to content

Commit

Permalink
Fix warnings and compile errors on nightly (#6886)
Browse files Browse the repository at this point in the history
Nightly has added a bunch of compiler and linter warnings. There is also
two dependencies that fail compilation on latest nightly due to using
the old `stdsimd` feature name. This PR fixes them.
  • Loading branch information
arpad-m committed Mar 1, 2024
1 parent 1efaa16 commit 82853cc
Show file tree
Hide file tree
Showing 45 changed files with 51 additions and 114 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions compute_tools/src/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ use futures::future::join_all;
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use postgres::{Client, NoTls};
use tokio;
use tokio_postgres;
use tracing::{debug, error, info, instrument, warn};
use utils::id::{TenantId, TimelineId};
use utils::lsn::Lsn;
Expand Down
2 changes: 1 addition & 1 deletion compute_tools/src/extension_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ More specifically, here is an example ext_index.json
}
}
*/
use anyhow::{self, Result};
use anyhow::Result;
use anyhow::{bail, Context};
use bytes::Bytes;
use compute_api::spec::RemoteExtSpec;
Expand Down
2 changes: 0 additions & 2 deletions compute_tools/src/http/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ use compute_api::responses::{ComputeStatus, ComputeStatusResponse, GenericAPIErr
use anyhow::Result;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use num_cpus;
use serde_json;
use tokio::task;
use tracing::{error, info, warn};
use tracing_utils::http::OtelName;
Expand Down
2 changes: 1 addition & 1 deletion control_plane/attachment_service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use attachment_service::http::make_router;
use attachment_service::metrics::preinitialize_metrics;
use attachment_service::persistence::Persistence;
use attachment_service::service::{Config, Service};
use aws_config::{self, BehaviorVersion, Region};
use aws_config::{BehaviorVersion, Region};
use camino::Utf8PathBuf;
use clap::Parser;
use diesel::Connection;
Expand Down
6 changes: 4 additions & 2 deletions control_plane/attachment_service/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ use self::split_state::SplitState;
use camino::Utf8Path;
use camino::Utf8PathBuf;
use diesel::pg::PgConnection;
use diesel::prelude::*;
use diesel::Connection;
use diesel::{
Connection, ExpressionMethods, Insertable, QueryDsl, QueryResult, Queryable, RunQueryDsl,
Selectable, SelectableHelper,
};
use pageserver_api::controller_api::NodeSchedulingPolicy;
use pageserver_api::models::TenantConfig;
use pageserver_api::shard::{ShardCount, ShardNumber, TenantShardId};
Expand Down
1 change: 0 additions & 1 deletion control_plane/attachment_service/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ pub(crate) mod test_utils {
#[cfg(test)]
mod tests {
use super::*;
use utils::id::NodeId;

use crate::tenant_state::IntentState;
#[test]
Expand Down
2 changes: 1 addition & 1 deletion control_plane/src/attachment_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl AttachmentService {
"localhost",
"-p",
&format!("{}", self.postgres_port),
&DB_NAME,
DB_NAME,
])
.output()
.await
Expand Down
2 changes: 0 additions & 2 deletions libs/pageserver_api/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use byteorder::{BigEndian, ReadBytesExt};
use postgres_ffi::BLCKSZ;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use strum_macros;
use utils::{
completion,
history_buffer::HistoryBufferWithDropCounter,
Expand Down Expand Up @@ -1077,7 +1076,6 @@ impl PagestreamBeMessage {

#[cfg(test)]
mod tests {
use bytes::Buf;
use serde_json::json;

use super::*;
Expand Down
6 changes: 1 addition & 5 deletions libs/pageserver_api/src/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
};
use hex::FromHex;
use serde::{Deserialize, Serialize};
use thiserror;
use utils::id::TenantId;

#[derive(Ord, PartialOrd, Eq, PartialEq, Clone, Copy, Serialize, Deserialize, Debug, Hash)]
Expand Down Expand Up @@ -656,10 +655,7 @@ fn key_to_shard_number(count: ShardCount, stripe_size: ShardStripeSize, key: &Ke

#[cfg(test)]
mod tests {
use std::str::FromStr;

use bincode;
use utils::{id::TenantId, Hex};
use utils::Hex;

use super::*;

Expand Down
2 changes: 0 additions & 2 deletions libs/remote_storage/src/local_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,7 @@ fn file_exists(file_path: &Utf8Path) -> anyhow::Result<bool> {
mod fs_tests {
use super::*;

use bytes::Bytes;
use camino_tempfile::tempdir;
use futures_util::Stream;
use std::{collections::HashMap, io::Write};

async fn read_and_check_metadata(
Expand Down
2 changes: 1 addition & 1 deletion libs/remote_storage/src/s3_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ mod tests {
Some("test/prefix/"),
Some("/test/prefix/"),
];
let expected_outputs = vec![
let expected_outputs = [
vec!["", "some/path", "some/path"],
vec!["/", "/some/path", "/some/path"],
vec![
Expand Down
1 change: 0 additions & 1 deletion libs/utils/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// For details about authentication see docs/authentication.md

use arc_swap::ArcSwap;
use serde;
use std::{borrow::Cow, fmt::Display, fs, sync::Arc};

use anyhow::Result;
Expand Down
6 changes: 4 additions & 2 deletions libs/utils/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use tokio_util::task::{task_tracker::TaskTrackerToken, TaskTracker};
///
/// Can be cloned, moved and kept around in futures as "guard objects".
#[derive(Clone)]
pub struct Completion(TaskTrackerToken);
pub struct Completion {
_token: TaskTrackerToken,
}

/// Barrier will wait until all clones of [`Completion`] have been dropped.
#[derive(Clone)]
Expand Down Expand Up @@ -49,5 +51,5 @@ pub fn channel() -> (Completion, Barrier) {
tracker.close();

let token = tracker.token();
(Completion(token), Barrier(tracker))
(Completion { _token: token }, Barrier(tracker))
}
2 changes: 1 addition & 1 deletion libs/utils/src/http/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use metrics::{register_int_counter, Encoder, IntCounter, TextEncoder};
use once_cell::sync::Lazy;
use routerify::ext::RequestExt;
use routerify::{Middleware, RequestInfo, Router, RouterBuilder};
use tracing::{self, debug, info, info_span, warn, Instrument};
use tracing::{debug, info, info_span, warn, Instrument};

use std::future::Future;
use std::str::FromStr;
Expand Down
1 change: 0 additions & 1 deletion libs/utils/src/lsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ mod tests {

use super::*;

use serde::ser::Serialize;
use serde_assert::{Deserializer, Serializer, Token, Tokens};

#[test]
Expand Down
3 changes: 1 addition & 2 deletions libs/utils/src/seqwait.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![warn(missing_docs)]

use std::cmp::{Eq, Ordering, PartialOrd};
use std::cmp::{Eq, Ordering};
use std::collections::BinaryHeap;
use std::fmt::Debug;
use std::mem;
Expand Down Expand Up @@ -249,7 +249,6 @@ where
mod tests {
use super::*;
use std::sync::Arc;
use std::time::Duration;

impl MonotonicCounter<i32> for i32 {
fn cnt_advance(&mut self, val: i32) {
Expand Down
2 changes: 1 addition & 1 deletion libs/utils/src/simple_rcu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl RcuWaitList {
#[cfg(test)]
mod tests {
use super::*;
use std::sync::{Arc, Mutex};
use std::sync::Mutex;
use std::time::Duration;

#[tokio::test]
Expand Down
1 change: 0 additions & 1 deletion libs/utils/src/sync/heavier_once_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ mod tests {
use std::{
convert::Infallible,
pin::{pin, Pin},
sync::atomic::{AtomicUsize, Ordering},
time::Duration,
};

Expand Down
1 change: 0 additions & 1 deletion pageserver/compaction/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use futures::future::BoxFuture;
use futures::{Stream, StreamExt};
use itertools::Itertools;
use pin_project_lite::pin_project;
use std::cmp::Ord;
use std::collections::BinaryHeap;
use std::collections::VecDeque;
use std::future::Future;
Expand Down
6 changes: 1 addition & 5 deletions pageserver/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::num::NonZeroUsize;
use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use toml_edit;
use toml_edit::{Document, Item};

use camino::{Utf8Path, Utf8PathBuf};
Expand Down Expand Up @@ -1203,10 +1202,7 @@ impl ConfigurableSemaphore {

#[cfg(test)]
mod tests {
use std::{
fs,
num::{NonZeroU32, NonZeroUsize},
};
use std::{fs, num::NonZeroU32};

use camino_tempfile::{tempdir, Utf8TempDir};
use pageserver_api::models::EvictionPolicy;
Expand Down
2 changes: 0 additions & 2 deletions pageserver/src/consumption_metrics/metrics/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use super::*;
use std::collections::HashMap;
use std::time::SystemTime;
use utils::lsn::Lsn;

#[test]
fn startup_collected_timeline_metrics_before_advancing() {
Expand Down
17 changes: 4 additions & 13 deletions pageserver/src/deletion_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ use remote_storage::{GenericRemoteStorage, RemotePath};
use serde::Deserialize;
use serde::Serialize;
use thiserror::Error;
use tokio;
use tokio_util::sync::CancellationToken;
use tracing::Instrument;
use tracing::{self, debug, error};
use tracing::{debug, error};
use utils::crashsafe::path_with_suffix_extension;
use utils::generation::Generation;
use utils::id::TimelineId;
Expand Down Expand Up @@ -726,7 +725,7 @@ mod test {
use camino::Utf8Path;
use hex_literal::hex;
use pageserver_api::shard::ShardIndex;
use std::{io::ErrorKind, time::Duration};
use std::io::ErrorKind;
use tracing::info;

use remote_storage::{RemoteStorageConfig, RemoteStorageKind};
Expand All @@ -735,10 +734,7 @@ mod test {
use crate::{
control_plane_client::RetryForeverError,
repository::Key,
tenant::{
harness::TenantHarness, remote_timeline_client::remote_timeline_path,
storage_layer::DeltaFileName,
},
tenant::{harness::TenantHarness, storage_layer::DeltaFileName},
};

use super::*;
Expand Down Expand Up @@ -1161,13 +1157,8 @@ mod test {
pub(crate) mod mock {
use tracing::info;

use crate::tenant::remote_timeline_client::remote_layer_path;

use super::*;
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc,
};
use std::sync::atomic::{AtomicUsize, Ordering};

pub struct ConsumerState {
rx: tokio::sync::mpsc::UnboundedReceiver<ListWriterQueueMessage>,
Expand Down
11 changes: 5 additions & 6 deletions pageserver/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1915,17 +1915,16 @@ impl Drop for TimelineMetrics {
let tenant_id = &self.tenant_id;
let timeline_id = &self.timeline_id;
let shard_id = &self.shard_id;
let _ = LAST_RECORD_LSN.remove_label_values(&[tenant_id, &shard_id, timeline_id]);
let _ = LAST_RECORD_LSN.remove_label_values(&[tenant_id, shard_id, timeline_id]);
{
RESIDENT_PHYSICAL_SIZE_GLOBAL.sub(self.resident_physical_size_get());
let _ =
RESIDENT_PHYSICAL_SIZE.remove_label_values(&[tenant_id, &shard_id, timeline_id]);
let _ = RESIDENT_PHYSICAL_SIZE.remove_label_values(&[tenant_id, shard_id, timeline_id]);
}
let _ = CURRENT_LOGICAL_SIZE.remove_label_values(&[tenant_id, &shard_id, timeline_id]);
let _ = CURRENT_LOGICAL_SIZE.remove_label_values(&[tenant_id, shard_id, timeline_id]);
if let Some(metric) = Lazy::get(&DIRECTORY_ENTRIES_COUNT) {
let _ = metric.remove_label_values(&[tenant_id, &shard_id, timeline_id]);
let _ = metric.remove_label_values(&[tenant_id, shard_id, timeline_id]);
}
let _ = EVICTIONS.remove_label_values(&[tenant_id, &shard_id, timeline_id]);
let _ = EVICTIONS.remove_label_values(&[tenant_id, shard_id, timeline_id]);

self.evictions_with_low_residence_duration
.write()
Expand Down
11 changes: 6 additions & 5 deletions pageserver/src/page_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@

use std::{
collections::{hash_map::Entry, HashMap},
convert::TryInto,
sync::{
atomic::{AtomicU64, AtomicU8, AtomicUsize, Ordering},
Arc, Weak,
Expand Down Expand Up @@ -262,7 +261,9 @@ pub struct PageCache {
size_metrics: &'static PageCacheSizeMetrics,
}

struct PinnedSlotsPermit(tokio::sync::OwnedSemaphorePermit);
struct PinnedSlotsPermit {
_permit: tokio::sync::OwnedSemaphorePermit,
}

///
/// PageReadGuard is a "lease" on a buffer, for reading. The page is kept locked
Expand Down Expand Up @@ -558,9 +559,9 @@ impl PageCache {
)
.await
{
Ok(res) => Ok(PinnedSlotsPermit(
res.expect("this semaphore is never closed"),
)),
Ok(res) => Ok(PinnedSlotsPermit {
_permit: res.expect("this semaphore is never closed"),
}),
Err(_timeout) => {
crate::metrics::page_cache_errors_inc(
crate::metrics::PageCacheErrorKind::AcquirePinnedSlotTimeout,
Expand Down
3 changes: 1 addition & 2 deletions pageserver/src/page_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use pageserver_api::models::{
};
use pageserver_api::shard::ShardIndex;
use pageserver_api::shard::ShardNumber;
use postgres_backend::{self, is_expected_io_error, AuthType, PostgresBackend, QueryError};
use postgres_backend::{is_expected_io_error, AuthType, PostgresBackend, QueryError};
use pq_proto::framed::ConnectionError;
use pq_proto::FeStartupPacket;
use pq_proto::{BeMessage, FeMessage, RowDescriptor};
Expand All @@ -44,7 +44,6 @@ use tokio::io::AsyncWriteExt;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_util::io::StreamReader;
use tokio_util::sync::CancellationToken;
use tracing::field;
use tracing::*;
use utils::id::ConnectionId;
use utils::sync::gate::GateGuard;
Expand Down
1 change: 0 additions & 1 deletion pageserver/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ impl Value {
mod test {
use super::*;

use bytes::Bytes;
use utils::bin_ser::BeSer;

macro_rules! roundtrip {
Expand Down
Loading

1 comment on commit 82853cc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2549 tests run: 2414 passed, 0 failed, 135 skipped (full report)


Flaky tests (1)

Postgres 14

  • test_ts_of_lsn_api: debug

Code coverage* (full report)

  • functions: 28.8% (6932 of 24085 functions)
  • lines: 47.4% (42560 of 89855 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
82853cc at 2024-03-01T17:08:25.081Z :recycle:

Please sign in to comment.