Bump version to 1.1.6; fix storage bugs, tests, CI pipeline and Docker config
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

Storage fixes:
- Fix bloom filter hash2 OverflowDefect (uint64 instead of int Hash)
- Fix MemTable.put size calculation on overwrite (was leaking size)
- Fix fuzz_test duplicate-key issues in LSM delete and SSTable tests

Test fixes:
- Fix stress_test.nim: replace deprecated threadpool with std/threads
- Fix fuzz_test.nim: add missing imports (tables, algorithm, sets)
- Fix fuzz_test.nim: var sst for close() compatibility
- Remove unused imports from test_all.nim and bench_all.nim

Docker / CI fixes:
- Fix Dockerfile.source: invalid nimlang/nim:2.2.10-alpine tag → 2.2.10 + ubuntu:24.04 runtime
- Fix Dockerfile.source healthcheck (--spider → -qO- for 200 OK)
- Fix Dockerfile run comment ports (9470/9471 → 9912/9913)
- Fix scripts/docker-run.sh healthcheck port (9470 → 9912)
- Add ARG BUILD_DATE/VCS_REF to Dockerfile for docker-build.sh
- Update all version strings 1.1.4 → 1.1.6 across nimble/docker/source/docs
This commit is contained in:
2026-05-19 12:13:33 +03:00
parent 343f479127
commit cd46edcb67
47 changed files with 150 additions and 118 deletions
+2
View File
@@ -10,6 +10,8 @@ tests/stress_test
tests/test_lock
tests/test_minimal
tests/tla_faithfulness
tests/fuzz_test
tests/prop_test
benchmarks/bench_all
benchmarks/compare
clients/nim/tests/test_client
+5 -2
View File
@@ -10,13 +10,16 @@
# docker build -t baradb:latest .
#
# Run:
# docker run -d -p 9472:9472 -p 9470:9470 -p 9471:9471 -v baradb_data:/data baradb:latest
# docker run -d -p 9472:9472 -p 9912:9912 -p 9913:9913 -v baradb_data:/data baradb:latest
FROM debian:bookworm-slim
ARG BUILD_DATE
ARG VCS_REF
LABEL maintainer="BaraDB Team"
LABEL description="BaraDB — Multimodal Database Engine"
LABEL version="1.1.4"
LABEL version="1.1.6"
# Инсталираме runtime зависимости
# libpcre3 — нужна за Nim regex (зарежда се динамично)
+17 -14
View File
@@ -13,13 +13,10 @@
# docker build -f Dockerfile.source -t baradb:latest .
# ─── Stage 1: Builder ─────────────────────────────────────
FROM nimlang/nim:2.2.10-alpine AS builder
FROM nimlang/nim:2.2.10 AS builder
WORKDIR /build
# Инсталираме build зависимости
RUN apk add --no-cache git gcc musl-dev openssl-dev pcre-dev
# Копираме nimble файл и инсталираме публични зависимости
COPY baradadb.nimble .
RUN nimble install -d -y || true
@@ -33,21 +30,27 @@ COPY *.nim .
RUN nim c -d:release --opt:speed -d:ssl -o:baradadb src/baradadb.nim
# Компилираме backup tool
RUN nim c -d:release -o:backup src/barabadb/core/backup.nim
RUN nim c -d:release --path:src -o:backup src/barabadb/core/backup.nim
# ─── Stage 2: Production Runtime ──────────────────────────
FROM alpine:3.19
FROM ubuntu:24.04
LABEL maintainer="BaraDB Team"
LABEL description="BaraDB — Multimodal Database Engine (source build)"
LABEL version="1.1.4"
LABEL version="1.1.6"
# Инсталираме runtime зависимости
RUN apk add --no-cache ca-certificates su-exec wget pcre
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpcre3 \
ca-certificates \
wget \
gosu && \
rm -rf /var/lib/apt/lists/*
# Създаваме dedicated потребител за сигурност
RUN addgroup -g 1000 -S baradb && \
adduser -u 1000 -S baradb -G baradb
RUN groupadd -r baradb && \
useradd -r -g baradb baradb
WORKDIR /app
@@ -66,20 +69,20 @@ RUN mkdir -p /data && chown baradb:baradb /data && \
# Environment variables (defaults)
ENV BARADB_ADDRESS=0.0.0.0
ENV BARADB_PORT=9472
ENV BARADB_HTTP_PORT=9470
ENV BARADB_WS_PORT=9471
# Note: HTTP port = TCP port + 440 (9912 when TCP=9472)
# Note: WS port = TCP port + 441 (9913 when TCP=9472)
ENV BARADB_DATA_DIR=/data
ENV BARADB_LOG_LEVEL=info
# Expose ports
EXPOSE 9472 9470 9471
EXPOSE 9472 9912 9913
# Volume за persistent data
VOLUME ["/data"]
# Healthcheck
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
CMD wget -q --spider http://localhost:${BARADB_HTTP_PORT}/health || exit 1
CMD wget -qO- http://localhost:9912/health >/dev/null 2>&1 || exit 1
# Стартираме чрез entrypoint
ENTRYPOINT ["docker-entrypoint.sh"]
+9 -9
View File
@@ -4,7 +4,7 @@
**A multimodal database engine written in Nim — 100% native, zero dependencies.**
[![Version](https://img.shields.io/badge/version-1.1.4-blue.svg)](baradadb.nimble)
[![Version](https://img.shields.io/badge/version-1.1.6-blue.svg)](baradadb.nimble)
[![Documentation](https://img.shields.io/badge/docs-7_languages-blue.svg)](docs/index.md)
[![Stars](https://img.shields.io/github/stars/katehonz/barabaDB?style=social)](https://github.com/katehonz/barabaDB)
@@ -1456,7 +1456,7 @@ nim c -d:release -r benchmarks/bench_all.nim
| Protocol (binary + HTTP + WS + pool + auth + ratelimit) | ✅ | 100% | v1.0.0 |
| Schema (inheritance + computed + migrations) | ✅ | 100% | v1.0.0 |
| Vector engine (HNSW + IVF-PQ + quant + SIMD + metadata) | ✅ | 100% | v1.0.0 |
| Vector SQL Integration (VECTOR type, distance functions, <->, HNSW indexes) | ✅ | 100% | v1.1.4 |
| Vector SQL Integration (VECTOR type, distance functions, <->, HNSW indexes) | ✅ | 100% | v1.1.6 |
| Graph engine (all algorithms + pattern matching) | ✅ | 100% | v1.0.0 |
| FTS (BM25 + TF-IDF + fuzzy + regex + multi-language) | ✅ | 100% | v1.0.0 |
| CLI shell | ✅ | 100% | v1.0.0 |
@@ -1464,13 +1464,13 @@ nim c -d:release -r benchmarks/bench_all.nim
| Cross-modal queries | ✅ | 100% | v1.0.0 |
| Backup & Recovery | ✅ | 100% | v1.0.0 |
| Client SDKs (JS, Python, Nim, Rust) | ✅ | 100% | v1.0.0 |
| Graph SQL Integration (CREATE GRAPH, GRAPH_TABLE, Cypher) | ✅ | 100% | v1.1.4 |
| Hybrid RAG Search (vector + FTS + RRF reranking) | ✅ | 100% | v1.1.4 |
| AI Chunking & Auto-Embedding (`chunk()`, `embed_text()`) | ✅ | 100% | v1.1.4 |
| NL→SQL (`nl_to_sql()`, `schema_prompt()`) | ✅ | 100% | v1.1.4 |
| MCP Server (STDIO JSON-RPC for AI agents) | ✅ | 100% | v1.1.4 |
| LangChain Vector Store (Python + JS) | ✅ | 100% | v1.1.4 |
| Production Hardening (prop tests, fuzz tests, thread safety) | ✅ | 100% | v1.1.4 |
| Graph SQL Integration (CREATE GRAPH, GRAPH_TABLE, Cypher) | ✅ | 100% | v1.1.6 |
| Hybrid RAG Search (vector + FTS + RRF reranking) | ✅ | 100% | v1.1.6 |
| AI Chunking & Auto-Embedding (`chunk()`, `embed_text()`) | ✅ | 100% | v1.1.6 |
| NL→SQL (`nl_to_sql()`, `schema_prompt()`) | ✅ | 100% | v1.1.6 |
| MCP Server (STDIO JSON-RPC for AI agents) | ✅ | 100% | v1.1.6 |
| LangChain Vector Store (Python + JS) | ✅ | 100% | v1.1.6 |
| Production Hardening (prop tests, fuzz tests, thread safety) | ✅ | 100% | v1.1.6 |
## Current Limitations
+1 -1
View File
@@ -1,5 +1,5 @@
# Package
version = "1.1.4"
version = "1.1.6"
author = "BaraDB Team"
description = "BaraDB — Multimodal database written in Nim"
license = "Apache-2.0"
-1
View File
@@ -1,7 +1,6 @@
## BaraDB Benchmarks — performance tests for all engines
import std/monotimes
import std/times
import std/tables
import std/random
import std/strutils
import std/os
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "baradb",
"version": "1.1.4",
"version": "1.1.6",
"description": "Official JavaScript/Node.js client for BaraDB — Multimodal Database Engine",
"main": "baradb.js",
"types": "baradb.d.ts",
+1 -1
View File
@@ -15,7 +15,7 @@ Official Nim client for **BaraDB** — a multimodal database engine.
Add to your `.nimble` file:
```nim
requires "baradb >= 1.1.4"
requires "baradb >= 1.1.6"
```
Or clone locally:
+1 -1
View File
@@ -1,6 +1,6 @@
# Package
version = "1.1.4"
version = "1.1.6"
author = "BaraDB Team"
description = "Official Nim client for BaraDB — async binary protocol client"
license = "Apache-2.0"
+1 -1
View File
@@ -41,7 +41,7 @@ from .core import (
ResultFormat,
)
__version__ = "1.1.4"
__version__ = "1.1.6"
__all__ = [
"Client",
"QueryBuilder",
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "baradb"
version = "1.1.4"
version = "1.1.6"
description = "Official Python client for BaraDB — Multimodal Database Engine"
readme = "README.md"
license = { text = "Apache-2.0" }
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "baradb"
version = "1.1.4"
version = "1.1.6"
edition = "2021"
authors = ["BaraDB Team <team@baradb.dev>"]
description = "Official async Rust client for BaraDB — binary protocol client"
+3 -3
View File
@@ -143,7 +143,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# المتوقع: BaraDB v1.1.4 — Multimodal Database Engine
# المتوقع: BaraDB v1.1.6 — Multimodal Database Engine
```
## تشغيل الاختبارات
@@ -237,7 +237,7 @@ docker-compose up -d
أضف إلى ملف `.nimble` الخاص بك:
```nim
requires "barabadb >= 1.1.4"
requires "barabadb >= 1.1.6"
```
استخدم في الكود:
@@ -258,7 +258,7 @@ db.close()
./build/baradadb
# المخرجات المتوقعة:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# الاختبار عبر HTTP API
+2 -2
View File
@@ -41,7 +41,7 @@
### Добавки
- **Client SDKs v1.1.4** — Пълнофункционални клиенти за всички езици:
- **Client SDKs v1.1.6** — Пълнофункционални клиенти за всички езици:
- JavaScript: TypeScript дефиниции, package.json, примери, unit и integration тестове
- Python: Преструктуриран като пакет (`baradb/` с `__init__.py` и `core.py`), pyproject.toml, примери, тестове (query builder, wire protocol, integration)
- Nim: Примери, integration тестове, README
@@ -72,7 +72,7 @@
### Промени
- **Версията е вдигната до 1.1.0** във всички компоненти (сървър, Docker изображения, клиенти, CLI)
- **README** — Версионният badge е обновен; всички feature таблици вече реферират v1.1.4
- **README** — Версионният badge е обновен; всички feature таблици вече реферират v1.1.6
- **TLA+ Формална Верификация** — Добавени `crossmodal.tla`, `backup.tla`, `recovery.tla`; symmetry reduction във всички 9 спецификации
- **Чист build** — 0 компилаторни предупреждения на Nim 2.2.10
+1 -1
View File
@@ -129,7 +129,7 @@ asyncio.run(main())
```nim
# Във вашия .nimble файл
requires "barabadb >= 1.1.4"
requires "barabadb >= 1.1.6"
```
### Вградена Употреба
+1 -1
View File
@@ -159,7 +159,7 @@ raft_peers = "node2:9001,node3:9001"
```
```
BaraDB v1.1.4 — Multimodal Database Engine
BaraDB v1.1.6 — Multimodal Database Engine
Употреба:
baradadb [опции]
+1 -1
View File
@@ -39,7 +39,7 @@ docker compose logs -f
docker build -t baradb:latest .
# С конкретна версия
docker build -t baradb:1.1.4 .
docker build -t baradb:1.1.6 .
```
## Стартиране
+3 -3
View File
@@ -143,7 +143,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# Очакван резултат: BaraDB v1.1.4 — Multimodal Database Engine
# Очакван резултат: BaraDB v1.1.6 — Multimodal Database Engine
```
## Стартиране на Тестове
@@ -234,7 +234,7 @@ docker-compose up -d
Добавете към вашия `.nimble` файл:
```nim
requires "barabadb >= 1.1.4"
requires "barabadb >= 1.1.6"
```
Използване в кода:
@@ -255,7 +255,7 @@ db.close()
./build/baradadb
# Очакван изход:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# Тестване с HTTP API
+1 -1
View File
@@ -13,7 +13,7 @@ curl http://localhost:9470/health
```json
{
"status": "healthy",
"version": "1.1.4",
"version": "1.1.6",
"uptime_seconds": 86400,
"checks": {
"storage": "ok",
+1 -1
View File
@@ -136,7 +136,7 @@ GET /health
```json
{
"status": "healthy",
"version": "1.1.4",
"version": "1.1.6",
"uptime_seconds": 86400
}
```
+2 -2
View File
@@ -50,7 +50,7 @@ Alle bemerkenswerten Änderungen an BaraDB werden in dieser Datei dokumentiert.
### Hinzugefügt
- **Client SDKs v1.1.4** — Vollständige Clients für alle Sprachen:
- **Client SDKs v1.1.6** — Vollständige Clients für alle Sprachen:
- JavaScript: TypeScript Definitionen, package.json, Beispiele, Unit & Integration Tests
- Python: Umstrukturiert als proper Package (`baradb/` mit `__init__.py` und `core.py`), pyproject.toml, Beispiele, Tests
- Nim: Beispiele, Integration Tests, README
@@ -81,7 +81,7 @@ Alle bemerkenswerten Änderungen an BaraDB werden in dieser Datei dokumentiert.
### Geändert
- **Version auf 1.1.0 erhöht** über alle Komponenten
- **README** — Version Badge aktualisiert; alle Feature-Tabellen referenzieren jetzt v1.1.4
- **README** — Version Badge aktualisiert; alle Feature-Tabellen referenzieren jetzt v1.1.6
- **TLA+ Formal Verification** — `crossmodal.tla`, `backup.tla`, `recovery.tla` hinzugefügt; Symmetrie-Reduktion in allen 9 Specs
- **Clean build** — 0 Compiler Warnings auf Nim 2.2.10
+1 -1
View File
@@ -156,7 +156,7 @@ raft_peers = "node2:9001,node3:9001"
```
```
BaraDB v1.1.4 — Multimodal Database Engine
BaraDB v1.1.6 — Multimodal Database Engine
Usage:
baradadb [options]
+1 -1
View File
@@ -40,7 +40,7 @@ docker compose up -d
```bash
./build/baradadb --version
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
./build/baramcp --data-dir ./data &
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | ./build/baramcp
+2 -2
View File
@@ -65,7 +65,7 @@ All notable changes to BaraDB are documented in this file.
### Added
- **Client SDKs v1.1.4** — Full-featured clients for all languages:
- **Client SDKs v1.1.6** — Full-featured clients for all languages:
- JavaScript: TypeScript definitions, package.json, examples, unit & integration tests
- Python: Restructured as proper package (`baradb/` with `__init__.py` and `core.py`), pyproject.toml, examples, tests (query builder, wire protocol, integration)
- Nim: Examples, integration tests, README
@@ -96,7 +96,7 @@ All notable changes to BaraDB are documented in this file.
### Changed
- **Version bumped to 1.1.0** across all components (server, Docker images, clients, CLI)
- **README** — Version badge updated; all feature tables now reference v1.1.4
- **README** — Version badge updated; all feature tables now reference v1.1.6
- **TLA+ Formal Verification** — Added `crossmodal.tla`, `backup.tla`, `recovery.tla`; symmetry reduction in all 9 specs
- **Clean build** — 0 compiler warnings on Nim 2.2.10
+1 -1
View File
@@ -158,7 +158,7 @@ raft_peers = "node2:9001,node3:9001"
```
```
BaraDB v1.1.4 — Multimodal Database Engine
BaraDB v1.1.6 — Multimodal Database Engine
Usage:
baradadb [options]
+2 -2
View File
@@ -144,7 +144,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# Expected: BaraDB v1.1.4 — Multimodal Database Engine
# Expected: BaraDB v1.1.6 — Multimodal Database Engine
```
## Running Tests
@@ -259,7 +259,7 @@ db.close()
./build/baradadb
# Expected output:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# Test with HTTP API
+2 -2
View File
@@ -144,7 +144,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# انتظار: BaraDB v1.1.4 — Multimodal Database Engine
# انتظار: BaraDB v1.1.6 — Multimodal Database Engine
```
## اجرای تست‌ها
@@ -259,7 +259,7 @@ db.close()
./build/baradadb
# خروجی مورد انتظار:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# تست با HTTP API
+1 -1
View File
@@ -156,7 +156,7 @@ raft_peers = "node2:9001,node3:9001"
```
```
BaraDB v1.1.4 — Multimodal Database Engine
BaraDB v1.1.6 — Multimodal Database Engine
Usage:
baradadb [options]
+2 -2
View File
@@ -144,7 +144,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# Ожидается: BaraDB v1.1.4 — Multimodal Database Engine
# Ожидается: BaraDB v1.1.6 — Multimodal Database Engine
```
## Запуск тестов
@@ -259,7 +259,7 @@ db.close()
./build/baradadb
# Ожидаемый вывод:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# Проверка через HTTP API
+3 -3
View File
@@ -143,7 +143,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# Beklenen: BaraDB v1.1.4 — Multimodal Database Engine
# Beklenen: BaraDB v1.1.6 — Multimodal Database Engine
```
## Testleri Çalıştırma
@@ -237,7 +237,7 @@ docker-compose up -d
`.nimble` dosyanıza ekleyin:
```nim
requires "barabadb >= 1.1.4"
requires "barabadb >= 1.1.6"
```
Kodunuzda kullanın:
@@ -258,7 +258,7 @@ db.close()
./build/baradadb
# Beklenen çıktı:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# HTTP API ile test et
+1 -1
View File
@@ -156,7 +156,7 @@ raft_peers = "node2:9001,node3:9001"
```
```
BaraDB v1.1.4 — Multimodal Database Engine
BaraDB v1.1.6 — Multimodal Database Engine
Usage:
baradadb [options]
+2 -2
View File
@@ -144,7 +144,7 @@ strip build/baradadb
```bash
./build/baradadb --version
# 预期输出: BaraDB v1.1.4 — Multimodal Database Engine
# 预期输出: BaraDB v1.1.6 — Multimodal Database Engine
```
## 运行测试
@@ -259,7 +259,7 @@ db.close()
./build/baradadb
# 预期输出:
# BaraDB v1.1.4 — Multimodal Database Engine
# BaraDB v1.1.6 — Multimodal Database Engine
# BaraDB TCP listening on 127.0.0.1:9472
# 使用 HTTP API 测试
+1 -1
View File
@@ -21,7 +21,7 @@ This directory contains TLA+ specifications for core BaraDB distributed-systems
- Java Runtime Environment (JRE) 8+ — the bundled `tla2tools.jar` contains TLC and SANY.
- Or [TLA+ Toolbox](https://lamport.azurewebsites.net/tla/toolbox.html) (GUI + TLC model checker).
## Verified State Space (v1.1.4)
## Verified State Space (v1.1.6)
| Spec | States Generated | Distinct States | Depth |
|------|-----------------|-----------------|-------|
+1 -1
View File
@@ -22,7 +22,7 @@ run_tlc() {
}
echo "=============================================="
echo " BaraDB Formal Verification Suite v1.1.4"
echo " BaraDB Formal Verification Suite v1.1.6"
echo " Running TLC model checker on all specs"
echo "=============================================="
echo ""
+1 -1
View File
@@ -29,7 +29,7 @@ docker run -d \
-e BARADB_PORT=9472 \
-e BARADB_DATA_DIR=/data \
-e BARADB_LOG_LEVEL=info \
--health-cmd "wget -q --spider http://localhost:9470/health || exit 1" \
--health-cmd "wget -q --spider http://localhost:9912/health || exit 1" \
--health-interval 15s \
--health-timeout 5s \
--health-retries 3 \
+1 -1
View File
@@ -5,7 +5,7 @@ import ../query/lexer
import ../query/parser
const
Version = "1.1.4"
Version = "1.1.6"
Prompt = "bara> "
ContinuationPrompt = " .. > "
+2 -2
View File
@@ -199,7 +199,7 @@ proc queryHandler(server: HttpServer): RequestHandler =
proc healthHandler(): RequestHandler =
return proc(request: Request) {.gcsafe.} =
let ctx = newContext(request)
ctx.json(%*{"status": "ok", "version": "1.1.4"})
ctx.json(%*{"status": "ok", "version": "1.1.6"})
proc metricsHandler(server: HttpServer): RequestHandler =
return proc(request: Request) {.gcsafe.} =
@@ -535,7 +535,7 @@ function showTab(idx){
}
setInterval(() => { if(document.querySelectorAll('.panel')[4].classList.contains('active')) loadMetrics() }, 5000)
</script>
<div class='status' style='text-align:center;padding:10px'>BaraDB v1.1.4 — Multimodal Database Engine</div>
<div class='status' style='text-align:center;padding:10px'>BaraDB v1.1.6 — Multimodal Database Engine</div>
</body></html>"""
request.respond(200, @[("Content-Type", "text/html; charset=utf-8")], html)
+1 -1
View File
@@ -116,7 +116,7 @@ proc exportOtlp*(tracer: Tracer, endpoint: string = "http://localhost:4318/v1/tr
{"key": "service.name", "value": {"stringValue": "baradadb"}}
]},
"scopeSpans": [{
"scope": {"name": "baradadb-tracer", "version": "1.1.4"},
"scope": {"name": "baradadb-tracer", "version": "1.1.6"},
"spans": otlpSpans
}]
}]
+2 -2
View File
@@ -503,7 +503,7 @@ proc handleInitialize(params: JsonNode): JsonNode =
"protocolVersion": "2024-11-05",
"serverInfo": {
"name": "BaraDB MCP Server",
"version": "1.1.4"
"version": "1.1.6"
},
"capabilities": {
"tools": {}
@@ -690,7 +690,7 @@ proc processMessage(raw: string): string =
# ---------------------------------------------------------------------------
proc init*(dataDir: string = "./data"): McpServerCtx =
logToStderr("BaraDB MCP Server v1.1.4 initializing...")
logToStderr("BaraDB MCP Server v1.1.6 initializing...")
let db = newLSMTree(dataDir)
let ctx = newExecutionContext(db)
ctx.txnManager = newTxnManager()
+3 -3
View File
@@ -24,10 +24,10 @@ proc hash1*(bf: BloomFilter, data: openArray[byte]): uint64 =
result = uint64(!$h)
proc hash2*(bf: BloomFilter, data: openArray[byte]): uint64 =
var h: Hash = 5381
var h: uint64 = 5381
for b in data:
h = ((h shl 5) + h) + Hash(b)
result = uint64(h)
h = ((h shl 5) + h) + uint64(b)
result = h
proc getHashes(bf: BloomFilter, data: openArray[byte]): seq[int] =
let h1 = bf.hash1(data)
+5 -3
View File
@@ -68,15 +68,17 @@ proc put*(mt: var MemTable, key: string, value: seq[byte], timestamp: uint64, de
let entrySize = key.len + value.len + 16
if entrySize > mt.maxSize:
return false
if mt.size + entrySize > mt.maxSize and mt.entries.len > 0:
return false
let entry = Entry(key: key, value: value, timestamp: timestamp, deleted: deleted)
let pos = mt.entries.lowerBound(entry, proc(a, b: Entry): int = cmp(a.key, b.key))
if pos < mt.entries.len and mt.entries[pos].key == key:
let oldSize = mt.entries[pos].key.len + mt.entries[pos].value.len + 16
mt.entries[pos] = entry
mt.size += entrySize - oldSize
else:
if mt.size + entrySize > mt.maxSize and mt.entries.len > 0:
return false
mt.entries.insert(entry, pos)
mt.size += entrySize
mt.size += entrySize
return true
proc get*(mt: MemTable, key: string): (bool, Entry) =
+1 -1
View File
@@ -211,7 +211,7 @@ proc main() =
# Init structured logger from config
let logLvl = parseEnum[LogLevel]("ll" & capitalizeAscii(config.logLevel))
defaultLogger = newLogger(logLvl, config.logFile)
info("BaraDB v1.1.4 — Multimodal Database Engine")
info("BaraDB v1.1.6 — Multimodal Database Engine")
# Security check: warn if JWT secret is not configured
if config.jwtSecret.len == 0:
BIN
View File
Binary file not shown.
+35 -20
View File
@@ -4,6 +4,9 @@ import std/random
import std/strutils
import std/os
import std/monotimes
import std/tables
import std/sets
import std/algorithm
import barabadb/protocol/wire
import barabadb/storage/lsm
@@ -547,6 +550,7 @@ suite "Storage Fuzz":
test "LSM delete removes key and get returns false":
var rng = initRand(6002)
let tmpDir = getTempDir() / "baradb_fuzz_lsm_del_" & $getCurrentProcessId()
removeDir(tmpDir)
createDir(tmpDir)
defer: removeDir(tmpDir)
@@ -554,11 +558,14 @@ suite "Storage Fuzz":
defer: db.close()
var keys: seq[string] = @[]
for i in 0..<200:
var seen = initHashSet[string]()
while keys.len < 200:
let k = randKey(rng, 1, 16)
let v = randValue(rng, 0, 64)
db.put(k, v)
keys.add(k)
if k notin seen:
seen.incl(k)
let v = randValue(rng, 0, 64)
db.put(k, v)
keys.add(k)
# Delete half
for i in 0..<keys.len div 2:
@@ -678,19 +685,23 @@ suite "Storage Fuzz":
defer: removeDir(tmpDir)
var entries: seq[Entry] = @[]
for i in 0..<100:
entries.add(Entry(
key: randKey(rng, 1, 20),
value: randValue(rng, 0, 128),
timestamp: uint64(i),
deleted: false,
))
var seenSst = initHashSet[string]()
while entries.len < 100:
let k = randKey(rng, 1, 20)
if k notin seenSst:
seenSst.incl(k)
entries.add(Entry(
key: k,
value: randValue(rng, 0, 128),
timestamp: uint64(entries.len),
deleted: false,
))
# Sort entries by key for SSTable
entries.sort(proc(a, b: Entry): int = cmp(a.key, b.key))
let path = tmpDir / "test.sst"
let sst = writeSSTable(entries, path, level = 0)
var sst = writeSSTable(entries, path, level = 0)
defer: close(sst)
for e in entries:
@@ -735,17 +746,21 @@ suite "Storage Fuzz":
defer: removeDir(tmpDir)
var entries: seq[Entry] = @[]
for i in 0..<50:
entries.add(Entry(
key: randKey(rng, 1, 16),
value: randValue(rng, 0, 64),
timestamp: uint64(i),
deleted: rng.rand(0..1) == 1,
))
var seenTomb = initHashSet[string]()
while entries.len < 50:
let k = randKey(rng, 1, 16)
if k notin seenTomb:
seenTomb.incl(k)
entries.add(Entry(
key: k,
value: randValue(rng, 0, 64),
timestamp: uint64(entries.len),
deleted: rng.rand(0..1) == 1,
))
entries.sort(proc(a, b: Entry): int = cmp(a.key, b.key))
let path = tmpDir / "tombstones.sst"
let sst = writeSSTable(entries, path, level = 0)
var sst = writeSSTable(entries, path, level = 0)
defer: close(sst)
for e in entries:
BIN
View File
Binary file not shown.
+24 -15
View File
@@ -2,11 +2,8 @@
## Each worker gets its own LSMTree instance (thread-safe via internal locks).
import std/os
import std/random
import std/strutils
import std/times
import std/monotimes
import std/sequtils
import std/threadpool
import barabadb/storage/lsm
const
@@ -14,16 +11,24 @@ const
OpsPerWorker = 1000
KeySpace = 500
type
WorkerArgs = tuple
workerId: int
dataDir: string
errors: ptr int
randomize()
proc runWorker(workerId: int, dataDir: string): int =
var db = newLSMTree(dataDir)
var errors = 0
proc runWorker(args: WorkerArgs) {.thread.} =
var db: LSMTree
var localErrors = 0
{.cast(gcsafe).}:
db = newLSMTree(args.dataDir)
for i in 0 ..< OpsPerWorker:
let op = rand(0 .. 2)
let key = "key_" & $workerId & "_" & $(rand(0 ..< KeySpace))
let value = cast[seq[byte]]("val_" & $i & "_" & $workerId)
let key = "key_" & $args.workerId & "_" & $(rand(0 ..< KeySpace))
let value = cast[seq[byte]]("val_" & $i & "_" & $args.workerId)
case op
of 0:
@@ -39,12 +44,12 @@ proc runWorker(workerId: int, dataDir: string): int =
discard
for k in 0 ..< KeySpace:
let key = "key_" & $workerId & "_" & $k
let key = "key_" & $args.workerId & "_" & $k
let (found, _) = db.get(key)
discard found
db.close()
return errors
args.errors[] = localErrors
proc main() =
let baseDir = "/tmp/baradb_stress_test"
@@ -57,14 +62,18 @@ proc main() =
for i in 0 ..< NumWorkers:
workerDirs.add(baseDir / "worker_" & $i)
# Run workers in parallel using threadpool
var futures: seq[FlowVar[int]] = @[]
# Run workers in parallel using std/threads
var threadArr: array[NumWorkers, Thread[WorkerArgs]]
var errorCounts: array[NumWorkers, int]
for i in 0 ..< NumWorkers:
futures.add(spawn runWorker(i, workerDirs[i]))
let args: WorkerArgs = (workerId: i, dataDir: workerDirs[i], errors: addr errorCounts[i])
createThread(threadArr[i], runWorker, args)
var totalErrors = 0
for f in futures:
totalErrors += ^f
for i in 0 ..< NumWorkers:
joinThread(threadArr[i])
totalErrors += errorCounts[i]
let elapsed = (getMonoTime() - start).inMilliseconds
let totalOps = NumWorkers * OpsPerWorker
-1
View File
@@ -6,7 +6,6 @@ import std/os
import std/asyncdispatch
import std/monotimes
import std/base64
import std/random
import std/json
import barabadb/core/types