Releases: WowoEngine/SawitDB
Releases · WowoEngine/SawitDB
SawitDB v3.0
3.0.0 Update FUNDING.yml
SawitDB v2.6.0
Release SawitDB v2.6.0
Modular Architecture (Codebase Refactor)
- Service-Oriented Core: Split monolithic
WowoEngine.jsinto specialized modules:- Logic Services:
ConditionEvaluator.js,JoinProcessor.js. - Managers:
TableManager.js,IndexManager.js. - Executors: Dedicated classes (Strategy Pattern) for
Select,Insert,Update,Delete,Aggregate.
- Logic Services:
- Server modularity: Split
SawitServer.jsintoAuthManager.js,ClientSession.js,RequestRouter.js, andDatabaseRegistry.js. - Maintainability: Reduced file size complexity by ~60%, enabling easier feature expansion.
True Multi-Threading (Worker Pool)
- Worker Pool Architecture: Migrated from
clustermodule toworker_threadsfor 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
statscommand 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.idDISTINCT & AGGREGATE
- DISTINCT:
SELECT DISTINCT category FROM products(orPANEN UNIK ...) to remove duplicates. - HAVING Clause:
GROUP BY region HAVING count > 5to 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.parsewith 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
nullfor empty datasets - Fixed buffer pool leaks on read errors
- Fixed
Thanks to : @adityarizkyramadhan @fdciabdul @razmans @aljabary @rayocta303 @repo-unx
SawitDB v2.5.0
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.parseoverhead for hot pages. - Performance: SELECT (Indexed) jumped from ~60k to ~247,000 TPS.
- Zero-Copy Reads: Bypasses
- Hash Join: Optimized
JOINoperations 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
_indexessystem table). - File Locking: Fixed Windows
EPERMissues duringDROP DATABASE. - Query Parser: Fixed Operator Precedence (
AND>OR) and escaped quotes handling.
SawitDB v2.4
Release SawitDB v2.4
Security
- Parameterized Queries: Implemented full support for parameterized queries to prevent AQL injection.
- Updated
SawitClientto send parameters. - Updated
SawitServerandWowoEngineto bind parameters safely. - Updated
QueryParserto handle@paramplaceholders.
- Updated
Documentation
- Enhanced Docs: Updated
docs/index.htmlto 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.jsonformain,scripts, andbin.
Credits
- Thanks to @nastarkejuu for reporting AQL injection issue.
SawitDB v2.3
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 maxIS NULL,IS NOT NULL
- Pagination & Sorting:
ORDER BY field [ASC|DESC]LIMIT n OFFSET m
- Native Data Types: Improved
INSERTparser to correctly handleNULL,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 INDEXparser hanging code block.
SawitDB v2.1
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
SawitClientclass 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,AVGsupport 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.