Skip to content

Commit

Permalink
Fix wisckey feature (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai Mast authored Jun 13, 2024
1 parent 58bd740 commit 5d2603d
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 69 deletions.
44 changes: 24 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 31 additions & 31 deletions Cargo.lock

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

24 changes: 15 additions & 9 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion src/data_blocks/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp::Ordering;
use std::convert::TryInto;
use std::sync::Arc;

use cfg_if::cfg_if;
Expand Down
1 change: 0 additions & 1 deletion src/data_blocks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryInto;
use std::mem::size_of;
use std::num::NonZeroUsize;
use std::path::Path;
Expand Down
6 changes: 4 additions & 2 deletions src/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/sorted_table/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::*;

use crate::manifest::Manifest;
use crate::Params;

use tempfile::tempdir;

Expand Down
2 changes: 1 addition & 1 deletion src/values.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions src/wal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
1 change: 0 additions & 1 deletion src/wal/tests.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 5d2603d

Please sign in to comment.