0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-05-22 21:48:12 +00:00

30729 Commits

Author SHA1 Message Date
2be18a8e0f feature in one commit 2024-07-15 21:08:14 +04:00
bbf49a2199 fix comment 2024-07-15 18:23:52 +04:00
c9b8a07d42 add isInitialized flag to the BlobSpot 2024-07-15 18:22:37 +04:00
a532866472 build bundles 2024-07-15 16:58:11 +04:00
1b623c01bb slightly change interface for BlobSpot 2024-07-15 16:56:19 +04:00
b97e365bb2 build bundles 2024-07-15 12:14:47 +04:00
4d3432736b add const to the signatures 2024-07-15 12:09:34 +04:00
6834c25c2e fix bundle 2024-07-15 01:21:15 +04:00
088ac4dd4c build bundles 2024-07-12 17:13:47 +04:00
b7026f528d remove changes from another branch 2024-07-12 17:11:51 +04:00
156cc67ad0 diskann vector binary format 2024-07-12 16:55:34 +04:00
4b21878187 add benchmark scripts ()
* add benchmark scripts

* remove unnecessary srand
2024-07-12 10:04:59 +00:00
6122f5e5b7 bump sqld v0.24.17 () libsql-server-v0.24.17 2024-07-12 07:32:22 +00:00
f563a741ca Improve local cache and prefer local reads ()
* update WIP list

* prefer local max_frame_no

this assumes that cache is always up to date and uses that instead
of calling the storage server. later we will add replication and make
sure that cache is upto date.

* Prefer local reads and also save page versions locally

Let's store `page_no` along with the `frame_no`. And then while reading,
we will do a range read, read frame which is less than txn's
`max_frame_no`

* minor improvements: index creation, fix max_frame_num query

* update local cache on inserts

* avoid unnecessary call to ss in `find_frame`

* remove unused `get_frame`

* eliminiate all calls to storage server during read path
2024-07-12 06:39:37 +00:00
784d9f972a release libsql v0.5.0-alpha.2 () libsql-rs-v0.5.0-alpha.2 2024-07-11 21:40:29 +00:00
cd69518bf1 libsql: add batched rows for local conn ()
* libsql: add batched rows for local conn

* continue impl

* Fix local batched rows test

* remove dbg

* fix feature flag
2024-07-11 20:16:51 +00:00
2418d55777 introduce checkpointer ()
* introduce checkpointer

* implement PerformCheckpoint for WalRegistry

* fmt
2024-07-11 12:54:55 +00:00
96a977862d libsql wal refactors ()
* introduce IoBuf::map_slice

* rename db_size to size_after

* introduce Segment trait

* implement Segment for Arc<T>

* make SealedSegment clone

* implement Segment for SealedSegment

* rename bottomless to storage

- introduce `Storage` trait
- rename old `Storage` to `Backend`
- introduce `AsyncStorage` (former bottomless)

* add Storage to WalRegistry

remove namespace resolver from registry

* add async_get to registry

* decouple shared wal from registry

* move CompactedSegment headers to own module

* refactor SegmentList

* add durable frame_no to shared_wal

* make shared_wal checkpoint async

* expose TestEnv

create test environment for libsql-wal

* ignore dead_code

stuff still need to be wired

* let LibsqlWalManager resolve namespace name

* fix tests

* fix libsql-server

* fmt

* fix bench

* fix conflicts

* fmt
2024-07-10 13:20:01 +00:00
25cc52fbd2 wal: add basic s3 implementation ()
* wal: add basic s3 implementation

* add basic s3 test

* add more test/clean up error

* complete file downloading
2024-07-10 10:53:17 +00:00
a69b6772c2 server: add replica frame counter test check () 2024-07-10 10:03:10 +00:00
15dca45139 Make PRAGMA synchronous configurable for a Namespace ()
* Make PRAGMA synchronous configurable for a Namespace

SQLite allows setting synchronous values to any four levels. This
patch provides an option to set the level for a namespace which will
be used for every connection. It defaults to `NORMAL`.

allowed values: https://www.sqlite.org/pragma.html#pragma_synchronous

e.g. to enable:

    curl -X POST http://sqld-admin-endpoint/v1/namespaces/<namespace>/config -H "Content-Type: application/json" -d '{"durability_mode": "strong"}' -v

