Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic #30

Open
wants to merge 80 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
f15a6b7
WIP
al8n Nov 4, 2024
8d5847f
WIP
al8n Nov 25, 2024
c03be26
WIP
al8n Nov 26, 2024
231c83d
WIP
al8n Nov 26, 2024
384cc4f
WIP
al8n Nov 27, 2024
949ee26
WIP
al8n Nov 27, 2024
4ec744d
WIP
al8n Nov 28, 2024
b6c509b
WIP
al8n Dec 4, 2024
c157f4e
WIP
al8n Dec 4, 2024
d15d27b
WIP
al8n Dec 5, 2024
ca7d4ec
WIP
al8n Dec 5, 2024
1c6f8a1
Finish memtable
al8n Dec 6, 2024
75aefeb
WIP
al8n Dec 6, 2024
b629172
WIP
al8n Dec 7, 2024
be6826e
WIP
al8n Dec 7, 2024
3772d3a
WIP
al8n Dec 8, 2024
30f2e38
WIP
al8n Dec 9, 2024
8ea5b40
WIP
al8n Dec 9, 2024
4e272a3
WIP
al8n Dec 9, 2024
8fe65eb
WIP
al8n Dec 10, 2024
c5a32f2
WIP
al8n Dec 10, 2024
fd639c9
WIP
al8n Dec 10, 2024
5ccbaa6
WIP
al8n Dec 11, 2024
3035d63
WIP
al8n Dec 11, 2024
357c05d
WIP
al8n Dec 11, 2024
ce4555a
WIP
al8n Dec 12, 2024
b6ba829
WIP
al8n Dec 12, 2024
19ae6df
WIP
al8n Dec 12, 2024
333e4b9
WIP
al8n Dec 12, 2024
378dcb8
Solve insert and get
al8n Dec 13, 2024
2004772
WIP
al8n Dec 15, 2024
9b9143f
WIP
al8n Dec 17, 2024
bf377e6
WIP
al8n Dec 17, 2024
64c8132
WIP
al8n Dec 18, 2024
fb0ea91
WIP
al8n Dec 18, 2024
d2e6f7c
WIP
al8n Dec 18, 2024
4895f7e
WIP
al8n Dec 19, 2024
ab519bc
WIP
al8n Dec 19, 2024
78f037c
WIP
al8n Dec 20, 2024
15a5f05
Fix batch apply
al8n Dec 20, 2024
6eea91a
Update bounded.rs
al8n Dec 21, 2024
1dfb915
Cleanup
al8n Dec 21, 2024
f9e9a6a
WIP
al8n Dec 21, 2024
4db6320
WIP
al8n Dec 21, 2024
5bbf457
WIP
al8n Dec 24, 2024
8904356
WIP: transfer
al8n Dec 25, 2024
366db13
WIP
al8n Dec 26, 2024
f7823df
Finish unbounded memtable
al8n Dec 26, 2024
939a8b5
Finish unbounded memtable
al8n Dec 26, 2024
f4d2e3e
Cleanup
al8n Dec 26, 2024
aa5c5c9
Update Cargo.toml
al8n Dec 26, 2024
b0b2804
Update README.md
al8n Dec 26, 2024
705d13a
Update CHANGELOG.md
al8n Dec 26, 2024
91fe30a
WIP
al8n Dec 27, 2024
6143948
WIP
al8n Dec 27, 2024
509964a
Update types.rs
al8n Dec 27, 2024
606d6c0
WIP
al8n Dec 28, 2024
9fbba7a
WIP
al8n Dec 28, 2024
551c805
WIP
al8n Dec 28, 2024
7238dd6
Finish old test cases
al8n Dec 28, 2024
e14e30c
Fix
al8n Dec 28, 2024
570d99c
Fix feature gate
al8n Dec 28, 2024
1a5224b
Fix CI
al8n Dec 28, 2024
06c1542
Fix CI
al8n Dec 28, 2024
10de32c
Fix CI
al8n Dec 28, 2024
08f81cf
Update lib.rs
al8n Dec 28, 2024
52cb970
cleanup
al8n Dec 28, 2024
ef2998d
Fix CI
al8n Dec 28, 2024
59e1281
Fix fmt
al8n Dec 28, 2024
e2145d0
Update ci.yml
al8n Dec 28, 2024
5b0fd54
Fix CI
al8n Dec 28, 2024
2450294
Fix cI
al8n Dec 28, 2024
dc2c58f
Fix ci
al8n Dec 28, 2024
4311978
Fix CI
al8n Dec 28, 2024
aef6b3f
Fix CI
al8n Dec 28, 2024
e65ad34
Fix CI
al8n Dec 28, 2024
100130c
Update ci.yml
al8n Dec 28, 2024
f802b3f
WIP
al8n Dec 28, 2024
4c52dd7
Update miri_tb_unbounded.sh
al8n Dec 28, 2024
30f3eeb
Update ci.yml
al8n Dec 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 36 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:
- 'LICENSE-*'
- '**.md'
- '**.txt'
workflow_dispatch:
schedule: [cron: "0 1 */7 * *"]

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -85,6 +87,8 @@ jobs:
- wasm32-unknown-unknown
- wasm32-unknown-emscripten
- wasm32-wasip1
- wasm32-wasip1-threads
- wasm32-wasip2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -103,13 +107,7 @@ jobs:
- name: cargo build --target ${{ matrix.target }}
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }}
if: matrix.target != 'wasm32-unknown-unknown' && matrix.target != 'wasm32-unknown-emscripten' && matrix.target != 'wasm32-wasip1'
- name: cargo build --target ${{ matrix.target }}
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }} --no-default-features --features alloc
if: matrix.target == 'wasm32-unknown-unknown' || matrix.target == 'wasm32-unknown-emscripten' || matrix.target == 'wasm32-wasip1'
cargo build --target ${{ matrix.target }} --no-default-features --features bounded,unbounded,std

