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