Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d09a735
feat #172: first version commit for ttl feature implementation
JoshuaChi Nov 9, 2025
545e890
feat #172: new round iteration
JoshuaChi Nov 11, 2025
347fa2e
feat #172: 100% not satisficated with "let sm_any = state_machine as …
JoshuaChi Nov 12, 2025
b5fdbdf
feat #172: cleanup dyn Any code style. Waiting for testing
JoshuaChi Nov 12, 2025
b4d1454
feat #172: change server start signature to "start_server()"
JoshuaChi Nov 12, 2025
69c1f41
refactor(ttl) #172: optimize persist strategy - move to snapshot and …
JoshuaChi Nov 12, 2025
7136903
fix(ci) #172: fix dependency-audit workflow Rust version compatibility
JoshuaChi Nov 12, 2025
9bd7149
fix(bench) #172: fix clippy uninlined_format_args warnings
JoshuaChi Nov 12, 2025
8f4ac09
fix(test) #172: fix RocksDB TTL persistence test - add stop() before …
JoshuaChi Nov 12, 2025
b2db41a
feat #172: implement etcd-compatible TTL with crash-safe WAL format +…
JoshuaChi Nov 12, 2025
0b67527
fix #172: remove all trace! logs to eliminate test output noise
JoshuaChi Nov 12, 2025
1b063ce
test #172: add WAL replay edge-case tests for TTL crash-safety
JoshuaChi Nov 12, 2025
282815a
test #172: add comprehensive unit tests for election_handler module
JoshuaChi Nov 12, 2025
323aa63
test #172: add comprehensive unit tests for timer module
JoshuaChi Nov 12, 2025
73daa44
test #172: add 22 comprehensive unit tests for DefaultLease in separa…
JoshuaChi Nov 12, 2025
b7db48d
test #172: coverage improved from 77.96% to 85.84% (+7.88%)
JoshuaChi Nov 12, 2025
32c6614
chore #172: fix commit message validation to include all cliff.toml t…
JoshuaChi Nov 12, 2025
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
89 changes: 89 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Performance Benchmarks

# Run benchmarks on a schedule and for important changes
on:
# Run weekly on Sunday at 2 AM UTC
schedule:
- cron: "0 2 * * 0"

# Allow manual triggering for on-demand performance testing
workflow_dispatch:

# Run on pushes to main branch that affect performance-critical code
push:
branches:
- main
paths:
- "d-engine-server/src/storage/**"
- "d-engine-server/benches/**"
- "d-engine-core/src/**"

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
benchmark:
name: Run Performance Benchmarks
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for performance comparison

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
# Cache key includes benchmark to avoid interference with test cache
key: benchmark-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run benchmarks
run: |
echo "========================================="
echo "Running d-engine Performance Benchmarks"
echo "========================================="
echo ""
echo "Performance Targets:"
echo " • Without TTL: < 10ns overhead"
echo " • With TTL passive check: < 50ns overhead"
echo " • Piggyback cleanup: < 1ms"
echo ""

# Run benchmarks and save output
cargo bench --package d-engine-server 2>&1 | tee benchmark_output.txt

echo ""
echo "✅ Benchmarks completed successfully"

- name: Upload detailed results as artifact
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
target/criterion/
benchmark_output.txt
retention-days: 30

- name: Performance summary
run: |
echo "========================================="
echo "Performance Benchmark Summary"
echo "========================================="
echo ""
echo "📊 Benchmark results uploaded as artifacts"
echo ""
echo "To view detailed results:"
echo " 1. Download the artifact"
echo " 2. Open target/criterion/report/index.html in your browser"
echo ""
echo "✅ Performance monitoring complete"
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ jobs:
run: |
cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info --ignore-filename-regex "src/generated/.*|src/errors.rs"

- name: Check benchmarks compile
run: |
echo "Checking that benchmark code compiles correctly..."
cargo bench --no-run --package d-engine-server
echo "✅ Benchmarks compile successfully"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/commit-message-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
BASE_SHA=${{ github.event.pull_request.base.sha }}
HEAD_SHA=${{ github.event.pull_request.head.sha }}

