From a8583b0c6a1a962c817c8c89af5a027340b9b8d8 Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Thu, 15 Aug 2024 16:47:46 +0200 Subject: [PATCH 1/3] Fix Clippy & bump dependencies --- Cargo.toml | 18 +++++++++--------- src/lib.rs | 8 ++++---- src/mmap_view_sync.rs | 1 + 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 907b7a4..2a68202 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,13 @@ repository = "https://github.com/qdrant/wal" edition = "2021" [dependencies] -byteorder = "1.4" -crc32c = "0.6.4" +byteorder = "1.5" +crc32c = "0.6.8" log = "0.4" -memmap2 = "0.9.0" +memmap2 = "0.9.4" rand = "0.8.5" rand_distr = "0.4.3" -fs4 = "0.8" +fs4 = "0.9.1" # fs4 depends on rustix, but pulling this dependency explicitly into the tree # to use direct functions on FreeBSD rustix = { version = "0", features = [ "fs" ]} @@ -31,12 +31,12 @@ env_logger = "0.11" serde = { version = "1", features = ["derive"] } [dev-dependencies] -crc = "3" -hdrhistogram = "7.5.2" +crc = "3.2.1" +hdrhistogram = "7.5.4" quickcheck = "1.0.3" -regex = "1.8.1" -tempfile = "3.5.0" -chrono = "0.4.31" +regex = "1.10.6" +tempfile = "3.12.0" +chrono = "0.4.38" criterion = "0.5.1" [[bench]] diff --git a/src/lib.rs b/src/lib.rs index 85fc7e6..ba5ecc6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ use crossbeam_channel::{Receiver, Sender}; -use fs4::FileExt; +use fs4::fs_std::FileExt; use log::{debug, info, trace, warn}; +pub use segment::{Entry, Segment}; use std::cmp::Ordering; use std::collections::HashMap; use std::fmt; @@ -13,8 +14,6 @@ use std::result; use std::str::FromStr; use std::thread; -pub use segment::{Entry, Segment}; - mod mmap_view_sync; mod segment; pub mod test_utils; @@ -514,7 +513,7 @@ impl Wal { segment.copy_to_path(&dst_path)?; } else { // if file is not locked by any Segment, just copy it - fs::copy(&entry.path(), &dst_path)?; + fs::copy(entry.path(), &dst_path)?; } } Ok(()) @@ -955,6 +954,7 @@ mod test { .read(true) .write(true) .create(true) + .truncate(true) .open(dir.path().join("tmp-open-123")) .unwrap(); diff --git a/src/mmap_view_sync.rs b/src/mmap_view_sync.rs index b73bbd4..758522a 100644 --- a/src/mmap_view_sync.rs +++ b/src/mmap_view_sync.rs @@ -237,6 +237,7 @@ mod test { .read(true) .write(true) .create(true) + .truncate(true) .open(path) .unwrap(); file.set_len(len).unwrap(); From 4f5dad565bd1b03b059d9f3f72ce8a7e67154cee Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Thu, 15 Aug 2024 16:58:19 +0200 Subject: [PATCH 2/3] fix windows build --- src/segment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segment.rs b/src/segment.rs index 628c1dd..707cb72 100644 --- a/src/segment.rs +++ b/src/segment.rs @@ -14,7 +14,7 @@ use std::time::Duration; use crate::mmap_view_sync::MmapViewSync; use byteorder::{ByteOrder, LittleEndian}; #[cfg(not(unix))] -use fs4::FileExt; +use fs4::fs_std::FileExt; /// The magic bytes and version tag of the segment header. const SEGMENT_MAGIC: &[u8; 3] = b"wal"; From a88aee958353e631b2d8d6e1f171032d08340cba Mon Sep 17 00:00:00 2001 From: Arnaud Gourlay Date: Thu, 15 Aug 2024 17:18:01 +0200 Subject: [PATCH 3/3] clippy windows --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index ba5ecc6..35b59fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,6 +136,7 @@ impl Wal { .create(true) .read(true) .write(true) + .truncate(true) .open(&path)?; path.pop(); dir