_ _ _ _____ _ | | (_) (_) |_ _| | | | | _ _ _ __ ___ _ _ __ ___ __ | | ___ | | ___ _ __ ___ | | | | | | '_ ` _ \| | '_ \| \ \/ / | | / _ \| |/ _ \ '_ ` _ \ | |___| |_| | | | | | | | | | | |> < _| || (_) | | __/ | | | | | |______\__,_|_| |_| |_|_|_| |_|_/_/\_\ |_____\___/|_|\___|_| |_| |_|
Luminix Experience Platform
Next-Generation Embedded Database and JSON I/O Engine
Empowering high-performance applications with robust ACID transactions, custom indexing, and seamless JSON document management at the speed of C.
๐ Developer Story
Why We Built It
Luminix Experience Platform started as a personal curiosity-driven initiative as a team project. We realized that many modern databases come with significant overhead, demanding substantial memory and CPU resources just to run the runtime environment. For resource-constrained environments, IoT edge devices, or highly optimized backend microservices, developers often face a difficult trade-off between performance and features. We wanted to build a system that offered the speed of raw C memory manipulation combined with the structured robustness of a modern RDBMS and a Document Store. Luminix was born from the desire to eliminate bloat, minimize latencies, and provide an engine where every CPU cycle counts.
Who We Are
Team: godfrey, harihar, hariprakash. We are a collective of systems engineers, performance enthusiasts, and data architecture aficionados. Our background spans low-level systems programming, distributed databases, and high-performance computing. We believe in software craftsmanship, meticulous memory management, and elegant code design.
Challenges Faced
Building a database engine from scratch in C is not for the faint of heart. Our most significant challenges included:
- Memory Management: Ensuring zero memory leaks in long-running processes required rigorous testing and custom memory pool allocators.
- Concurrency: Implementing granular locks to prevent race conditions during high-volume read/write workloads.
- JSON Parsing: Creating a zero-copy JSON parser that can ingest deeply nested JSON trees faster than standard libraries.
- B-Tree Indexing: Balancing B-Trees dynamically without locking the entire index structure.
- Crash Recovery: Implementing an ARIES-style Write-Ahead Log (WAL) to ensure atomicity and durability after abrupt power loss.
How We Built It
We strictly adhered to the C99 standard to guarantee maximum portability. We implemented modularity from day one, separating the query parser, execution engine, transaction manager, and storage I/O into distinct sub-systems. By employing custom memory pools and lock-free data structures for reads, we minimized context switching and heap fragmentation. The codebase relies heavily on pointer arithmetic and memory-mapped files (mmap) for blazing fast I/O throughput.
Key Learnings
- Building an ACID-compliant engine requires extreme attention to edge cases in the write-ahead log (WAL) and recovery processes.
- String interpolation and parsing are often the biggest bottlenecks in C; optimizing these paths yields the highest performance gains.
- The tradeoff between Read-Optimized and Write-Optimized structures is highly workload-dependent; offering configurable index types (B-Tree, Hash, SkipList) is crucial for a generic engine.
- Valgrind and AFL++ are indispensable tools; fuzzy testing found parsing edge cases that no human would ever write in a unit test.
Future Roadmap
- Implementation of a distributed consensus protocol (Raft) for high availability across nodes.
- A WebAssembly (Wasm) build for in-browser database execution, allowing Luminix to run locally inside Edge/Chrome.
- Advanced vectorized query execution for analytical (OLAP) workloads.
- Bindings for Python, Node.js, and Go, allowing modern scripting languages to leverage the C core.
- Spatial indexing (R-Trees) for geographic data processing.
Developer Message
To fellow developers: Luminix is an invitation to explore the raw power of system programming. We invite you to dive into the codebase, test its limits, report bugs, and help us redefine what an embedded database can achieve.
๐ Table of Contents
- Project Overview
- Technology Stack
- Architecture & Design
- Storage Engine Internals
- Core Features Deep Dive
- Folder Structure
- Getting Started / Deployment
- Configuration Reference
- C API Documentation
- Network API Documentation
- Data Types Mapping
- Query Language Syntax
- Security and Privacy
- Scalability Considerations
- Performance Tuning Guide
- Backup and Restore
- Hardware Requirements
- CI/CD Integration
- Error Codes Reference
- Testing Documentation
- Troubleshooting Guidance
- Contributor Information
- Licensing
- FAQs
๐ Project Overview
Project Name: Luminix Experience Platform
Project Type: Embedded Database System / Backend Data Engine
Industry Domain: Data Storage, IoT Edge Computing, High-Performance Microservices
Target Audience: Systems Engineers, Backend Developers, IoT Architects, Database Researchers
Primary Purpose: To provide a lightweight, blazingly fast, and ACID-compliant embedded database with native JSON document support, eliminating the overhead associated with large-scale commercial database runtimes.
Luminix bridges the gap between Relational Database Management Systems (RDBMS) and NoSQL Document Stores. By providing robust schema definitions via C-struct mapping while simultaneously supporting unstructured JSON documents, it serves as a versatile engine for polyglot persistence requirements.
๐ป Technology Stack
Luminix is built on a foundation of performance and portability.
- Core Engine: C99 (ANSI C) for maximum performance, deterministic memory footprint, and high portability.
- Compiler Support: GCC (MinGW-w64 on Windows), Clang, MSVC.
- Memory Management: Custom Memory Pool Allocator to prevent OS-level heap fragmentation.
- Indexing: Custom B-Tree, Hash Map, and Skip List implementations tailored for specific workload distributions.
- Query Parsing: Custom Recursive Descent SQL-like Parser for speed and safety.
- JSON I/O: Zero-copy custom JSON parser (
json_io.c). - Build System: GNU Make, PowerShell scripts.
- CLI: Interactive CLI shell built in C (
cli.c).
(Luminix utilizes zero external heavy dependencies. There is no bloated runtime, JVM, or GC. Just pure, standalone execution.)
๐๏ธ Architecture & Design
The Luminix Experience Platform is designed as a modular, monolithic kernel, built for high concurrency.
High-Level System Architecture
LANG: mermaidgraph TD; Client[Client Application / CLI / Network] -->|Query String / API Call| Parser[Query Parser]; Parser --> Planner[Query Optimizer & Planner]; Planner --> Exec[Execution Engine]; Exec --> TM[Transaction Manager]; TM --> LockMgr[Lock Manager]; TM --> WAL[Write-Ahead Log]; Exec --> IM[Index Manager]; IM --> BTree[B-Tree Indices]; IM --> Hash[Hash Indices]; IM --> SkipList[SkipList Indices]; Exec --> Storage[Storage Engine]; Storage --> MemPool[Buffer Pool Manager]; Storage --> DiskIO[Disk I/O Subsystem]; Exec --> JSON[JSON I/O Subsystem]; JSON --> DiskIO; DiskIO --> DataFiles[(Data Files / Database State)]; WAL --> DataFiles[(WAL Persistence)];
ACID Transaction Workflow
LANG: mermaidsequenceDiagram participant Client participant Parser participant TransMgr participant Storage participant BufferPool participant WAL Client->>Parser: BEGIN TRANSACTION Parser->>TransMgr: Start Tx TransMgr-->>Client: Tx ID 1001 Client->>Parser: INSERT INTO logs (level, msg) VALUES ('ERROR', 'Crash') Parser->>TransMgr: Acquire Write Lock (Row/Page) TransMgr->>Storage: Request Page Storage->>BufferPool: Fetch Page (Load if missing) BufferPool-->>TransMgr: In-Memory Page Ptr TransMgr->>WAL: Append LSN (Log Sequence Number) Write Intention TransMgr->>BufferPool: Modify Page (Mark Dirty) Parser-->>Client: Success Client->>Parser: COMMIT Parser->>TransMgr: Commit Tx TransMgr->>WAL: Fsync to Disk (Sync Durability) TransMgr->>TransMgr: Release Write Locks Parser-->>Client: Transaction Committed successfully
๐ฟ Storage Engine Internals
Understanding the underlying storage engine is crucial for performance tuning. Luminix uses a slotted-page architecture.
Page Layout
Luminix splits data files into fixed-size chunks called Pages (default is 8KB, configurable up to 64KB). Each Page consists of:
- Page Header (64 bytes): Contains LSN, Page ID, Free Space Pointer, Tuple Count, and checksums.
- Tuple Directory (Variable): An array of pointers (offsets) pointing to the tuples stored in the page.
- Free Space: The unallocated middle section of the page.
- Tuple Data: The actual row data growing from the bottom of the page upwards.
Write-Ahead Log (WAL)
We implement ARIES (Algorithm for Recovery and Isolation Exploiting Semantics).
- Every modification creates a log record containing a unique Log Sequence Number (LSN), the transaction ID, and the undo/redo image of the modified bytes.
- The WAL is appended sequentially, making writes incredibly fast on spinning disks and NVMe SSDs alike.
- Checkpoints are performed asynchronously to flush dirty pages to the main data files and truncate the WAL.
Index Structures
- B-Tree: The default index. High fan-out, optimized for minimizing disk I/O. Supports range scans (
WHERE age > 20). - Hash Index: Extremely fast O(1) lookups. Only supports equality constraints (
WHERE id = 500). Not persisted to disk by default (rebuilt on startup) to save I/O, though persistence can be enabled.
โญ Core Features Deep Dive
1. Robust Transaction Management (ACID)
Luminix employs a rigorous Transaction Manager (transaction.c) that ensures ACID properties.
- Atomicity: System crashes during a multi-row insert will result in a complete rollback upon recovery via the WAL.
- Consistency: Database constraints (types, unique indexes, foreign keys) are strictly enforced prior to tuple insertion.
- Isolation: Utilizing a Lock Manager, Luminix supports Read Committed and Serializable isolation levels, preventing dirty reads and phantom reads.
- Durability: By default, commits trigger an
fsync(), ensuring data survives immediate power loss.
2. Zero-Copy JSON Document I/O
The json_io.c subsystem allows for storing and querying deeply nested JSON objects natively. Instead of parsing the entire JSON string into memory trees (like standard libraries do), Luminix uses a custom lexer that tokenizes the JSON on the fly, storing it in a proprietary compressed binary format on disk (BSON-like). This allows the query engine to extract specific fields document.user.profile.age without deserializing the entire document.
3. High-Speed Configurable Indexing
Configurable indexing structures (index.c) adapt to the workload dynamically. Developers can specify CREATE INDEX idx_name ON table USING hash (col); to override the default B-Tree implementation.
4. Interactive CLI Shell
A fully functional Command Line Interface (cli.c) reminiscent of psql or sqlite3. It provides syntax highlighting, query history, and administration commands for monitoring database health in real-time.
5. Hot Backups and Snapshots
The backup.c module allows administrators to trigger consistent logical or physical backups while the database is actively receiving writes. It utilizes snapshot isolation to copy the database file at a specific LSN without locking out write operations.
6. Role-Based Access Control (RBAC) & Security
The security.c module manages users and roles. Privileges can be granted at the database, table, or column level.
๐ Folder Structure
The repository is structured to separate concerns entirely, allowing developers to read and understand the C code module by module.
LANG: textLuminix-ExperiencePlatform/ โ โโโ src/ # Core C Source Files โ โโโ main.c # Entry point, daemon management, CLI bootstrap โ โโโ database.c / .h # Core database logic, catalog management, schema structs โ โโโ query_engine.c / .h # Query execution plan, relational algebra logic โ โโโ transaction.c / .h # ACID transaction manager, lock tables, undo/redo logs โ โโโ index.c / .h # B-Tree, Hash, SkipList implementation algorithms โ โโโ json_io.c / .h # Native zero-copy JSON parsing, binary conversion โ โโโ parser.c / .h # Lexer and Recursive Descent SQL-like parser โ โโโ storage.c / .h # Disk I/O, Slotted-Page management, Buffer Pool โ โโโ security.c / .h # AES-256 Encryption wrappers, RBAC authentication โ โโโ export_import.c / .h # CSV, JSON, SQL dump data migration tools โ โโโ cli.c / .h # Interactive CLI shell, readline wrapper โ โโโ backup.c / .h # Snapshot logic, continuous archiving โ โโโ utils.c / .h # String manipulation, logging, hashing, time utilities โ โโโ types.h # Forward declarations and basic generic types โ โโโ luminix_types.h # Advanced system types, Error Codes, limits โ โโโ config.h # Compile-time engine configuration macros โ โโโ common.h # Shared standard library includes and global macros โ โโโ Makefile # Build script for MinGW/GCC / Linux โโโ build.ps1 # PowerShell build wrapper for Windows โโโ LICENSE # MIT License file โโโ database.json # Sample initial configuration payload โโโ Database.state.json # Internal state tracking (metadata) โโโ landing.html # Marketing and informational landing page UI โโโ link_verbose.txt # Internal linker/build logs and debugging output
๐ Getting Started / Deployment
Prerequisites
Ensure you have the following installed based on your operating system:
- Windows: MinGW-w64 (GCC) installed and added to your System PATH.
- Linux (Ubuntu/Debian):
sudo apt install build-essential - macOS:
xcode-select --install
Compiling from Source
Clone the repository to your local machine:
LANG: bashgit clone https://github.com/TheOrionGD/Luminix-ExperiencePlatform.git cd Luminix-ExperiencePlatform
For Linux / macOS / Windows with MinGW:
LANG: bash# Build the core executable with all optimizations enabled make all # Expected Output: # gcc -I./include -I./src -O3 -Wall -Wextra -c src/main.c -o src/main.o # gcc -I./include -I./src -O3 -Wall -Wextra -c src/database.c -o src/database.o # ... # gcc src/main.o src/database.o ... -o luminix.exe
For Windows via PowerShell:
LANG: powershell# Run the included build script .\build.ps1
Running the Engine
You can start Luminix in two primary modes:
1. Interactive CLI Mode This mode opens a shell where you can execute queries directly.
LANG: bash./luminix.exe
Prompt will appear as: luminix>
2. Daemon (Background Server) Mode This mode starts the TCP listener and accepts network connections from applications.
LANG: bash./luminix.exe --daemon --port 8080 --data-dir ./luminix_data --config ./luminix.conf
Docker Deployment
For containerized environments, create a standard Dockerfile:
LANG: dockerfileFROM alpine:latest AS builder RUN apk add --no-cache gcc make musl-dev WORKDIR /app COPY . . RUN make all FROM alpine:latest WORKDIR /app COPY --from=builder /app/luminix.exe . EXPOSE 8080 CMD ["./luminix.exe", "--daemon", "--port", "8080"]
Build and run:
LANG: bashdocker build -t luminix-engine . docker run -d -p 8080:8080 -v /my/host/data:/app/data luminix-engine
โ๏ธ Configuration Reference
Luminix reads a luminix.conf file at startup. If omitted, default values are used. Below is an exhaustive list of configuration parameters.
[storage]
data_directory: (String) Path to store database files. Default:./datacache_size_mb: (Integer) Maximum RAM to allocate for the Buffer Pool. Default:256page_size: (Integer) Size of a storage page in bytes. Valid values: 4096, 8192, 16384. Default:8192sync_on_commit: (Boolean) If true, calls fsync() on every transaction commit. If false, relies on OS caching (faster but risks data loss on power failure). Default:true
[wal]
wal_enabled: (Boolean) Enable or disable the Write-Ahead Log. Default:truewal_max_size_mb: (Integer) Maximum size of a single WAL file before rotation. Default:64checkpoint_interval_ms: (Integer) How often to checkpoint the WAL to disk. Default:60000
[network]
bind_address: (String) IP address to bind to. Use0.0.0.0for all interfaces. Default:127.0.0.1port: (Integer) TCP Port for client connections. Default:8080max_connections: (Integer) Maximum concurrent client connections. Default:1000timeout_ms: (Integer) Network read/write timeout in milliseconds. Default:5000
[indexing]
default_index_type: (String) Choose betweenbtree,hash, orskiplist. Default:btreeauto_index_primary_keys: (Boolean) Automatically create indexes on primary key columns. Default:true
[security]
require_auth: (Boolean) If true, clients must authenticate. Default:falseencryption_at_rest: (Boolean) Enable AES-256 encryption for data files. Default:falseencryption_key_path: (String) Path to the 256-bit AES key file.
๐ฅ๏ธ C API Documentation
Luminix can be embedded directly into other C/C++ applications, bypassing the network stack entirely for microsecond latency.
Core Lifecycle Methods
Initialize the Engine
LANG: c#include "database.h" // Initialize database instance. Mode can be DB_MODE_RW or DB_MODE_RO (Read Only) Database* db = db_init("./luminix_data", DB_MODE_RW); if (db == NULL) { fprintf(stderr, "Failed to initialize Luminix engine.\n"); exit(1); }
Execute a Query
LANG: c#include "query_engine.h" const char* query = "SELECT id, username, is_active FROM users WHERE age >= 18"; QueryResult* result = execute_query(db, query); if (result->status == ERROR_NONE) { printf("Found %d rows.\n", result->row_count); for (int i = 0; i < result->row_count; i++) { int id = result->rows[i].fields[0].int_val; const char* username = result->rows[i].fields[1].str_val; bool is_active = result->rows[i].fields[2].bool_val; printf("ID: %d | User: %s | Active: %d\n", id, username, is_active); } } else { printf("Query failed with error code: %d\n", result->status); } // Memory must be freed by the caller free_query_result(result);
Transaction Management
LANG: c#include "transaction.h" Transaction* tx = tx_begin(db, TX_ISOLATION_SERIALIZABLE); execute_query_tx(tx, "UPDATE accounts SET balance = balance - 100 WHERE id = 1"); execute_query_tx(tx, "UPDATE accounts SET balance = balance + 100 WHERE id = 2"); if (tx->status == ERROR_NONE) { tx_commit(tx); } else { tx_rollback(tx); }
Cleanup
LANG: cdb_close(db); // Flushes all pending writes and cleanly unmounts files
๐ Network API Documentation
When running in Daemon mode, Luminix accepts raw TCP connections passing JSON payloads. This makes it trivial to write drivers in Python, Node.js, Rust, etc.
Authentication Endpoint
Before executing queries on a secured server, you must authenticate.
Request:
LANG: json{ "action": "auth", "username": "admin", "password": "supersecretpassword" }
Response:
LANG: json{ "status": "success", "auth_token": "luminix_tk_9876543210abcdef", "expires_in": 3600 }
Query Endpoint
Request:
LANG: json{ "action": "query", "auth_token": "luminix_tk_9876543210abcdef", "query": "INSERT INTO system_logs (level, message, metadata) VALUES ('ERROR', 'Timeout occurred', '{\"retry\": true, \"count\": 3}')" }
Response:
LANG: json{ "status": "success", "affected_rows": 1, "execution_time_ms": 0.12, "result_set": [] }
Driver Example (Node.js Mockup)
LANG: javascriptconst net = require('net'); const client = new net.Socket(); client.connect(8080, '127.0.0.1', () => { const payload = JSON.stringify({ action: "query", query: "SELECT * FROM users" }); client.write(payload + "\n"); }); client.on('data', (data) => { console.log('Received: ' + data); client.destroy(); });
๐ Data Types Mapping
Luminix strongly types data to optimize memory layouts.
| SQL Type | Internal C Type | Size (Bytes) | Description |
|---|---|---|---|
INT | int32_t | 4 | Standard 32-bit integer |
BIGINT | int64_t | 8 | 64-bit integer |
FLOAT | double | 8 | Double precision floating point |
STRING | char[] | Variable | Null-terminated string (Max defined in MAX_STRING_LEN) |
BOOL | uint8_t | 1 | Boolean (0 or 1) |
DATETIME | uint64_t | 8 | Unix Epoch timestamp in milliseconds |
JSON | uint8_t[] | Variable | Compressed binary BSON representation |
BINARY | uint8_t[] | Variable | Raw binary blob for files or images |
๐ Query Language Syntax
Luminix uses a subset of standard SQL combined with document-querying notation.
Data Definition Language (DDL)
LANG: sqlCREATE TABLE users ( id INT PRIMARY KEY, username STRING UNIQUE, created_at DATETIME, preferences JSON ); CREATE INDEX idx_user_created ON users USING btree (created_at);
Data Manipulation Language (DML)
LANG: sqlINSERT INTO users (id, username, created_at, preferences) VALUES (1, 'john_doe', '2026-06-06T10:00:00', '{"theme": "dark", "notifications": true}'); UPDATE users SET username = 'john_doe_updated' WHERE id = 1; DELETE FROM users WHERE id = 1;
JSON Path Expressions
You can query deeply nested JSON structures using dot notation inside strings, or direct field access if configured.
LANG: sqlSELECT preferences.theme FROM users WHERE preferences.notifications = true;
๐ Security and Privacy
Security is a first-class citizen in Luminix. We implement defenses at multiple layers to ensure your data remains protected from unauthorized access or memory-based exploits.
1. Data at Rest Encryption
The storage engine supports transparent page-level encryption using AES-256-GCM. When encryption_at_rest is enabled, all data written to disk (including the WAL) is encrypted. Data is only decrypted inside the volatile Buffer Pool memory. If the physical server is compromised or hard drives are stolen, the data remains unreadable.
2. Role-Based Access Control (RBAC)
User permissions are strictly enforced at the query parsing layer (security.c).
- Admin: Full access, schema modification (DDL), user management.
- Read-Write: DML operations only (INSERT, UPDATE, DELETE).
- Read-Only: SELECT queries only.
- Table-Level Restrictions: Users can be restricted to specific tables.
3. Memory Safety Protocols
Buffer overflows and memory leaks are common vectors in C applications. Luminix mitigates this by:
- Utilizing strict bounds checking defined in
luminix_types.h(e.g.,MAX_STRING_LEN). - A custom memory arena that zeroes out memory (
memset(ptr, 0, size)) upon release to prevent data remanence and heap snooping. - Eliminating standard library functions prone to overflows (e.g.,
strcpy,sprintf), replacing them with secure bounds-checked equivalents (strncpy,snprintf).
๐ Scalability Considerations
Luminix is designed to scale vertically on multi-core systems.
Concurrency Model
Luminix uses a thread-per-connection model managed by a dynamic thread pool (threading.h). Locks are extremely granular. Instead of locking an entire table during a write, Luminix acquires locks at the Page Level or Row Level, minimizing contention between threads.
MVCC (Multi-Version Concurrency Control)
To maximize read throughput, Luminix implements MVCC. When a row is updated, a new version of the row is created rather than overwriting the old one immediately. This means that Read queries do not block Write operations, and Write operations do not block Read operations.
Theoretical Limits
Because of its C99 architecture and pointer math optimizations, the theoretical limits of Luminix on a 64-bit architecture are massive:
- Maximum Database Size: 64 Exabytes (Assuming 64-bit page pointers and 8KB pages).
- Maximum Table Size: 4 Terabytes per table file.
- Maximum Concurrent Connections: Bound entirely by the Operating System's file descriptor limits (e.g.,
ulimit -non Linux). - Maximum Row Size: Limited to the Page Size (e.g., 8192 bytes) minus header overhead. Larger JSON documents are automatically chained across multiple pages (Overflow Pages).
๐ Performance Tuning Guide
To get the absolute maximum performance out of Luminix:
- Buffer Pool Sizing: Set
cache_size_mbinluminix.confto approximately 75% of your available system RAM. This ensures that the majority of reads hit memory instead of the disk. - WAL Synchronization: If you are running a cache layer where immediate durability is not critical, set
sync_on_commit = false. This dramatically increases write throughput (from ~2,000 TPS to >100,000 TPS) by batching fsync operations. - Index Selection:
- Use
hashindexes for columns that only require exact matches (e.g., UUIDs, Session IDs). - Use
btreeindexes for columns queried with ranges (>,<,BETWEEN).
- Use
- Connection Pooling: Use an external connection pooler (or maintain persistent TCP connections) rather than opening and closing connections for every query.
๐ฆ Backup and Restore
Luminix supports hot backups without taking the database offline.
Create a Logical Dump
Creates a .sql file containing all schemas and insert statements.
LANG: bash./luminix.exe --dump ./backup_file.sql
Physical Snapshot
Copies the raw binary data files safely using the WAL to ensure consistency.
LANG: bash./luminix.exe --snapshot ./snapshots/2026-06-06
Restore Database
LANG: bash./luminix.exe --restore ./snapshots/2026-06-06
๐ป Hardware Requirements
Luminix is extremely lightweight. It can run on high-performance servers or tiny IoT edge devices.
Minimum (IoT / Edge):
- CPU: Single-core ARM Cortex-M or x86 (100 MHz)
- RAM: 16 MB
- Disk: 50 MB available space
Recommended (Microservices / Web Backend):
- CPU: 2+ cores (x86_64 or ARM64)
- RAM: 1 GB+
- Disk: NVMe SSD (Crucial for WAL performance)
Production (High Throughput Analytics):
- CPU: 16+ cores
- RAM: 32 GB+ (To fit the entire database in the Buffer Pool)
- Disk: RAID 10 NVMe Storage Arrays
๐ CI/CD Integration
You can integrate Luminix into your automated pipelines. Example GitHub Actions workflow (.github/workflows/c-cpp.yml):
LANG: yamlname: Build and Test Luminix on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install dependencies run: sudo apt-get install -y build-essential valgrind - name: Compile Database run: make all - name: Run Unit Tests run: make test - name: Memory Leak Check run: valgrind --leak-check=full --error-exitcode=1 ./luminix.exe --test-suite
๐ Error Codes Reference
When calling the C API or Network API, errors map to specific conditions.
| Code | Macro | Description |
|---|---|---|
0 | ERROR_NONE | Success. |
1 | ERROR_MEMORY | Out of memory (malloc failed or Buffer Pool full). |
2 | ERROR_IO | Disk read/write failure. Check permissions/space. |
3 | ERROR_SYNTAX | SQL Parser encountered malformed syntax. |
4 | ERROR_NOT_FOUND | Table, column, or record does not exist. |
5 | ERROR_DUPLICATE | Primary key or unique constraint violation. |
6 | ERROR_CONSTRAINT | Foreign key or NOT NULL constraint failed. |
7 | ERROR_TYPE_MISMATCH | Inserted value type doesn't match schema. |
8 | ERROR_PERMISSION | User lacks RBAC privilege for this operation. |
9 | ERROR_TIMEOUT | Network or lock timeout exceeded. |
10 | ERROR_CORRUPT | Disk page checksum mismatch. Check hardware. |
12 | ERROR_LOCKED | Deadlock detected or resource held exclusively. |
๐งช Testing Documentation
Quality assurance is integral to the Luminix development lifecycle. We refuse to compromise on data integrity.
Unit Testing
We use a custom lightweight C testing framework located in test.i and test.s.
To run the quick test suite:
LANG: bashmake test
This suite verifies B-Tree node splitting, memory allocator boundary limits, and fundamental math operations.
Integration Testing
The integration tests cover:
- High-concurrency transaction stress tests (spawning 500 threads writing simultaneously).
- Simulated crash recovery (killing the process mid-write via
SIGKILLand verifying the WAL replays missing transactions successfully upon reboot). - Huge JSON payload parsing validations (ingesting 50MB JSON files to test overflow paging).
Fuzz Testing (AFL++)
We employ AFL++ (American Fuzzy Lop) to fuzz the query parser (parser.c) and JSON ingress (json_io.c). Millions of malformed, mutated inputs are fed into the system continuously on our CI servers to ensure the engine does not segmentation fault under malicious input.
Memory Leak Checking
All code merged into the main branch must pass valgrind without a single byte of leaked memory.
LANG: bashvalgrind --leak-check=full ./luminix.exe --test-suite
๐ง Troubleshooting Guidance
Common Issues and Resolutions
1. Compilation Fails with Missing header: <stdatomic.h>
- Symptoms: Build fails immediately on
transaction.corindex.c. - Cause: You are using an outdated C compiler that does not support C11 atomics, which are required for the lock manager's lock-free structures.
- Resolution: Upgrade GCC to version 4.9 or higher. On Windows, ensure you are using the latest MSYS2 MinGW-w64 toolchain.
2. Database Engine Returns ERROR_LOCKED (12)
- Symptoms: Client queries hang and then return error code 12.
- Cause: A transaction has been open too long holding a write lock, causing a deadlock or timeout.
- Resolution: Ensure all client applications issue
COMMITorROLLBACKpromptly. Do not hold transactions open while waiting for user input or external API calls. Use the CLISHOW LOCKScommand to identify the offending transaction ID.
3. Performance Degradation over Time
- Symptoms: Range queries slow down significantly over weeks of uptime.
- Cause: Index fragmentation due to heavy
DELETEandUPDATEoperations leaving dead tuples and sparsely populated B-Tree nodes. - Resolution: Run the
VACUUMcommand via the CLI to rebuild the B-Trees, compact the data files, and reclaim lost page space.
4. ERROR_CORRUPT (10) on Startup
- Symptoms: The engine refuses to start and logs a corruption error.
- Cause: The state files or WAL were tampered with externally, a disk failure occurred, or bit-rot affected the checksums.
- Resolution: Luminix will automatically attempt WAL recovery. If that fails, you must restore from the latest snapshot using the backup tool:
./luminix.exe --restore /path/to/backup.
5. High CPU Usage during JSON Ingestion
- Symptoms: CPU spikes to 100% when inserting JSON documents.
- Cause: The JSON documents are too deeply nested, exceeding the parser's optimal stack depth, causing it to fallback to heap-based recursive parsing.
- Resolution: Flatten your JSON structures where possible, or increase
max_json_depthinluminix.conf.
๐ค Contributor Information
We welcome contributions from the community! Whether it's bug reports, documentation improvements, or core engine patches, your help is appreciated.
How to Contribute
- Fork the repository on GitHub.
- Clone your fork locally.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Code: Adhere strictly to our C Coding Standard:
- No tabs, use 4 spaces.
- Snake_case for variables and functions (
my_variable,execute_query). - PascalCase for Structs (
Database,QueryResult). - Extensive comments explaining why pointer arithmetic is doing what it's doing.
- Test: Ensure all unit tests pass (
make test) and run valgrind. - Submit a Pull Request with a detailed description of the changes.
Code of Conduct
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. Let's build a welcoming, respectful, and inspiring engineering community. Harassment of any kind will not be tolerated.
๐ Licensing
Luminix Experience Platform is released under the MIT License.
You are free to use, modify, distribute, and commercialize this software, provided you include the original copyright notice.
โ FAQs
Q: Is Luminix a replacement for PostgreSQL or MySQL? A: No. Luminix is designed for embedded environments, edge devices, or highly specialized microservices where installing a full RDBMS is overkill. It lacks advanced features like materialized views, stored procedures, or window functions. It excels in low-latency, zero-dependency environments.
Q: How does it handle unstructured data?
A: Through the json_io subsystem, you can store native JSON blobs. You can query these blobs using dot-notation within the SQL-like query language (e.g., SELECT metadata.user.id FROM logs).
Q: Does it support clustering or High Availability? A: Currently, Luminix operates as a single-node embedded system. Distributed consensus (Raft protocol implementation) is planned for the Future Roadmap. For now, you must manage replication at the application layer.
Q: Can I use it in production? A: While highly optimized, it is currently in active development. We recommend rigorous testing against your specific workload before deploying to mission-critical production environments.
Q: What happens if the server loses power during a write? A: Thanks to the Write-Ahead Log (WAL), incomplete transactions will be rolled back upon server restart. Committed transactions that hit the WAL before the crash will be successfully replayed and persisted.
Q: Why use C instead of Rust or C++? A: We wanted to build an engine with zero hidden abstractions. C provides the ultimate control over memory layout, deterministic execution paths, and compiler optimizations. It also allows Luminix to be compiled for incredibly obscure IoT architectures where Rust/C++ toolchains might not be available or mature.
Q: Can I write plugins for Luminix? A: Not dynamically via shared libraries (yet). To add custom functions, you must modify the source code and recompile.
Q: Is there a graphical user interface (GUI)? A: No official GUI exists, but the Network API makes it trivial to build a web-based dashboard or desktop application to interface with the daemon.
Q: How do you handle schema migrations?
A: We currently support simple ALTER TABLE statements for adding columns. More complex migrations (changing data types) require table recreation and data copying.
Q: What is the maximum size of a JSON document? A: The hard limit is defined by the page size and overflow chaining mechanism, but practically, JSON documents up to 16MB are extremely performant.
Luminix Team. INNOVATE BUILD IMPACT