ALLOWED_TYPES="feat|fix|refs|doc|perf|refactor|chore"
ALLOWED_TYPES="feat|fix|refs|doc|perf|refactor|style|test|chore|ci|revert"
SCOPE_PATTERN="([a-z][a-z0-9-]*)"
TICKET_PATTERN="#[0-9]+:"
FULL_PATTERN="^($ALLOWED_TYPES)(\($SCOPE_PATTERN\))? $TICKET_PATTERN.+$"

# Validate the format of all new submissions
for commit in $(git rev-list $BASE_SHA..$HEAD_SHA); do
msg=$(git show -s --format=%s $commit)
# skip merge

# skip merge
if [[ "$msg" =~ ^Merge ]]; then
continue
fi
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dependency-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

Expand All @@ -26,7 +29,7 @@ jobs:

- name: Audit dependencies
run: |
cargo install cargo-deny
cargo install cargo-deny --locked
cargo deny check all

- name: Update dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ docker/monitoring/prometheus/data/
lcov.info

CONTEXT
*.bak*
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,69 @@ All notable changes to this project will be documented in this file.

---

## [v0.2.0] - 2025-11-12 [✅ Released]

### 🚀 Features

- **TTL/Lease Support**: Implemented time-to-live (TTL) functionality with configurable cleanup strategies (piggyback, lazy, scheduled) for automatic key expiration
- **Unified NodeBuilder API**: Simplified node startup with new `start_server()` method that combines `build()`, `start_rpc_server()`, and `ready()` into a single async call
- **Improved State Machine Initialization**: Enhanced state machine lifecycle with `try_inject_lease()` and `post_start_init()` hooks for transparent lease configuration
- **etcd-Compatible TTL Semantics**: TTL now uses absolute expiration time (compatible with etcd lease semantics) instead of relative TTL, ensuring correct behavior across restarts

### 🔄 Breaking Changes

- **WAL Format Change (File-based State Machine)**: ⚠️ **CRITICAL BREAKING CHANGE**
- WAL entries now store absolute expiration time (`expire_at_secs: u64`) instead of relative TTL (`ttl_secs: u32`)
- This enables crash-safe TTL semantics and etcd-compatible lease behavior
- **Migration Required**: See [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md) for upgrade instructions
- Existing WAL files from pre-v0.2.0 are **not compatible** and must be migrated

- **NodeBuilder API**: `build().start_rpc_server().await.ready()` is now replaced with `.start_server().await`
- See [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md) for detailed migration instructions
- Old API is no longer supported

### 📝 Documentation

- Added comprehensive MIGRATION_GUIDE.md for API changes
- Updated all README files with new `start_server()` API
- Updated server guide documentation for custom implementations
- Updated quick-start examples in overview documentation

### 🐛 Fixes

- Fixed clippy warning: empty line after doc comments in RocksDB state machine
- Fixed duplicate trace logging in BufferedRaftLog initialization
- Fixed log level filtering: RUST_LOG now correctly limits to DEBUG level (no more TRACE spam in tests)
- Fixed Zed editor clippy warnings in benchmark code
- Fixed unused imports in test utilities
- Fixed crash-safety bug: snapshot restore now persists TTL metadata to RocksDB CF
- Fixed WAL replay: expired entries are now correctly skipped during recovery

### ⚡ Performance

- **Benchmark Optimization**: Reduced TTL benchmark execution time by ~10x
- `worst_case_all_expired`: 213s → 20s (10.6x faster)
- `mixed_ttl_workload`: 200s → 20s (10x faster)
- `piggyback_high_frequency`: 200s → 20s (10x faster)
- Used `iter_batched` to separate setup from measurement
- Reduced sample size to 10 for tests with sleep operations

### ✨ Quality

- All benchmarks pass clippy without warnings
- TTL benchmarks validate cleanup performance targets
- State machine benchmarks validate scaling characteristics
- Added tests for crash-safe WAL replay behavior
- Added tests for TTL persistence across snapshot restore

### 🔧 Internal Improvements

- Refactored RocksDB options configuration into `configure_db_options()` helper (DRY)
- Removed high-frequency trace logs from hot paths to reduce noise
- Improved test output clarity by filtering log levels correctly

---

## [v0.1.4] - 2025-10-12 [✅ Released]

### Features
Expand Down
Loading
Loading