build:
name: build
Expand Down Expand Up @@ -176,13 +174,13 @@ jobs:
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Run test (Unix)
run: RUSTFLAGS="--cfg all_orderwal_tests" cargo test --no-default-features --features alloc
run: RUSTFLAGS="--cfg all_orderwal_tests" cargo test --no-default-features --features bounded --lib
if: matrix.os != 'windows-latest'
- name: Run test (Windows)
shell: pwsh
run: |
$env:RUSTFLAGS="--cfg all_orderwal_tests"
cargo test --no-default-features --features alloc
cargo test --no-default-features --features bounded --lib
if: matrix.os == 'windows-latest'

test:
Expand Down Expand Up @@ -258,8 +256,8 @@ jobs:
run: ci/sanitizer_generic.sh
if: matrix.os != 'ubuntu-latest'

miri-tb:
name: miri-tb-${{ matrix.target }}-${{ matrix.cfg }}
miri-tb-bounded:
name: miri-tb-bounded-${{ matrix.target }}-${{ matrix.cfg }}
strategy:
matrix:
os:
Expand All @@ -272,14 +270,14 @@ jobs:
- x86_64-apple-darwin
- aarch64-apple-darwin
cfg:
- swmr_insert
- swmr_iters
- swmr_get
- swmr_constructor
- swmr_multiple_version_insert
- swmr_multiple_version_iters
- swmr_multiple_version_get
- swmr_multiple_version_constructor
- generic_insert
- generic_iters
- generic_get
- generic_constructor
- dynamic_insert
- dynamic_iters
- dynamic_get
- dynamic_constructor
# Exclude invalid combinations
exclude:
- os: ubuntu-latest
Expand Down Expand Up @@ -309,46 +307,42 @@ jobs:
run: cargo install cargo-hack
- name: Miri
run: |
bash ci/miri_tb.sh ${{ matrix.target }} ${{ matrix.cfg }}
bash ci/miri_tb_bounded.sh ${{ matrix.target }} ${{ matrix.cfg }}

