ChiselStore is an embeddable, distributed SQLite for Rust, powered by Little Raft.

Overview

ChiselStore

Rust MIT licensed

ChiselStore is an embeddable, distributed SQLite for Rust, powered by Little Raft.

SQLite is a fast and compact relational database management system, but it is limited to single-node configurations. ChiselStore extends SQLite to run on a cluster of machines with the Raft consensus algorithm. With ChiselStore, you get the benefits of easy-to-use, embeddable SQLite but with Raft's high availability and fault tolerance.

Features

  • SQLite with Raft's high availability and fault tolerance
  • Strong consistency with optional relaxed reads
  • Embeddable Rust library

Roadmap

  • Efficient node restarts (with Raft snapshots)
  • Dynamic cluster membership (with Raft joint consensus)
  • Support executing non-deterministic SQL functions

Getting Started

See the example server of how to use the ChiselStore library.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ChiselStore by you, shall be licensed as MIT, without any additional terms or conditions.

Comments
  • Optimize reads

    Optimize reads

    Currently, ChiselStore performs reads using the Raft consensus protocol -- just like writes -- which provides strong consistency. However, strong consistency also makes reads pretty expensive. One way to optimize reads is to provide a "local read" option, which performs reads on any node. The "local read" option relaxes the consistency model by allowing stale reads in exchange for higher performance.

    enhancement performance 
    opened by penberg 1
  • Reject or restart client requests on leader changes

    Reject or restart client requests on leader changes

    If we have registered a pending transition on the leader, but there's a leader change, the the client request has to either be rejected or restarted.

    To fix this, we need a new Abandoned transition state in Little Raft:

    https://github.com/andreev-io/little-raft/issues/13

    bug help wanted 
    opened by penberg 0
  • Connection pooling

    Connection pooling

    Implements connection pooling so that we don't have to open a new connectio with every request. Benchmark won't even complete without this for very high QPS scenarios for strong consistency.

    opened by glommer 0
  • Connection pool

    Connection pool

    Add connection pooling for queries to avoid every thread hammering the same connection. Note that we should switch to the "memdb" VFS of sqlite. Unfortunately the driver we're currently using does not support that so let's use a file-backed database instead.

    opened by penberg 0
  • Wait for leader only for strong consistency

    Wait for leader only for strong consistency

    Relaxed reads don't require leader to be present because we're reading from the local replica and accept stale reads. Therefore, wait for the leader only when strong consistency is needed.

    opened by penberg 0
  • Fix missed wakeup on transition apply

    Fix missed wakeup on transition apply

    Fix a race condition where Little Raft applies a transition before we register a command completion.

    Co-authored-by: Pekka Enberg [email protected] Co-authored-by: Glauber Costa [email protected]

    opened by penberg 0
  • Improve clippy lints

    Improve clippy lints

    @glommer suggests:

    Pekka, please add a variation of #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] to the top-level lib file so we make sure that all public interfaces have Debug, documentation, etc (likely you will want to enforce 2021 idioms)

    enhancement 
    opened by penberg 0
  • Move gRPC to core

    Move gRPC to core

    As suggested by @glommer, let's move gRPC to core to make it easier for users to embed ChiselStore out-of-the-box. Users can, of course, also implement the necessary traits themselves if they don't want to use gRPC.

    opened by penberg 0
  • Fix state machine resource leak

    Fix state machine resource leak

    The apply_transition() function is executed on all state machines, but clients connect only to the leader. We can, therefore, only insert results for consumption on a leader. On followers, there is nobody consuming them, which results in a slow but sure resource leak.

    opened by penberg 0
  • Example server fails to start

    Example server fails to start

    When attempting to start the example server, I trip over:

    penberg@vonneumann chiselstore % cargo run --example gouged -- --id 1 --peers 2 3
        Updating crates.io index
       Compiling event-listener v2.5.3
       Compiling chiselstore v0.1.0 (/Users/penberg/src/chiselstrike/chiselstore/core)
       Compiling async-mutex v1.4.0
        Finished dev [unoptimized + debuginfo] target(s) in 6.63s
         Running `target/debug/examples/gouged --id 1 --peers 2 3`
    RPC listening to 127.0.0.1:50001 ...
    thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })))', core/src/rpc.rs:55:52
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })))', core/src/rpc.rs:55:52
    

    I bisected the problem to 75ec0c75950499a91ef5dffcdc368cdc67924e38

    bug 
    opened by penberg 2
  • SQLite transaction dead-lock

    SQLite transaction dead-lock

    We currently let SQL transaction commands to replicate, which can result in a dead-lock.

    For example, if a writer issues a BEGIN TRANSACTION command, but dies after it has replicated, the cluster is in a situation where all nodes have an active transaction, but there's now writer to commit or roll back.

    bug 
    opened by penberg 1
  • I/O errors should crash the process

    I/O errors should crash the process

    If we have an I/O error, we must not resume completion, but instead crash the process so that node with partial results does not continue in the same Raft cluster.

    bug 
    opened by penberg 0
  • Read-your-writes consistency guarantee for relaxed reads

    Read-your-writes consistency guarantee for relaxed reads

    With relaxed reads, there's currently no guarantee on read-your-write consistency. This is because a write will be acknowledged when the write is applied to the state machine of the leader, but not on the local replica.

    Example:

    • A follower node F receives a write request, which is delegated to node L, which is the leader.
    • The write is replicated to the logs of all nodes (but not necessarily applied).
    • The write is applied to the state machine of L.
    • L acknowledges the write to F and F acknowledges the write to the client.
    • A relaxed read request arrives on node F, which does not yet have the write applied to its state machine, violating read-your-writes consistency.
    bug 
    opened by penberg 0
