From 31e8f1d126ae6b630391c321c36c8a27df3880ed Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 16 Apr 2024 20:25:59 +0800 Subject: [PATCH 01/11] *: bump 0.4.2 Signed-off-by: lucasliang --- CHANGELOG.md | 7 +++++++ Cargo.toml | 2 +- ctl/Cargo.toml | 4 ++-- stress/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2aaa484..4b6a52f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## [Unreleased] +## [0.4.1] - 2024-04-16 + +### Behavior Changes + +* Periodically flush unsynced bytes when rewriting to avoid I/O jitters if flushing too many bytes impede the foreground writes. #347 +* Errors will be returned if rewriting fails, instread of `panic` directly. #343 + ## [0.4.1] - 2023-09-14 ### Behavior Changes diff --git a/Cargo.toml b/Cargo.toml index 4f6f4846..357bd0f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raft-engine" -version = "0.4.1" +version = "0.4.2" authors = ["The TiKV Project Developers"] edition = "2018" rust-version = "1.66.0" diff --git a/ctl/Cargo.toml b/ctl/Cargo.toml index 5bf23c8b..f7a10e1e 100644 --- a/ctl/Cargo.toml +++ b/ctl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raft-engine-ctl" -version = "0.4.1" +version = "0.4.2" authors = ["The TiKV Project Developers"] edition = "2018" rust-version = "1.61.0" @@ -11,4 +11,4 @@ license = "Apache-2.0" [dependencies] clap = { version = "3.1", features = ["derive", "cargo"] } env_logger = "0.10" -raft-engine = { path = "..", version = "0.4.1", features = ["scripting", "internals"] } +raft-engine = { path = "..", version = "0.4.2", features = ["scripting", "internals"] } diff --git a/stress/Cargo.toml b/stress/Cargo.toml index 79d131e2..e5a24f02 100644 --- a/stress/Cargo.toml +++ b/stress/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stress" -version = "0.4.1" +version = "0.4.2" authors = ["The TiKV Authors"] edition = "2018" From 4d3e79c93794141942a968983d7101b95968175a Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 16 Apr 2024 20:27:40 +0800 Subject: [PATCH 02/11] Bugfix. Signed-off-by: lucasliang --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6a52f7..d2bf9450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [Unreleased] -## [0.4.1] - 2024-04-16 +## [0.4.2] - 2024-04-16 ### Behavior Changes From e4f98a9a98d3f1eebfa9cc9bba0d74df8d056137 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 16 Apr 2024 21:34:20 +0800 Subject: [PATCH 03/11] Update toolchain. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f6d967c6..a3d4f3e9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2023-07-01 + toolchain: nightly-2024-02-10 override: true components: rustfmt, clippy, rust-src - uses: Swatinem/rust-cache@v1 @@ -60,7 +60,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.67.1 + toolchain: 1.75.0 override: true components: rustfmt, clippy, rust-src - uses: Swatinem/rust-cache@v1 @@ -87,7 +87,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2023-07-01 + toolchain: nightly-2024-02-10 override: true components: llvm-tools-preview - uses: Swatinem/rust-cache@v1 diff --git a/Cargo.toml b/Cargo.toml index 357bd0f7..5f4a0e89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "raft-engine" version = "0.4.2" authors = ["The TiKV Project Developers"] edition = "2018" -rust-version = "1.66.0" +rust-version = "1.76.0" description = "A persistent storage engine for Multi-Raft logs" readme = "README.md" repository = "https://github.com/tikv/raft-engine" From f3b3a862c0378dc6d1343fef968feef6ec25a5c6 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 16 Apr 2024 21:37:18 +0800 Subject: [PATCH 04/11] Correct version Signed-off-by: lucasliang --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a3d4f3e9..78e5ab4c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,7 +60,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.76.0 override: true components: rustfmt, clippy, rust-src - uses: Swatinem/rust-cache@v1 From e10b4b3bcab6db7cfa69845d9e551cb31784da52 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 16 Apr 2024 21:49:34 +0800 Subject: [PATCH 05/11] Fix clippy errors. Signed-off-by: lucasliang --- src/env/log_fd/unix.rs | 4 ++-- src/file_pipe_log/pipe.rs | 2 +- src/swappy_allocator.rs | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/env/log_fd/unix.rs b/src/env/log_fd/unix.rs index 608cca70..e9b75542 100644 --- a/src/env/log_fd/unix.rs +++ b/src/env/log_fd/unix.rs @@ -83,7 +83,7 @@ impl LogFd { while readed < buf.len() { let bytes = match pread(self.0, &mut buf[readed..], offset as i64) { Ok(bytes) => bytes, - Err(e) if e == Errno::EINTR => continue, + Err(Errno::EINTR) => continue, Err(e) => return Err(from_nix_error(e, "pread")), }; // EOF @@ -106,7 +106,7 @@ impl LogFd { while written < content.len() { let bytes = match pwrite(self.0, &content[written..], offset as i64) { Ok(bytes) => bytes, - Err(e) if e == Errno::EINTR => continue, + Err(Errno::EINTR) => continue, Err(e) if e == Errno::ENOSPC => return Err(from_nix_error(e, "nospace")), Err(e) => return Err(from_nix_error(e, "pwrite")), }; diff --git a/src/file_pipe_log/pipe.rs b/src/file_pipe_log/pipe.rs index 43b3483a..27ea8267 100644 --- a/src/file_pipe_log/pipe.rs +++ b/src/file_pipe_log/pipe.rs @@ -713,7 +713,7 @@ mod tests { // Retire files. assert_eq!(pipe_log.purge_to(last).unwrap() as u64, last - first); // Try to read recycled file. - for (_, handle) in handles.into_iter().enumerate() { + for handle in handles.into_iter() { assert!(pipe_log.read_bytes(handle).is_err()); } // Try to reuse. diff --git a/src/swappy_allocator.rs b/src/swappy_allocator.rs index 8baa4835..0cb8db9b 100644 --- a/src/swappy_allocator.rs +++ b/src/swappy_allocator.rs @@ -288,6 +288,7 @@ impl Page { .read(true) .write(true) .create(true) + .truncate(true) .open(path) .map_err(|e| error!("Failed to open swap file: {e}")) .ok()?; From d3cb0fc855e17ed4e8522082ef9613f1367eacc5 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Wed, 17 Apr 2024 10:47:20 +0800 Subject: [PATCH 06/11] Fix test compilation errs. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 78e5ab4c..1230ccdf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -99,7 +99,7 @@ jobs: run: | make test_matrix env: - RUSTFLAGS: '-Zinstrument-coverage' + RUSTFLAGS: '-Cinstrument-coverage' LLVM_PROFILE_FILE: '%p-%m.profraw' EXTRA_CARGO_ARGS: '--verbose' - name: Run grcov From 7082afb30c816696bdbdc31f52215c89906273af Mon Sep 17 00:00:00 2001 From: lucasliang Date: Mon, 22 Apr 2024 18:32:56 +0800 Subject: [PATCH 07/11] Polish changelog and upload codecov report with TOKEN. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 4 +++- CHANGELOG.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1230ccdf..068e9525 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -105,6 +105,8 @@ jobs: - name: Run grcov run: grcov `find . \( -name "*.profraw" \) -print` --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov - name: Upload - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: file: coverage.lcov diff --git a/CHANGELOG.md b/CHANGELOG.md index d2bf9450..7531efab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,8 @@ ### Behavior Changes -* Periodically flush unsynced bytes when rewriting to avoid I/O jitters if flushing too many bytes impede the foreground writes. #347 -* Errors will be returned if rewriting fails, instread of `panic` directly. #343 +* Periodically flush unsynced bytes when rewriting to avoid I/O jitters if flushing too many bytes impede the foreground writes. (#347) +* Errors will be returned if rewriting fails, instread of `panic` directly. (#343) ## [0.4.1] - 2023-09-14 From 52773890c88825a5cf198575255e894904ba482b Mon Sep 17 00:00:00 2001 From: lucasliang Date: Mon, 22 Apr 2024 19:06:22 +0800 Subject: [PATCH 08/11] Fix MacOS compilation errs. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 068e9525..9f05ff37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,15 +33,15 @@ jobs: make format git diff --exit-code - name: Clippy - run: make clippy + run: ulimit -S -n `ulimit -H -n` && make clippy - name: Run tests - run: make test + run: ulimit -S -n `ulimit -H -n` && make test env: RUST_BACKTRACE: 1 EXTRA_CARGO_ARGS: '--verbose' - name: Run asan tests if: ${{ matrix.os == 'ubuntu-latest' }} - run: make test + run: ulimit -S -n `ulimit -H -n` && make test env: RUST_BACKTRACE: 1 RUSTFLAGS: '-Zsanitizer=address' @@ -67,11 +67,11 @@ jobs: with: sharedKey: ${{ matrix.os }}-stable - name: Clippy - run: make clippy + run: ulimit -S -n `ulimit -H -n` && make clippy env: WITH_STABLE_TOOLCHAIN: 'force' - name: Run tests - run: make test + run: ulimit -S -n `ulimit -H -n` && make test env: RUST_BACKTRACE: 1 EXTRA_CARGO_ARGS: '--verbose' @@ -97,7 +97,7 @@ jobs: run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install --locked grcov; fi - name: Run tests run: | - make test_matrix + ulimit -S -n `ulimit -H -n` && make test_matrix env: RUSTFLAGS: '-Cinstrument-coverage' LLVM_PROFILE_FILE: '%p-%m.profraw' From 1a072f633d339a408ea9d169ca0a1d412c611eeb Mon Sep 17 00:00:00 2001 From: lucasliang Date: Mon, 22 Apr 2024 20:35:31 +0800 Subject: [PATCH 09/11] Revert "Fix MacOS compilation errs." This reverts commit 52773890c88825a5cf198575255e894904ba482b. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9f05ff37..068e9525 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,15 +33,15 @@ jobs: make format git diff --exit-code - name: Clippy - run: ulimit -S -n `ulimit -H -n` && make clippy + run: make clippy - name: Run tests - run: ulimit -S -n `ulimit -H -n` && make test + run: make test env: RUST_BACKTRACE: 1 EXTRA_CARGO_ARGS: '--verbose' - name: Run asan tests if: ${{ matrix.os == 'ubuntu-latest' }} - run: ulimit -S -n `ulimit -H -n` && make test + run: make test env: RUST_BACKTRACE: 1 RUSTFLAGS: '-Zsanitizer=address' @@ -67,11 +67,11 @@ jobs: with: sharedKey: ${{ matrix.os }}-stable - name: Clippy - run: ulimit -S -n `ulimit -H -n` && make clippy + run: make clippy env: WITH_STABLE_TOOLCHAIN: 'force' - name: Run tests - run: ulimit -S -n `ulimit -H -n` && make test + run: make test env: RUST_BACKTRACE: 1 EXTRA_CARGO_ARGS: '--verbose' @@ -97,7 +97,7 @@ jobs: run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install --locked grcov; fi - name: Run tests run: | - ulimit -S -n `ulimit -H -n` && make test_matrix + make test_matrix env: RUSTFLAGS: '-Cinstrument-coverage' LLVM_PROFILE_FILE: '%p-%m.profraw' From 011a5b43924870b8cfbefff8e8ffcc6ffbc72055 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Mon, 22 Apr 2024 21:58:54 +0800 Subject: [PATCH 10/11] Optimize the ci workflow. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 068e9525..1cfe51a5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,6 +34,8 @@ jobs: git diff --exit-code - name: Clippy run: make clippy + env: + EXTRA_CARGO_ARGS: '--fix' - name: Run tests run: make test env: From 7ca14fce7dccf5bc0ba77867b6000fb93d0419f4 Mon Sep 17 00:00:00 2001 From: lucasliang Date: Tue, 23 Apr 2024 10:23:35 +0800 Subject: [PATCH 11/11] Downgrade the version to meet the space usage limit of CI. Signed-off-by: lucasliang --- .github/workflows/rust.yml | 6 +++--- Cargo.toml | 2 +- ctl/Cargo.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1cfe51a5..a6d2ee09 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2024-02-10 + toolchain: nightly-2023-12-31 override: true components: rustfmt, clippy, rust-src - uses: Swatinem/rust-cache@v1 @@ -62,7 +62,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.76.0 + toolchain: 1.75.0 override: true components: rustfmt, clippy, rust-src - uses: Swatinem/rust-cache@v1 @@ -89,7 +89,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2024-02-10 + toolchain: nightly-2023-12-31 override: true components: llvm-tools-preview - uses: Swatinem/rust-cache@v1 diff --git a/Cargo.toml b/Cargo.toml index 5f4a0e89..6694e705 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "raft-engine" version = "0.4.2" authors = ["The TiKV Project Developers"] edition = "2018" -rust-version = "1.76.0" +rust-version = "1.75.0" description = "A persistent storage engine for Multi-Raft logs" readme = "README.md" repository = "https://github.com/tikv/raft-engine" diff --git a/ctl/Cargo.toml b/ctl/Cargo.toml index f7a10e1e..4c97eefb 100644 --- a/ctl/Cargo.toml +++ b/ctl/Cargo.toml @@ -3,7 +3,7 @@ name = "raft-engine-ctl" version = "0.4.2" authors = ["The TiKV Project Developers"] edition = "2018" -rust-version = "1.61.0" +rust-version = "1.75.0" description = "A control tool for Raft Engine" repository = "https://github.com/tikv/raft-engine" license = "Apache-2.0"