Files
Baradb/tests/test_wire_insert_stress.nim
T
dimgigov 8db5cfe7e1
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
feat: harden storage, schema persistence, fair benches, fix wire crash
Core storage: hash MemTable, WAL group commit, L0 compaction rebuild,
reader-writer lock, and a global StorageGate so HTTP workers and TCP
share the LSM safely under multi-thread access.

Schema: durable CREATE/ALTER/DROP under _schema:tables:* with full LSM
restore on open. Executor types/values/schema split into query/exec/.

Wire protocol: switch default MM to ARC — ORC cycle collector segfaulted
after ~20 async INSERTs. Fair multi-tier benchmarks (SQLite/HTTP/wire/PG)
and honesty docs for mixed-tier comparisons.
2026-07-18 16:55:50 +03:00

27 lines
1.0 KiB
Nim

## Regression: sequential wire-style INSERTs must not crash the process.
## Root cause was ORC cycle collector (markGray SIGSEGV); project uses --mm:arc.
import std/unittest
import std/os
import barabadb/storage/lsm
import barabadb/query/executor
import barabadb/query/parser
proc execSql(ctx: ExecutionContext, sql: string): ExecResult =
executeQuery(ctx, parse(sql))
suite "Wire insert stress (ARC regression)":
test "200 sequential INSERTs via executor survive":
## Mirrors the wire path (executeQuery under StorageGate each time).
let dir = "/tmp/baradb_wire_stress"
removeDir(dir)
var db = newLSMTree(dir, walSyncMode = wsmNone)
var ctx = newExecutionContext(db)
check execSql(ctx, "CREATE TABLE stress (id INT PRIMARY KEY, v TEXT)").success
for i in 0 ..< 200:
let r = execSql(ctx, "INSERT INTO stress (id, v) VALUES (" & $i & ", 'v" & $i & "')")
check r.success
let sel = execSql(ctx, "SELECT id FROM stress")
check sel.success
check sel.rows.len == 200
db.close()