* Make `durability_mode` field optional in proto

* Set `default` in the enum

Co-authored-by: ad hoc <postma.marin@protonmail.com>

---------

Co-authored-by: ad hoc <postma.marin@protonmail.com>
2024-07-10 09:34:29 +00:00
ebf9e0f504 fix bad autocommit ()
* add test

* fix bug when updating autocommit status in write proxy

* fmt
2024-07-09 18:06:57 +00:00
aaf42e3f29 cancel previous running actions if new commits are pushed ()
* cancel previous running actions if new commits are pushed

* cancel-in-progress for rust tests

* cancel-in-progress for c-bindings workflow

* cancel-in-progress for test GitHub actions
2024-07-09 13:06:24 +00:00
be1fca578f feat(vector): add basic functions (vector/vector_extract etc) ()
* add basic functions for working with f32/f64 vectors

* add header file

* fix comment style

* add generic code for working with vectors

* register vector functions

* fix edge cases in vector extract impl

* add static flag for vector (will be used later)

* add basic TCL-based tests

* guard vector functions with SQLITE_OMIT_VECTOR

* adjust build scripts

* delete libsql_vector_idx from this branch

* add one more test

* update bundles

* fix asserts

* fix constants (#define-s are universal but const int doesn't recognized by all compilers)

* update bundles

* review fixes

* build bundles

* add comment about linking math library
2024-07-08 08:27:33 +00:00
2402249b5d apply alter column command only to the table ()
* add alter column test

* apply alter column only to the table and ignore indices/triggers/views etc

* fix tests

* update bundle

* add test in rust_suite
2024-07-04 19:48:33 +00:00
7f731b8b70 sealed segment replicator ()
* segment list stream frames

* current segment replicator refactor

* impl Replicator::stream_frames

* test snapshots

* fmt
2024-07-03 13:31:58 +00:00
b17b6ee0d4 adjust ALTER COLUMN parsing ()
* add basic TCL tests for ALTER COLUMN libsql feature

* propagate length of the new column definition directly from the parser

- this will allow libsql to automatically handle comment and space characters appended to the column definition

* small formatting fixes

* cargo xtask build-bundled

* add test against sqlite3 source in rust_suite

* fix test in rust_suite
2024-07-02 22:02:14 +00:00
b988125ec0 fix: prevent incorrect range queries when searching for a page version ()
It is important to verify that the data we got from Foundation DB matches with what we
want, since we are doing a range query.

for example, say we searched for ('db_name42', 10, 20). If this page does not exist, then
it could match with ('db_name41', 10, 20) or with ('db_name42', 9, 20) since it does
lexicographic search.
2024-07-02 16:58:36 +00:00
b24ae4b63e add missing bench config () 2024-07-02 12:54:59 +00:00
7fb070dc9e error out when dump is not a file () 2024-07-02 09:40:14 +00:00
355ec0aa16 fix overflow in row counters ()
* replace row read/written with saturating counter

* regenerate bundled sqlite

* fix invalid cast
2024-07-02 09:38:14 +00:00
543766f3b6 Update workflow to release a latest dev image () 2024-07-01 18:20:46 +00:00
340d34ac96 Add Dockerfile and Github action for Storage Server () 2024-07-01 13:21:11 +00:00
80605905d9 fix: minor bug issues with the cache tables ()
- Changed transaction table to use `(txn_id, page_no)` as composite
  primary key
- Updated `insert_frame` to ignore unique constraint violation since
  frames are immutable
- Change `insert_page` method to upsert
2024-07-01 13:08:48 +00:00
aeb9a9c538 Use max_frame_no for transaction reads and writes ()
* Add basic tonic error handling

Added a simple error to handle `WriteConflict`s

* Improve the way we handle Foundation DB keys

Foundation DB keys support tuples. Earlier we used plain strings. For
example to store page 5, which had frame no 8, we did `ns/f/5/8`.
However this breaks lexicographic sorting. For e.g. we want `ns/f/5/8`
to be smaller than `ns/f/5/18`, but since we store as a plain string
the comparison breaks.

So we let FDB handle encoding with the `pack` API which encodes the
key properly as tuple `(ns, f, 5, 8)`

* Send `max_frame_no` while doing inserts and find frame

Whenever a txn is started, we keep the current `max_frame_no` in the
transaction's state. For the subsequent find and insert requests, we
send this value to storage server.

For a read txn, it should not read any frames greater than it's
max_frame_no. For a write txn, if the max_frame_no has changed
meanwhile, then txn should be aborted.

* Allow multiple writers at the storage server

This patch has two important changes:
- Storage server now uses `max_frame_no` from the txn to read frames
  It will make sure to not read any frames beyond the `max_frame_no`
  of the transaction. This fixes the bug in isolation level.
- Storage server now checks `max_frame_no` before inserting. If it
  has changed meanwhile, then it rejects the insertion request.

This lets us have multiple (non concurrent) writers or even multiple
logical primary instances.

* minor cargo fmt fixes
2024-06-28 13:38:02 +00:00
5f425e1ada Move in-memory cache to disk ()
* replace in-memory cache with local sqlite db

Previously, `libsql-storage` stored all the data in-memory. It kept a
in-memory frame cache and also cached all the transient transaction
writes in-memory. This patch changes it to store the data on local disk.
This data is transient in nature, disk loss should not cause any issues.

* fix: remove unnecessary `namespace` column in local cache

Each namespace gets its own local cache. So there is no need of
namespace column at all.

* Add some explainer about how we use the local cache

We use LocalCache to cache frames and transaction state. Each namespace gets its own cache
which is currently stored in a SQLite DB file, along with the main database file.

Frames Cache:
    Frames are immutable. So we can cache all the frames locally, and it does not require them
    to be fetched from the storage server. We cache the frame data with frame_no being the key.

Transaction State:
    Whenever a transaction reads any pages from storage server, we cache them in the transaction
    state. Since we want to provide a consistent view of the database, for the next reads we can
    serve the pages from the cache. Any writes a transaction makes are cached too. At the time of
    commit they are removed from the cache and sent to the storage server.
2024-06-28 12:53:33 +00:00
95216464a1 add CI job to validate that bundle is up to date ()
* add CI job to validate that bundle is up to date

* cargo xtask build-bundled
2024-06-27 15:28:21 +00:00
a0494abd8f use dedicated destroy_wal_manager function to destroy wal as it can be static () 2024-06-27 10:59:55 +00:00
4c5556903d fix panic on delete namespace () 2024-06-27 09:55:34 +00:00
ac5f8cf9f8 libsql: Add Connection::total_changes() API ()
It's a rusqlite API that we're missing.
2024-06-27 09:19:07 +00:00
c19ed448da libsql: Add Statement::run() API ()
The `execute()` method returns an error if the query returns rows, which
makes it unsuitable for running any type of SQL queries. Similarly, the
`query()` method only works on SQL statements that return rows.
Therefore, the `run()` method is provided to execute any type of SQL
statement.

This is needed, for example, for the libSQL JavaScript library that
needs to preserve `better-sqlite3` semantics.
2024-06-27 09:00:29 +00:00
4eddadd83d Stop using self-hosted runners ()
Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
2024-06-26 08:21:16 +00:00
ad406a692e build sqld debug ()
ship debug images
2024-06-25 20:15:30 +00:00
30623f9d1e React Native support ()
* iOS/Android Support

Add steps for Android

PR comments

* comment size optimization
2024-06-25 17:39:27 +00:00
784f561f3b Added desktop GUIs ()
* Added desktop GUIs

* Update README.md

* Update README.md

more db clients

Co-authored-by: Jamie Barton <jamie@notrab.dev>

* Update README.md

Co-authored-by: Jamie Barton <jamie@notrab.dev>

---------

Co-authored-by: Jamie Barton <jamie@notrab.dev>
2024-06-25 17:33:24 +00:00
0a12def8ae bump rheaper () 2024-06-25 17:02:06 +00:00
4cf97fc7e6 add in-process heap profiler ()
* add in-process heap profiler

* implement delete profile
2024-06-25 12:20:05 +00:00
af8239736b fix allocator bug () 2024-06-24 20:34:53 +00:00
be6a38fbd4 fix current segment replicator () 2024-06-24 18:07:28 +00:00
6b4414f1e0 bump libsql-server 0.24.16 () libsql-server-v0.24.16 2024-06-24 15:23:47 +00:00