Skip to content

Commit f8166e2

Browse files
committed
update dependencies and fix CI
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 70c3202 commit f8166e2

File tree

4 files changed

+27
-31
lines changed

4 files changed

+27
-31
lines changed

Cargo.toml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
async-channel = "2.3.1"
10-
core_affinity = "0.7.0"
11-
derivative = "2.0.0"
12-
libc = "0.2.0"
13-
rand = "0.8.0"
14-
scc = "2.0.0"
9+
async-channel = "2.5.0"
10+
core_affinity = "0.8.3"
11+
derivative = "2.2.0"
12+
libc = "0.2.176"
13+
rand = "0.9.2"
14+
rand_distr = "0.5.1"
15+
scc = "3.1.1"
1516
tokio-uring = "0.5.0"
16-
tracing = "0.1.0"
17-
zipf = "7.0.0"
17+
tracing = "0.1.41"
18+
tokio = { version = "1.47.1", features = ["macros", "rt", "sync", "time"] }
1819

19-
# Pin version "1.27" for a missing method.
20-
tokio = { version = "1.27.0", features = ["macros", "rt", "sync", "time"] }
21-
22-
# Pin more recent versions for `-Zminimal-versions`.
23-
bitflags = "1.1.0" # For tokio-uring -> io-uring -> bitflags.
24-
proc-macro2 = "1.0.60" # For a missing feature.
25-
slab = "0.4.4" # For a missing method.
20+
# Pin downgraded version for minimal-versions
21+
bitflags = "1.3.2" # (Downgrade) For tokio-uring -> io-uring -> bitflags.
2622

2723
[dev-dependencies]
28-
tokio = { version = "1.27.0", features = ["full"] }
29-
tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
24+
tokio = { version = "1.47.1", features = ["full"] }
25+
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
3026

3127
[profile.dev]
3228
panic = "abort"

src/bpm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl BufferPoolManager {
149149
// Get the page if it exists, otherwise create a new one return that.
150150
let page = self
151151
.pages
152-
.entry(*pid)
152+
.entry_sync(*pid)
153153
.or_insert_with(|| {
154154
trace!("Creating a new `Page`.");
155155

@@ -174,8 +174,8 @@ impl BufferPoolManager {
174174
///
175175
/// Intended for use by an eviction algorithm.
176176
pub(crate) fn get_random_frame_group(&self) -> Arc<FrameGroup> {
177-
let mut rng = rand::thread_rng();
178-
let index = rng.gen_range(0..self.frame_groups.len());
177+
let mut rng = rand::rng();
178+
let index = rng.random_range(0..self.frame_groups.len());
179179

180180
self.get_frame_group(index)
181181
}

src/page/page_handle.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl PageHandle {
4444
///
4545
/// Raises an error if an I/O error occurs while trying to load the data from disk into memory.
4646
#[instrument(skip(self), err, fields(page = ?self.page.pid))]
47-
pub async fn read(&self) -> Result<ReadPageGuard> {
47+
pub async fn read(&self) -> Result<ReadPageGuard<'_>> {
4848
info!("Reading `PageHandle`.");
4949

5050
// Optimization: attempt to read only if we observe that the `is_loaded` flag is set.
@@ -84,7 +84,7 @@ impl PageHandle {
8484
///
8585
/// Raises an error if an I/O error occurs while trying to load the data from disk into memory.
8686
#[instrument(skip(self), err, fields(page = ?self.page.pid))]
87-
pub async fn try_read(&self) -> Result<Option<ReadPageGuard>> {
87+
pub async fn try_read(&self) -> Result<Option<ReadPageGuard<'_>>> {
8888
info!("Trying to read `PageHandle`.");
8989

9090
// Optimization: attempt to read only if we observe that the `is_loaded` flag is set.
@@ -127,7 +127,7 @@ impl PageHandle {
127127
///
128128
/// Raises an error if an I/O error occurs while trying to load the data from disk into memory.
129129
#[instrument(skip(self), err, fields(page = ?self.page.pid))]
130-
pub async fn write(&self) -> Result<WritePageGuard> {
130+
pub async fn write(&self) -> Result<WritePageGuard<'_>> {
131131
info!("Writing `PageHandle`.");
132132

133133
let mut write_guard = self.page.frame.write().await;
@@ -157,7 +157,7 @@ impl PageHandle {
157157
///
158158
/// Raises an error if an I/O error occurs while trying to load the data from disk into memory.
159159
#[instrument(skip(self), err, fields(page = ?self.page.pid))]
160-
pub async fn try_write(&self) -> Result<Option<WritePageGuard>> {
160+
pub async fn try_write(&self) -> Result<Option<WritePageGuard<'_>>> {
161161
info!("Trying to write `PageHandle`.");
162162

163163
let Ok(mut write_guard) = self.page.frame.try_write() else {

tests/throughput.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use async_bpm::{
33
BufferPoolManager, IO_OPERATIONS,
44
};
55
use core_affinity::CoreId;
6-
use rand::thread_rng;
7-
use rand::{distributions::Distribution, Rng};
6+
use rand::rng;
7+
use rand::{distr::Distribution, Rng};
8+
use rand_distr::Zipf;
89
use std::{
910
ops::{Deref, DerefMut},
1011
sync::{
@@ -18,7 +19,6 @@ use tokio::{
1819
task::{JoinHandle, JoinSet},
1920
};
2021
use tracing::info;
21-
use zipf::ZipfDistribution;
2222

2323
const SECONDS: usize = 300;
2424

@@ -178,8 +178,8 @@ fn spawn_find_task(barrier: Arc<Barrier>) -> JoinHandle<()> {
178178
let bpm = BufferPoolManager::get();
179179

180180
// Since half of the threads are solely reading, we double the writers here.
181-
let zipf = ZipfDistribution::new(STORAGE_PAGES, ZIPF_EXP).unwrap();
182-
let mut rng = rand::thread_rng();
181+
let zipf = Zipf::new(STORAGE_PAGES as f64, ZIPF_EXP).unwrap();
182+
let mut rng = rand::rng();
183183

184184
BufferPoolManager::spawn_local(async move {
185185
let mut handles = Vec::with_capacity(TASK_ACCESSES);
@@ -211,8 +211,8 @@ fn spawn_scan_task(barrier: Arc<Barrier>) -> JoinHandle<()> {
211211
BufferPoolManager::spawn_local(async move {
212212
barrier.wait().await;
213213

214-
let mut rng = thread_rng();
215-
let start = rng.gen_range(0..STORAGE_PAGES);
214+
let mut rng = rng();
215+
let start = rng.random_range(0..STORAGE_PAGES);
216216

217217
// Continuously scan all pages.
218218
loop {

0 commit comments

Comments
 (0)