Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions server/src/client_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ mod client_handler_tests {
use crate::client_handler::{ClientError, ClientHandler};
use crate::protocol_handler::{BinaryProtocolHandler, TextProtocolHandler};
use crate::server::ExecutorWithWorkers;
use crate::workers_container::WorkersContainer;
use dashmap::DashMap;
use executor::Executor;
use metadata::catalog_manager::CatalogManager;
use parking_lot::RwLock;
use protocol::{Request, Response, StatementType};
Expand Down
2 changes: 1 addition & 1 deletion storage/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl Cache {
// - allocate page
// the newly allocated page will discard previous changes applied from wal.
let mut pinned_write_page = self.pin_write(&id)?;
pinned_write_page.mark_diff(0, PAGE_SIZE as _);
pinned_write_page.mark_diff(0, USABLE_PAGE_SIZE as _);

Ok((pinned_write_page, page_id))
}
Expand Down
19 changes: 8 additions & 11 deletions storage/src/write_ahead_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,7 @@ impl WalClient {
let (send, recv) = channel::bounded(1);
let ops = ops
.into_iter()
.map(|(file_page_ref, diff)| SinglePageOperation {
file_page_ref,
diff,
})
.map(|(file_page_ref, diff)| SinglePageOperation::new(file_page_ref, diff))
.collect();
let record = WalRecord {
data: WalRecordData::MultiPageOperation(ops),
Expand Down Expand Up @@ -930,7 +927,7 @@ mod tests {
let dir = tempdir().unwrap();
let log_path = dir.path();
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();

assert_eq!(handle.wal_client.flushed_lsn(), 0);

Expand All @@ -954,7 +951,7 @@ mod tests {
let dir = tempdir().unwrap();
let log_path = dir.path();
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();

handle
.wal_client
Expand Down Expand Up @@ -1008,7 +1005,7 @@ mod tests {
// First session: write records and checkpoint
{
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
handle
.wal_client
.write_single(make_test_file_page_ref(1), PageDiff::default());
Expand All @@ -1030,7 +1027,7 @@ mod tests {
// Second session: recover
{
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();

// Should only have records after checkpoint (LSN 4 and 5)
assert_eq!(handle.redo_records.len(), 2);
Expand All @@ -1050,7 +1047,7 @@ mod tests {
// First session
{
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
handle
.wal_client
.write_single(make_test_file_page_ref(1), PageDiff::default());
Expand All @@ -1068,7 +1065,7 @@ mod tests {
// Second session
{
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();

// flushed_lsn should be set to last_lsn from recovery
assert_eq!(handle.wal_client.flushed_lsn(), 3);
Expand Down Expand Up @@ -1098,7 +1095,7 @@ mod tests {
let dir = tempdir().unwrap();
let log_path = dir.path();
let (handle, mut bg_handle) =
spawn_wal(&log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();
spawn_wal(log_path, FLUSH_INTERVAL_MS, MAX_UNFLUSHED_RECORDS).unwrap();

// Simulate how Cache would share WalClient via Arc
let shared = SharedWalClient::new(handle.wal_client);
Expand Down
50 changes: 39 additions & 11 deletions tester/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
# Tester

This crate is a small test client used only for running end-to-end and performance tests against a running coDB server.
This crate is a test client used for running end-to-end and performance tests against a coDB server.

Prerequisites
- Ensure the coDB server is already running before using the tester (the tester connects to the server).
## Overview

Quick run
- Build & run the tester (example):
- **E2E Tests**: Automatically manage the database server lifecycle - start the server before tests and stop it after tests complete.
- **Performance Tests**: Require a manually started server for more accurate benchmarking.

## Prerequisites

- Build the server binary first:
```bash
cargo build --release --bin server
```

## Quick Run

### E2E Tests

E2E tests require the `--server-path` argument - the server is started/stopped automatically:

```bash
# Run a specific E2E test
cargo run -p tester -- e2e-select --server-path ./target/release/server

# Run all E2E tests
cargo run -p tester -- e2e-all --server-path ./target/release/server
```

### Performance Tests

Performance tests require a **manually started server**:

```bash
# Terminal 1: Start the server
./target/release/server

# Terminal 2: Run performance tests (no --server-path needed)
cargo run -p tester -- concurrent-reads-index --runs 1 --threads 8 --records 1000 --bound-size 10
```

Performance tests
- Performance tests live in [tester/src/performance](tester/src/performance).
## Test Types

### Performance Tests
Performance tests live in [tester/src/performance](tester/src/performance) and measure concurrency and throughput.

Adding a new performance test
- Add a new file in [tester/src/performance](tester/src/performance) implementing the `Suite` trait (see existing tests for examples).
- Export the module in [tester/src/performance/mod.rs](tester/src/performance/mod.rs) with `pub mod your_test;`.
- Wire a CLI subcommand and runner in [tester/src/main.rs](tester/src/main.rs) so you can execute the test from the command line.
### E2E Tests
E2E tests live in [tester/src/e2e](tester/src/e2e) and verify end-to-end functionality.
1 change: 1 addition & 0 deletions tester/src/e2e/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pub mod response_helpers;
pub mod select;
pub mod truncate_table;
pub mod update;
pub mod wal_recovery;
Loading
Loading