Owner
null
Mycelite is a SQLite extension that allows you to synchronize changes from one instance of SQLite to another.

Mycelite What is Mycelite? Mycelite is a SQLite extension that allows you to synchronize changes from one instance of SQLite to another. Currently, it

Mycelial 16 Jan 2, 2023
Distributed, MVCC SQLite that runs on FoundationDB.

mvSQLite Distributed, MVCC SQLite that runs on top of FoundationDB. Documentation mvSQLite Features Releases Quick reference Try it Contributing Featu

Heyang Zhou 1.1k Jul 3, 2023
open source training courses about distributed database and distributed systemes

Welcome to learn Talent Plan Courses! Talent Plan is an open source training program initiated by PingCAP. It aims to create or combine some open sour

PingCAP 8.3k Dec 30, 2022
Another minimal Raft implementation in Rust.

raft-rs Not my first time implementing Raft. I wrote about another implementation in Go I did. But you don't learn a concept well until you've impleme

Phil Eaton 43 Dec 15, 2023
A raft framework, for regular people

RmqttRaft - A raft framework, for regular people This is an attempt to create a layer on top of tikv/raft-rs, that is easier to use and implement. Thi

null 16 Dec 21, 2022
AgateDB is an embeddable, persistent and fast key-value (KV) database written in pure Rust

AgateDB is an embeddable, persistent and fast key-value (KV) database written in pure Rust. It is designed as an experimental engine for the TiKV project, and will bring aggressive optimizations for TiKV specifically.

TiKV Project 535 Jan 9, 2023
Pure rust embeddable key-value store database.

MHdb is a pure Rust database implementation, based on dbm. See crate documentation. Changelog v1.0.3 Update Cargo.toml v1.0.2 Update Cargo.toml v1.0.1

Magnus Hirth 7 Dec 10, 2022
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 7.6k Dec 31, 2022
Ergonomic bindings to SQLite for Rust

Rusqlite Rusqlite is an ergonomic wrapper for using SQLite from Rust. It attempts to expose an interface similar to rust-postgres. use rusqlite::{para

Rusqlite 1.9k Jan 5, 2023
SQLite clone from scratch in Rust

Rust-SQLite (SQLRite) Rust-SQLite, aka SQLRite , is a simple embedded database modeled off SQLite, but developed with Rust. The goal is get a better u

João Henrique Machado Silva 952 Jan 5, 2023
Provides a Rust-based SQLite extension for using Hypercore as the VFS for your databases.

SQLite and Hypercore A Rust library providing SQLite with an virtual file system to enable Hypercore as a means of storage. Contributing The primary r

Jacky Alciné 14 Dec 5, 2022
cogo rust coroutine database driver (Mysql,Postgres,Sqlite)

cdbc Coroutine Database driver Connectivity.based on cogo High concurrency,based on coroutine No Future<'q,Output=*>,No async fn, No .await , no Poll*

co-rs 10 Nov 13, 2022
Rusqlite is an ergonomic wrapper for using SQLite from Rust

Rusqlite Rusqlite is an ergonomic wrapper for using SQLite from Rust. It attempts to expose an interface similar to rust-postgres. use rusqlite::{para

Rusqlite 1.9k Jan 7, 2023
Build SQLite virtual file systems (VFS) by implementing a simple Rust trait.

sqlite-vfs Build SQLite virtual file systems (VFS) by implementing a simple Rust trait. Documentation | Example This library is build for my own use-c

Markus Ast 56 Dec 19, 2022
A Rust-based comment server using SQLite and an intuitive REST API.

soudan A Rust-based comment server using SQLite and an intuitive REST API. Soudan is built with simplicity and static sites in mind. CLI usage See sou

Elnu 0 Dec 19, 2022
Using embedded database modeled off SQLite - in Rust

Rust-SQLite (SQLRite) Rust-SQLite, aka SQLRite , is a simple embedded database modeled off SQLite, but developed with Rust. The goal is get a better u

Hand of Midas 3 May 19, 2023
SQLite-based on-disk cache for Rust.

sqlite-cache SQLite-based on-disk cache for Rust. Usage let cache = Cache::new( CacheConfig::default(), rusqlite::Connection::open_in_memory()

Heyang Zhou 21 Jun 1, 2023
Query is a Rust server for your remote SQLite databases and a CLI to manage them.

Query Query is a Rust server for your remote SQLite databases and a CLI to manage them. Table Of Contents Run A Query Server CLI Install Use The Insta

Víctor García 6 Oct 6, 2023
Simple and handy btrfs snapshoting tool. Supports unattended snapshots, tracking, restoring, automatic cleanup and more. Backed with SQLite.

Description Simple and handy btrfs snapshoting tool. Supports unattended snapshots, tracking, restoring, automatic cleanup and more. Backed with SQLit

Eduard Tolosa 27 Nov 22, 2022