diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d76bcca..8dc619f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,34 +23,38 @@ jobs: uses: taiki-e/install-action@v2 with: tool: just - - name: Tests (Async) - run: just async-tests + - name: "Test: Async" + run: just async-test timeout-minutes: 10 - - name: Tests (Async I/O) - run: just async-io-tests - - name: Tests (Sync) - run: just sync-tests + - name: "Test: Async I/O" + run: just async-io-test + - name: "Tests: Sync" + run: just sync-test timeout-minutes: 10 - - name: Tests (No compression) - run: just no-compression-tests + - name: "Tests: No compression" + run: just no-compression-test timeout-minutes: 10 -# - name: Tests (Wisckey) -# run: just wisckey-tests -# timeout-minutes: 10 -# - name: Tests (Wisckey + sync) -# run: just wisckey-sync-tests -# timeout-minutes: 10 - - name: Linting (Async) + - name: "Tests: Wisckey" + run: just wisckey-test + - name: "Tests: Wisckey with no compression" + run: just wisckey-no-compression-test + timeout-minutes: 10 + - name: "Tests: Sync Wisckey" + run: just wisckey-sync-test + timeout-minutes: 10 + - name: "Lint Checks: Async" run: just async-lint - - name: Linting (Async I/O) + - name: "Lint Checks: Async I/O" run: just async-io-lint - - name: Linting (Sync) + - name: "Lint Checks: Sync" run: just sync-lint - - name: Linting (WiscKey) + - name: "Lint Checks: Wisckey" + run: just wisckey-lint + - name: "Lint Checks: Wisckey with no comrpession" run: just wisckey-lint - - name: Linting (Async I/O + WiscKey) + - name: "Lint Checks: Wisckey and Async I/O" run: just async-io-wisckey-lint - - name: Formatting Checks + - name: "Formatting Checks" run: just check-formatting # Does not work well as some dependencies only used by certain features #- name: Check for unused dependencies diff --git a/Cargo.lock b/Cargo.lock index 7c2fbee..c7e4547 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] @@ -112,9 +112,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -177,9 +177,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" [[package]] name = "cfg-if" @@ -189,9 +189,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -199,9 +199,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -211,9 +211,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck", "proc-macro2", @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" @@ -578,9 +578,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "6d0d8b92cd8358e8d229c11df9358decae64d137c5be540952c5ca7b25aea768" [[package]] name = "miniz_oxide" @@ -624,9 +624,9 @@ dependencies = [ [[package]] name = "object" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -743,14 +743,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -764,13 +764,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -781,9 +781,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rustc-demangle" @@ -1118,9 +1118,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" @@ -1238,9 +1238,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" dependencies = [ "windows-targets 0.52.5", ] diff --git a/justfile b/justfile index 0deac99..209e39e 100644 --- a/justfile +++ b/justfile @@ -2,27 +2,30 @@ LOG_LEVEL := "debug" all: test lint -test: sync-tests async-tests no-compression-tests async-io-tests #FIXME wisckey-tests wisckey-sync-tests +test: sync-test async-test no-compression-test async-io-test wisckey-test wisckey-no-compression-test wisckey-sync-test -sync-tests: +sync-test: env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=sync,bloom-filters -async-tests: - env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async +async-test: + env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async,snappy-compression -async-io-tests: +async-io-test: env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async,async-io,bloom-filters -- --test-threads=1 -no-compression-tests: +no-compression-test: env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async -wisckey-tests: +wisckey-test: env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async,snappy-compression,wisckey -wisckey-sync-tests: +wisckey-no-compression-test: + env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=async,wisckey + +wisckey-sync-test: env RUST_BACKTRACE=1 RUST_LOG={{LOG_LEVEL}} cargo test --no-default-features --features=snappy-compression,sync,wisckey -lint: sync-lint async-lint wisckey-lint async-io-lint async-io-wisckey-lint +lint: sync-lint async-lint wisckey-lint wisckey-no-compression-lint async-io-lint async-io-wisckey-lint fix-formatting: cargo fmt @@ -51,5 +54,8 @@ async-io-lint: wisckey-lint: cargo clippy --no-default-features --features=snappy-compression,wisckey -- -D warnings +wisckey-no-compression-lint: + cargo clippy --no-default-features --features=async,wisckey + async-io-wisckey-lint: cargo clippy --no-default-features --features=async-io,async,snappy-compression,wisckey -- -D warnings diff --git a/src/data_blocks/block.rs b/src/data_blocks/block.rs index 7ca1686..46e8c34 100644 --- a/src/data_blocks/block.rs +++ b/src/data_blocks/block.rs @@ -1,5 +1,4 @@ use std::cmp::Ordering; -use std::convert::TryInto; use std::sync::Arc; use cfg_if::cfg_if; diff --git a/src/data_blocks/mod.rs b/src/data_blocks/mod.rs index 323f17a..73162a6 100644 --- a/src/data_blocks/mod.rs +++ b/src/data_blocks/mod.rs @@ -1,4 +1,3 @@ -use std::convert::TryInto; use std::mem::size_of; use std::num::NonZeroUsize; use std::path::Path; diff --git a/src/disk.rs b/src/disk.rs index dcfbd7d..cab5b19 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -62,14 +62,16 @@ pub async fn write(fpath: &Path, data: &[u8], offset: u64) -> Result<(), std::io cfg_if! { if #[ cfg(feature="async-io") ] { - let file = fs::OpenOptions::new().create(true).write(true) + let file = fs::OpenOptions::new().create(true) + .truncate(false).write(true) .open(fpath).await?; let (res, _buf) = file.write_all_at(compressed, offset).await; res?; file.sync_all().await?; } else { - let mut file = fs::OpenOptions::new().create(true).truncate(true).write(true) + let mut file = fs::OpenOptions::new().create(true) + .truncate(false).write(true) .open(fpath)?; if offset > 0 { diff --git a/src/sorted_table/tests.rs b/src/sorted_table/tests.rs index 9dfd875..62e31e5 100644 --- a/src/sorted_table/tests.rs +++ b/src/sorted_table/tests.rs @@ -1,7 +1,6 @@ use super::*; use crate::manifest::Manifest; -use crate::Params; use tempfile::tempdir; diff --git a/src/values.rs b/src/values.rs index 4ba3965..eef21af 100644 --- a/src/values.rs +++ b/src/values.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::convert::TryInto; use std::mem::size_of; use std::num::NonZeroUsize; use std::path::Path; @@ -252,6 +251,7 @@ impl ValueLog { // we might need to delete more than one batch let mut batch_id = batch_id; + // FIXME make sure there aren't any race conditions here let most_recent = self.manifest.most_recent_value_batch_id().await; while batch_id <= most_recent { diff --git a/src/wal/mod.rs b/src/wal/mod.rs index b562e80..7acc52e 100644 --- a/src/wal/mod.rs +++ b/src/wal/mod.rs @@ -15,8 +15,6 @@ use tokio_uring_executor as executor; #[cfg(feature = "async-io")] use tokio_uring::fs::{File, OpenOptions}; -use std::convert::TryInto; - #[cfg(not(feature = "async-io"))] use std::fs::{File, OpenOptions}; diff --git a/src/wal/tests.rs b/src/wal/tests.rs index 0c50326..bbdea4c 100644 --- a/src/wal/tests.rs +++ b/src/wal/tests.rs @@ -1,7 +1,6 @@ use tempfile::tempdir; use super::*; -use crate::memtable::Memtable; #[cfg(feature = "async-io")] use tokio_uring_executor::test as async_test;