# miri-sb:
# name: miri-sb-${{ matrix.target }}-${{ matrix.cfg }}
# miri-tb-unbounded:
# name: miri-tb-unbounded-${{ matrix.target }}-${{ matrix.cfg }}
# strategy:
# matrix:
# os:
# - ubuntu-latest
# - macos-latest
# # - macos-latest
# target:
# - x86_64-unknown-linux-gnu
# - i686-unknown-linux-gnu
# - powerpc64-unknown-linux-gnu
# - x86_64-apple-darwin
# - aarch64-apple-darwin
# cfg:
# - unsync_insert
# - unsync_iters
# - unsync_get
# - unsync_constructor
# - swmr_insert
# - swmr_iters
# - swmr_get
# - swmr_constructor
# - swmr_insert
# - swmr_iters
# - swmr_get
# - swmr_constructor
# - generic_insert
# - generic_iters
# - generic_get
# - generic_constructor
# - dynamic_insert
# - dynamic_iters
# - dynamic_get
# - dynamic_constructor
# # Exclude invalid combinations
# exclude:
# - os: ubuntu-latest
# target: x86_64-apple-darwin
# - os: ubuntu-latest
# target: aarch64-apple-darwin
# - os: macos-latest
# target: x86_64-unknown-linux-gnu
# - os: macos-latest
# target: i686-unknown-linux-gnu
# - os: macos-latest
# target: powerpc64-unknown-linux-gnu
# # - os: macos-latest
# # target: x86_64-unknown-linux-gnu
# # - os: macos-latest
# # target: i686-unknown-linux-gnu
# # - os: macos-latest
# # target: powerpc64-unknown-linux-gnu
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
Expand All @@ -366,7 +360,7 @@ jobs:
# run: cargo install cargo-hack
# - name: Miri
# run: |
# bash ci/miri_sb.sh ${{ matrix.target }} ${{ matrix.cfg }}
# bash ci/miri_tb_unbounded.sh ${{ matrix.target }} ${{ matrix.cfg }}

# valgrind
valgrind:
Expand Down
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Rleases
# Releases

## 0.6.0 (Dec 28th, 2024)

- Refactor the project to support both dynamic key-value types and generic key-value types
- Allow users to implement their own memtable
- Support `range_remove`, `range_set` and `range_unset` operations
- Make the project comfortable with `-Z miri-strict-provenance`

## 0.5.0 (Oct 27th, 2024)

Expand All @@ -9,8 +16,6 @@

## 0.4.0 (Sep 30th, 2024)

FEATURES

- Support `K: ?Sized` and `V: ?Sized` for `OrderWal`.
- Use `flush_header_and_range` instead of `flush_range` when insertion.

Expand Down
52 changes: 32 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orderwal"
version = "0.5.1"
version = "0.6.0"
edition = "2021"
repository = "https://github.com/al8n/orderwal"
homepage = "https://github.com/al8n/orderwal"
Expand All @@ -17,10 +17,13 @@ name = "foo"
harness = false

[features]
default = ["memmap"]
alloc = ["rarena-allocator/alloc", "skl/alloc", "dbutils/alloc"]
std = ["rarena-allocator/default", "crossbeam-skiplist/default", "crossbeam-skiplist-mvcc/default", "bitflags/std", "dbutils/default", "among/default", "skl/std"]
memmap = ["std", "rarena-allocator/memmap", "skl/memmap"]
default = ["bounded", "unbounded", "memmap"]
alloc = ["rarena-allocator/alloc", "skl?/alloc", "dbutils/alloc"]
std = ["rarena-allocator/default", "crossbeam-skiplist-mvcc?/default", "either/default", "bitflags/std", "dbutils/default", "among/default", "skl?/std"]
memmap = ["std", "rarena-allocator/memmap", "skl?/memmap"]

bounded = ["skl", "alloc"]
unbounded = ["crossbeam-skiplist-mvcc", "std"]

xxhash3 = ["dbutils/xxhash3", "std"]
xxhash64 = ["dbutils/xxhash64", "std"]
Expand All @@ -30,16 +33,20 @@ tracing = ["dep:tracing", "dbutils/tracing"]
[dependencies]
among = { version = "0.1", default-features = false, features = ["either"] }
bitflags = { version = "2", default-features = false }
dbutils = { version = "0.9", default-features = false, features = ["crc32fast"] }
dbutils = { version = "0.12", default-features = false, features = ["crc32fast", "triomphe01"] }
# dbutils = { version = "0.12", path = "../layer0/dbutils", default-features = false, features = ["crc32fast", "triomphe01"] }
derive-where = "1"
either = { version = "1", default-features = false }
ref-cast = "1"
rarena-allocator = { version = "0.4", default-features = false }
crossbeam-skiplist = { version = "0.1", default-features = false, package = "crossbeam-skiplist-pr1132", optional = true }
crossbeam-skiplist-mvcc = { version = "0.2", optional = true }
skl = { version = "0.19", default-features = false, features = ["alloc"] }
crossbeam-skiplist-mvcc = { version = "0.4", optional = true }
skl = { version = "0.22", default-features = false, optional = true }
# skl = { version = "0.22", optional = true, default-features = false, path = "../skl-rs" }
paste = "1"

