Skip to content

Releases: WowoEngine/SawitDB

SawitDB v3.0

29 Jan 00:32
dff3091

Choose a tag to compare

3.0.0

Update FUNDING.yml

SawitDB v2.6.0

10 Jan 04:59

Choose a tag to compare

Release SawitDB v2.6.0

Modular Architecture (Codebase Refactor)

  • Service-Oriented Core: Split monolithic WowoEngine.js into specialized modules:
    • Logic Services: ConditionEvaluator.js, JoinProcessor.js.
    • Managers: TableManager.js, IndexManager.js.
    • Executors: Dedicated classes (Strategy Pattern) for Select, Insert, Update, Delete, Aggregate.
  • Server modularity: Split SawitServer.js into AuthManager.js, ClientSession.js, RequestRouter.js, and DatabaseRegistry.js.
  • Maintainability: Reduced file size complexity by ~60%, enabling easier feature expansion.

True Multi-Threading (Worker Pool)

  • Worker Pool Architecture: Migrated from cluster module to worker_threads for true parallelism.
  • IO/CPU Separation: Main thread handles Networking (IO), Worker threads handle Query Execution (CPU).
  • High Concurrency: Architecture supports thousands of concurrent connections without blocking.
  • Load Balancing: Implemented "Least-Busy" strategy to distribute queries to the least loaded worker.
  • Fault Tolerance:
    • Auto-Healing: Workers automatically restart upon crash.
    • Anti-Stuck: Pending queries on crashed workers are immediately rejected/cleaned up.
  • Per-Worker Stats: New stats command output shows query distribution and active load per worker.

AQL Syntax Parity (Agricultural Query Language)

Full feature parity with Generic SQL. You can now use AQL for advanced queries:

  • JOINs: GABUNG (Inner), GABUNG KIRI (Left), GABUNG KANAN (Right), GABUNG SILANG (Cross).
  • Ordering: URUTKAN BERDASARKAN [field] NAIK|TURUN (Order By).
  • Pagination: HANYA [n] (Limit), MULAI DARI [n] (Offset).
  • Grouping: KELOMPOK [field] (Group By), DENGAN SYARAT (Having).
  • Compatibility: Standard SQL syntax (JOIN, ORDER BY, LIMIT) remains fully supported alongside AQL.

Advanced SQL Features

JOIN Enhancements

  • LEFT OUTER JOIN: Returns all rows from left table, NULL for unmatched right rows
  • RIGHT OUTER JOIN: Returns all rows from right table, NULL for unmatched left rows
  • FULL OUTER JOIN: Returns all rows from both tables with NULL for non-matches
  • CROSS JOIN: Cartesian product (no ON clause required)
-- LEFT JOIN example
SELECT * FROM employees LEFT JOIN departments ON employees.dept_id = departments.id

DISTINCT & AGGREGATE

  • DISTINCT: SELECT DISTINCT category FROM products (or PANEN UNIK ...) to remove duplicates.
  • HAVING Clause: GROUP BY region HAVING count > 5 to filter aggregated results.
  • EXPLAIN Query Plan: EXPLAIN SELECT ... to analyze execution strategy, index usage, and cost.

Security Improvements

  • Password Hashing: Server authentication now uses SHA-256 with random salt
  • Timing-Safe Comparison: Prevents timing attacks on password verification
  • Input Validation: Table and column names validated against injection
  • Regex Injection Fix: LIKE operator now escapes regex metacharacters

Performance & Code Quality

  • Query Cache: Replaced expensive JSON.parse with shallow clone
  • True LRU Cache: Pager now properly tracks access order for eviction
  • B-Tree Binary Search: Index operations now use O(log n) binary search
  • Optimized Aggregates: MIN/MAX use single-pass loop (prevents stack overflow)
  • Reduced JSON Parsing: DELETE/UPDATE operations optimize parsing overhead
  • Bug Fixes:
    • Fixed _deleteFullScan() undefined table name
    • Cleaned up duplicate code (_loadIndexes, pager checks)
    • AVG now returns null for empty datasets
    • Fixed buffer pool leaks on read errors

Thanks to : @adityarizkyramadhan @fdciabdul @razmans @aljabary @rayocta303 @repo-unx

SawitDB v2.5.0

06 Jan 17:22

Choose a tag to compare

Release SawitDB v2.5.0

Major Performance Update

  • Object Caching (Page-Level): Implemented a memory-resident Object Cache in Pager.js.
    • Zero-Copy Reads: Bypasses JSON.parse overhead for hot pages.
    • Performance: SELECT (Indexed) jumped from ~60k to ~247,000 TPS.
  • Hash Join: Optimized JOIN operations from O(M*N) to O(M+N).
    • Faster Queries: Complex joins reduced from ~2900ms to ~40ms.
  • Query Plan Caching: Implemented LRU Cache for parsed queries to reduce CPU overhead on repeated queries.

