Skip to content

Commit

Permalink
refactor: bump rust toolchain to 1.81.0 (#687)
Browse files Browse the repository at this point in the history
* refactor: replace allow with expect and warn allow usage

Signed-off-by: MrCroxx <[email protected]>

* refactor: upgrade msrv to 1.81.0, remove trace feature for foyer-bench

Signed-off-by: MrCroxx <[email protected]>

* fix: fix build

Signed-off-by: MrCroxx <[email protected]>

* fix: fix check on non-linux

Signed-off-by: MrCroxx <[email protected]>

---------

Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx authored Sep 6, 2024
1 parent de50258 commit fec88f0
Show file tree
Hide file tree
Showing 35 changed files with 99 additions and 147 deletions.
4 changes: 2 additions & 2 deletions .github/template/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name:
on:

env:
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-07-19
CARGO_TERM_COLOR: always
CACHE_KEY_SUFFIX: 20240821

Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust_toolchain: [stable, 1.77]
rust_toolchain: [stable, 1.81.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
branches: [main]
workflow_dispatch:
env:
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-07-19
CARGO_TERM_COLOR: always
CACHE_KEY_SUFFIX: 20240821
jobs:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust_toolchain: [stable, 1.77]
rust_toolchain: [stable, 1.81.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
pull_request:
branches: [main]
env:
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-07-19
CARGO_TERM_COLOR: always
CACHE_KEY_SUFFIX: 20240821
jobs:
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust_toolchain: [stable, 1.77]
rust_toolchain: [stable, 1.81.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ check-all:
cargo fmt --all
cargo clippy --all-targets --features deadlock
cargo clippy --all-targets --features tokio-console
cargo clippy --all-targets --features trace
cargo clippy --all-targets --features sanity
cargo clippy --all-targets --features mtrace
cargo clippy --all-targets
Expand Down Expand Up @@ -56,18 +55,17 @@ msrv:
shellcheck ./scripts/*
./.github/template/generate.sh
./scripts/minimize-dashboards.sh
cargo +1.77 sort -w
cargo +1.77 fmt --all
cargo +1.77 clippy --all-targets --features deadlock
cargo +1.77 clippy --all-targets --features tokio-console
cargo +1.77 clippy --all-targets --features trace
cargo +1.77 clippy --all-targets
RUST_BACKTRACE=1 cargo +1.77 nextest run --all
RUST_BACKTRACE=1 cargo +1.77 test --doc
RUST_BACKTRACE=1 cargo +1.77 nextest run --run-ignored ignored-only --no-capture --workspace
cargo +1.81.0 sort -w
cargo +1.81.0 fmt --all
cargo +1.81.0 clippy --all-targets --features deadlock
cargo +1.81.0 clippy --all-targets --features tokio-console
cargo +1.81.0 clippy --all-targets
RUST_BACKTRACE=1 cargo +1.81.0 nextest run --all
RUST_BACKTRACE=1 cargo +1.81.0 test --doc
RUST_BACKTRACE=1 cargo +1.81.0 nextest run --run-ignored ignored-only --no-capture --workspace

udeps:
RUSTFLAGS="--cfg tokio_unstable -Awarnings" cargo +nightly-2024-03-17 udeps --all-targets
RUSTFLAGS="--cfg tokio_unstable -Awarnings" cargo +nightly-2024-07-19 udeps --all-targets

monitor:
./scripts/monitor.sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ More examples and details can be found [here](https://github.com/foyer-rs/foyer/

## Supported Rust Versions

*foyer* is built against the recent stable release. The minimum supported version is 1.77. The current *foyer* version is not guaranteed to build on Rust versions earlier than the minimum supported version.
*foyer* is built against the recent stable release. The minimum supported version is 1.81.0. The current *foyer* version is not guaranteed to build on Rust versions earlier than the minimum supported version.

## Development State & Roadmap

Expand Down
14 changes: 0 additions & 14 deletions foyer-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ hdrhistogram = "7"
itertools = { workspace = true }
metrics = { workspace = true }
metrics-exporter-prometheus = "0.15"
opentelemetry = { version = "0.24", optional = true }
opentelemetry-otlp = { version = "0.17", optional = true }
opentelemetry-semantic-conventions = { version = "0.16", optional = true }
opentelemetry_sdk = { version = "0.24", features = [
"rt-tokio",
"trace",
], optional = true }
parking_lot = "0.12"
rand = "0.8.5"
serde = { workspace = true }
Expand All @@ -46,13 +39,6 @@ tikv-jemallocator = { version = "0.6", optional = true }
[features]
deadlock = ["parking_lot/deadlock_detection", "foyer/deadlock"]
tokio-console = ["console-subscriber"]
trace = [
"opentelemetry",
"opentelemetry_sdk",
"opentelemetry-otlp",
"tracing-opentelemetry",
"opentelemetry-semantic-conventions",
]
strict_assertions = ["foyer/strict_assertions"]
sanity = ["foyer/sanity"]
jemalloc = ["tikv-jemallocator"]
Expand Down
44 changes: 3 additions & 41 deletions foyer-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![warn(clippy::allow_attributes)]

mod analyze;
mod rate;
mod text;
Expand Down Expand Up @@ -337,54 +339,14 @@ fn setup() {
console_subscriber::init();
}

#[cfg(feature = "trace")]
fn setup() {
use opentelemetry_sdk::{
trace::{BatchConfigBuilder, Config},
Resource,
};
use opentelemetry_semantic_conventions::resource::SERVICE_NAME;
use tracing::Level;
use tracing_subscriber::{filter::Targets, prelude::*};

let tracing_config = Config::default().with_resource(Resource::new(vec![opentelemetry::KeyValue::new(
SERVICE_NAME,
"foyer-bench",
)]));
let batch_config = BatchConfigBuilder::default()
.with_max_queue_size(1048576)
.with_max_export_batch_size(4096)
.with_max_concurrent_exports(4)
.build();

let tracer = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.with_tracing_config(tracing_config)
.with_batch_config(batch_config)
.install_batch(opentelemetry_sdk::runtime::Tokio)
.unwrap();
let opentelemetry_layer = tracing_opentelemetry::layer().with_tracer(tracer);
tracing_subscriber::registry()
.with(
Targets::new()
.with_target("foyer_storage", Level::DEBUG)
.with_target("foyer_common", Level::DEBUG)
.with_target("foyer_intrusive", Level::DEBUG)
.with_target("foyer_storage_bench", Level::DEBUG),
)
.with(opentelemetry_layer)
.init();
}

#[cfg(feature = "mtrace")]
fn setup() {
use fastrace::collector::Config;
let reporter = fastrace_jaeger::JaegerReporter::new("127.0.0.1:6831".parse().unwrap(), "foyer-bench").unwrap();
fastrace::set_reporter(reporter, Config::default().report_interval(Duration::from_millis(1)));
}

#[cfg(not(any(feature = "tokio-console", feature = "trace", feature = "mtrace")))]
#[cfg(not(any(feature = "tokio-console", feature = "mtrace")))]
fn setup() {
use tracing_subscriber::{prelude::*, EnvFilter};

Expand Down
2 changes: 0 additions & 2 deletions foyer-common/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ pub trait Value: Send + Sync + 'static {}
impl<T: Send + Sync + 'static + std::hash::Hash + Eq> Key for T {}
impl<T: Send + Sync + 'static> Value for T {}

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
/// Key trait for the disk cache.
pub trait StorageKey: Key + Serialize + DeserializeOwned {}
impl<T> StorageKey for T where T: Key + Serialize + DeserializeOwned {}

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
/// Value trait for the disk cache.
pub trait StorageValue: Value + 'static + Serialize + DeserializeOwned {}
impl<T> StorageValue for T where T: Value + Serialize + DeserializeOwned {}
Expand Down
3 changes: 1 addition & 2 deletions foyer-common/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ pub trait EventListener: Send + Sync + 'static {
/// Associated value type.
type Value;

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
#[allow(unused_variables)]
/// Called when a cache entry is released from the in-memory cache.
#[expect(unused_variables)]
fn on_memory_release(&self, key: Self::Key, value: Self::Value)
where
Self::Key: Key,
Expand Down
1 change: 1 addition & 0 deletions foyer-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#![warn(missing_docs)]
#![warn(clippy::allow_attributes)]

//! Shared components and utils for foyer.
Expand Down
50 changes: 48 additions & 2 deletions foyer-common/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,115 @@ use std::fmt::Debug;

use metrics::{counter, gauge, histogram, Counter, Gauge, Histogram};

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
#[allow(missing_docs)]
// FIXME: https://github.com/rust-lang/rust-analyzer/issues/17685
// #[expect(missing_docs)]
/// ... ...
#[derive(Clone)]
pub struct Metrics {
/* in-memory cache metrics */
/// ... ...
pub memory_insert: Counter,
/// ... ...
pub memory_replace: Counter,
/// ... ...
pub memory_hit: Counter,
/// ... ...
pub memory_miss: Counter,
/// ... ...
pub memory_remove: Counter,
/// ... ...
pub memory_evict: Counter,
/// ... ...
pub memory_reinsert: Counter,
/// ... ...
pub memory_release: Counter,
/// ... ...
pub memory_queue: Counter,
/// ... ...
pub memory_fetch: Counter,

/// ... ...
pub memory_usage: Gauge,

/* disk cache metrics */
/// ... ...
pub storage_enqueue: Counter,
/// ... ...
pub storage_hit: Counter,
/// ... ...
pub storage_miss: Counter,
/// ... ...
pub storage_delete: Counter,

/// ... ...
pub storage_enqueue_duration: Histogram,
/// ... ...
pub storage_hit_duration: Histogram,
/// ... ...
pub storage_miss_duration: Histogram,
/// ... ...
pub storage_delete_duration: Histogram,

/// ... ...
pub storage_queue_rotate: Counter,
/// ... ...
pub storage_queue_rotate_duration: Histogram,
/// ... ...
pub storage_queue_drop: Counter,

/// ... ...
pub storage_disk_write: Counter,
/// ... ...
pub storage_disk_read: Counter,
/// ... ...
pub storage_disk_flush: Counter,

/// ... ...
pub storage_disk_write_bytes: Counter,
/// ... ...
pub storage_disk_read_bytes: Counter,

/// ... ...
pub storage_disk_write_duration: Histogram,
/// ... ...
pub storage_disk_read_duration: Histogram,
/// ... ...
pub storage_disk_flush_duration: Histogram,

/// ... ...
pub storage_region_total: Gauge,
/// ... ...
pub storage_region_clean: Gauge,
/// ... ...
pub storage_region_evictable: Gauge,

/// ... ...
pub storage_region_size_bytes: Gauge,

/// ... ...
pub storage_entry_serialize_duration: Histogram,
/// ... ...
pub storage_entry_deserialize_duration: Histogram,

/* hybrid cache metrics */
/// ... ...
pub hybrid_insert: Counter,
/// ... ...
pub hybrid_hit: Counter,
/// ... ...
pub hybrid_miss: Counter,
/// ... ...
pub hybrid_remove: Counter,

/// ... ...
pub hybrid_insert_duration: Histogram,
/// ... ...
pub hybrid_hit_duration: Histogram,
/// ... ...
pub hybrid_miss_duration: Histogram,
/// ... ...
pub hybrid_remove_duration: Histogram,
/// ... ...
pub hybrid_fetch_duration: Histogram,
}

Expand Down
4 changes: 2 additions & 2 deletions foyer-intrusive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
#![allow(clippy::new_without_default)]
#![expect(clippy::new_without_default)]
#![warn(missing_docs)]
#![warn(clippy::allow_attributes)]

//! Intrusive data structures and utils for foyer.
Expand Down
5 changes: 1 addition & 4 deletions foyer-memory/src/eviction/s3fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ where
self.evict_small_force()
}

// TODO(MrCroxx): FIX ME!!! clippy false positive
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
unsafe fn evict_small_force(&mut self) -> Option<NonNull<S3FifoHandle<T>>> {
while let Some(mut ptr) = self.small_queue.pop_front() {
let handle = ptr.as_mut();
Expand Down Expand Up @@ -267,8 +266,6 @@ where
handle.base_mut().set_in_eviction(true);
}

// TODO: FIX ME! clippy false positive
// #[allow(clippy::never_loop)]
unsafe fn pop(&mut self) -> Option<NonNull<Self::Handle>> {
if let Some(mut ptr) = self.evict() {
let handle = ptr.as_mut();
Expand Down
2 changes: 0 additions & 2 deletions foyer-memory/src/eviction/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use super::Eviction;
use crate::handle::Handle;

// TODO(MrCroxx): use `expect` after `lint_reasons` is stable.
#[allow(clippy::type_complexity)]
pub trait TestEviction: Eviction
where
Self::Handle: Handle,
Expand Down
Loading

0 comments on commit fec88f0

Please sign in to comment.