🔬 What's Novel
- Integration of optimistic concurrency with pluggable Wasm merge semantics in a database engine
- WebAssembly-based secure merge function execution with minimal capability model
- Formalization of conflict detection using dependency tracking + MVCC versions
- Bridge between traditional database consistency and offline-first CRDT architectures
🔧 Technical Approach
Phase 1 — Conflict Model
Formalize conflict detection using MVCC + dependency tracking. Model write-write conflicts on same key, read-write dependency violations, and constraint violations as distinct conflict types.
Phase 2 — Merge API
SkeinQL extensions for per-table default merge, per-column merge, and type-specific merge (counters, sets, text). Merge functions receive conflicting versions and produce a resolved version.
Phase 3 — Wasm Integration
Execute merge functions in WebAssembly sandbox with minimal capabilities: read conflicting values and produce output only. No side effects, deterministic execution, bounded time.
Phase 4 — Offline Support
Client-side SDK queuing writes during offline periods. Each write includes expected ETag. On reconnection, the server detects conflicts and invokes registered merge functions.
🧪 Hypotheses
Many real-world write conflicts can be resolved automatically by domain-semantic merge functions without user intervention.
Dependency tracking can identify conflicting writes and invoke merge functions without application-level conflict detection logic.
Wasm merge functions provide sufficient expressiveness for real-world conflict resolution while maintaining security isolation.
🔗 SkeinDB Integration
📚 Key References
- Shapiro et al. — "Conflict-free Replicated Data Types" (2011)
- Kleppmann & Beresford — "A Conflict-Free Replicated JSON Datatype (Automerge)" (2017)
- DeCandia et al. — "Dynamo: Amazon's Highly Available Key-Value Store" (2007)