Added

  • Async WAL (Write-Ahead Logging): Refactored for non-blocking stream-based writes.
  • CLI Enhancements: Detailed help menus, SQL aliases, and database switching in local.js.
  • New Tools: Added CLI Unit Tests (cli/test.js) and Performance Benchmark (cli/benchmark.js).

Bug Fixes

  • Persistence: Fixed critical bug where Indexes were lost on restart (Added _indexes system table).
  • File Locking: Fixed Windows EPERM issues during DROP DATABASE.
  • Query Parser: Fixed Operator Precedence (AND > OR) and escaped quotes handling.

SawitDB v2.4

02 Jan 16:45
7c12ebe

Choose a tag to compare

Release SawitDB v2.4

Security

  • Parameterized Queries: Implemented full support for parameterized queries to prevent AQL injection.
    • Updated SawitClient to send parameters.
    • Updated SawitServer and WowoEngine to bind parameters safely.
    • Updated QueryParser to handle @param placeholders.

Documentation

  • Enhanced Docs: Updated docs/index.html to match README feature set.
    • Added Benchmark results.
    • Added Dual Syntax (AQL vs SQL) comparison table.
    • Added complete Operators table.
  • Package Fixes: Corrected invalid paths in package.json for main, scripts, and bin.

Credits

  • Thanks to @nastarkejuu for reporting AQL injection issue.

SawitDB v2.3

30 Dec 19:28

Choose a tag to compare

Release SawitDB v2.3

New Features

  • Generic SQL Support: Added full support for standard SQL syntax alongside AQL.
    • CREATE TABLE, INSERT INTO, SELECT, UPDATE, DELETE, DROP.
    • CREATE INDEX ON table (field) syntax.
  • Advanced Operators:
    • IN (...), NOT IN (...)
    • LIKE 'pattern%' (Wildcard)
    • BETWEEN min AND max
    • IS NULL, IS NOT NULL
  • Pagination & Sorting:
    • ORDER BY field [ASC|DESC]
    • LIMIT n OFFSET m
  • Native Data Types: Improved INSERT parser to correctly handle NULL, TRUE, FALSE (boolean/null) instead of strings.

Performance

  • Tokenizer Optimization: Fixed Regex parser to correctly identify < and > operators.
  • Benchmark:
    • INSERT: ~3,125 ops/sec
    • SELECT (PK): ~3,846 ops/sec
    • SELECT (Scan): ~4,762 ops/sec
    • UPDATE: ~3,571 ops/sec

Bug Fixes

  • Fixed "Normal Ops" parser fallthrough bug where simple comparisons (>, <) were sometimes misidentified.
  • Fixed CREATE INDEX parser hanging code block.

SawitDB v2.1

29 Dec 16:40

Choose a tag to compare

Release SawitDB v2.1

This major release introduces the Network Edition, transforming SawitDB from a local file-based engine into a full-fledged client-server database system, while maintaining its lightweight "single-file" philosophy.

Highlights

Network Edition (TCP Server)

  • Client-Server Architecture: Connect remotely using sawitdb:// protocol.
  • Multi-Database Support: Manage multiple plantations (databases) on a single server instance.
  • Authentication: Optional user/password protection for your data.
  • High Performance: Benchmarked at ~7.4M ops/sec for reads and ~34k ops/sec for inserts.

Refactored Architecture

We have reorganized the codebase for better maintainability:

  • src/: Core engine logics (SawitDB, SawitServer, SawitClient).
  • bin/: Server executable (sawit-server.js).
  • cli/: Dedicated tools for Local (local.js) and Remote (remote.js) access.
  • docs/: Comprehensive documentation site ready for GitHub Pages.

Documentation Overhaul

  • New Documentation Site: A beautiful, responsive documentation page (docs/index.html) styled with Tailwind CSS.
  • Unified README: Merged network features and core concepts into a single source of truth.

New Features in Detail

  • Server: Run via node bin/sawit-server.js. Supports env vars (SAWIT_PORT, SAWIT_AUTH).
  • Client: New SawitClient class for Node.js applications.
  • CLI: Interactive remote shell with node cli/remote.js.
  • Indexing: B-Tree indexing support for O(log n) lookups.
  • Aggregations: COUNT, SUM, AVG support in AQL.

Credits

  • Special thanks to @sonofescobar1337 for the massive contribution in implementing the Client-Server architecture and interactive CLI tools.
  • Thanks to @repo-unx for leading the major codebase refactoring and directory restructuring.