Files
Kim Altintop e2b4113ffb Async shutdown for database / durability (#3880)
Controlled shutdown of a database should drain the outstanding
transactions
queue(s) and flush them to the durability layer.

With the introduction of another queueing layer in #3868, it became
harder to
observe when or if this process is completed.

This patch thus introduces an explicit (async) shutdown method for
`RelationalDB` and below, which will wait until all submitted
transactions are
either reported durable, or an error occurs in the durability layer.

`RelationalDB` is made `!Clone`, such that shutdown can be initiated in
the
`Drop` impl. Note that this requires access to a tokio runtime, which we
thread
through via the `Persistence` services in order to allow control over
which of
the various runtimes is being used for durability-related tasks.

Also moves `RelationalDB::open` to a blocking thread when a
persistence-enabled
database is constructed by the `HostController` -- this process performs
heavy
I/O and can take a substantial amount of time, during which we don't
want to
block a worker thread.

# API and ABI breaking changes

None

# Expected complexity level and risk

3

# Testing

- [ ] some testing added
- [ ] existing tests still pass
- [ ] `impl Drop for RelationalDB` difficult to test, extra eyeballs
needed

---------

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2025-12-17 18:28:42 +00:00
..
2025-06-04 16:33:32 +00:00
2025-06-04 16:33:32 +00:00
2025-08-12 18:20:58 +00:00
2023-08-01 23:16:37 +02:00
2023-08-01 23:16:37 +02:00
2023-08-01 23:16:37 +02:00

This crate check the conformance of SpacetimeDB to SQL:2016

⚠️ Internal Crate ⚠️

This crate is intended for internal use only. It is not stable and may change without notice.

Setup PG

Create a database called TestSpace

Issues

List of issues in the execution of the conformance test

UNSUPPORTED: issue 1

CHARACTERS/OCTETS is not implemented by neither PG nor Sqlite

CREATE TABLE TABLE_E021_01_01_02 ( A CHAR ( 8 CHARACTERS ) )
CREATE TABLE TABLE_E021_01_01_02 ( A CHAR ( 8 OCTETS ) )

UNSUPPORTED: issue 2

CHAR VARING is not implemented by neither PG nor Sqlite

CREATE TABLE TABLE_E021_02_01_02 ( A CHAR VARING ( 8 CHARACTERS ) )

UNSUPPORTED: issue 3

AS ( C , D ) is a syntax error on PG and Sqlite

SELECT * AS ( C , D ) FROM TABLE_E051_07_01_01

REPLACED: issue 4

CURRENT_TIME and timetz type is marked as "Don't use EVER" by PG: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_timetz

SELECT CURRENT_TIME

UNSUPPORTED: issue 5

CASE 0 WHEN 2 , 2 is a syntax error on PG and Sqlite

SELECT CASE 0 WHEN 2 , 2 THEN 1 END

WRONG: issue 6

This expression fail in PG by the lack of a timezone and Sqlite spit out a nonsensical value (1)

SELECT CAST ( CAST ( '01:02:03' AS TIME ) AS TIMESTAMP )