zerocopy = { version = "0.8", features = ["derive"] }
tracing = { version = "0.1", default-features = false, optional = true }
triomphe = "0.1"


[dev-dependencies]
criterion = "0.5"
Expand All @@ -66,14 +73,14 @@ rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(all_orderwal_tests)',
'cfg(test_swmr_constructor)',
'cfg(test_swmr_insert)',
'cfg(test_swmr_iters)',
'cfg(test_swmr_get)',
'cfg(test_swmr_multiple_version_constructor)',
'cfg(test_swmr_multiple_version_insert)',
'cfg(test_swmr_multiple_version_iters)',
'cfg(test_swmr_multiple_version_get)',
'cfg(test_generic_constructor)',
'cfg(test_generic_insert)',
'cfg(test_generic_iters)',
'cfg(test_generic_get)',
'cfg(test_dynamic_constructor)',
'cfg(test_dynamic_insert)',
'cfg(test_dynamic_iters)',
'cfg(test_dynamic_get)',
] }

[[example]]
Expand All @@ -82,11 +89,16 @@ path = "examples/zero_cost.rs"
required-features = ["memmap"]

[[example]]
name = "multiple_version"
path = "examples/multiple_version.rs"
name = "basic"
path = "examples/basic.rs"
required-features = ["memmap"]

[[example]]
name = "generic_not_sized"
path = "examples/generic_not_sized.rs"
required-features = ["memmap"]

[[example]]
name = "descend"
path = "examples/descend.rs"
required-features = ["memmap"]
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,31 @@ English | [简体中文][zh-cn-url]

## Installation

> [!TIP]
>
> - `bounded` feature will enable a memory table implementation based on ARENA-style [`SkipMap`](https://github.com/al8n/skl)
>
> - `unbouned` feature (cannot compile without `std`) will enable a memory table implementation based on linked-style [`SkipMap`](https://github.com/al8n/crossbeam-skiplist-mvcc)

- Default (with on-disk support)

```toml
[dependencies]
orderwal = "0.5"
orderwal = "0.6"
```

- `std` only (without on-disk support)
- `std` (without on-disk support)

```toml
[dependencies]
orderwal = { version = "0.5", default-features = false, features = ["std"] }
orderwal = { version = "0.6", default-features = false, features = ["std", "bounded", "unbounded"] }
```

- `no-std` (`alloc` required)

```toml
[dependencies]
orderwal = { version = "0.5", default-features = false, features = ["alloc"] }
orderwal = { version = "0.6", default-features = false, features = ["alloc", "bounded"] }
```

## Example
Expand Down
25 changes: 0 additions & 25 deletions ci/miri_sb.sh

This file was deleted.

6 changes: 2 additions & 4 deletions ci/miri_tb.sh → ci/miri_tb_bounded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ rustup override set nightly
cargo miri setup

# Zmiri-ignore-leaks needed because of https://github.com/crossbeam-rs/crossbeam/issues/579
export MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-tree-borrows -Zmiri-ignore-leaks"
export MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows -Zmiri-ignore-leaks"
export RUSTFLAGS="--cfg test_$CONFIG_FLAGS"

cargo miri test --tests --target $TARGET --lib 2>&1 | ts -i '%.s '

cargo miri test --tests --target $TARGET --lib --no-default-features --features bounded,std 2>&1 | ts -i '%.s '
32 changes: 32 additions & 0 deletions ci/miri_tb_unbounded.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -euxo pipefail
IFS=$'\n\t'

# We need 'ts' for the per-line timing
sudo apt-get -y install moreutils
echo

# Check if TARGET and CONFIG_FLAGS are provided, otherwise panic
if [ -z "$1" ]; then
echo "Error: TARGET is not provided"
exit 1
fi

if [ -z "$2" ]; then
echo "Error: CONFIG_FLAGS are not provided"
exit 1
fi

TARGET=$1
CONFIG_FLAGS=$2

rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup

# Zmiri-ignore-leaks needed because of https://github.com/crossbeam-rs/crossbeam/issues/579
# -Zmiri-strict-provenance (crossbeam-epoch is not compatible with this flag)
RUSTFLAGS="--cfg test_$CONFIG_FLAGS" \
MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-symbolic-alignment-check -Zmiri-tree-borrows -Zmiri-ignore-leaks" \
cargo miri test --tests --target $TARGET --lib --no-default-features --features unbounded,std 2>&1 | ts -i '%.s '

Loading
Loading