Commit Graph

111 Commits

Author SHA1 Message Date
Mario Montoya f9f38543c8 Add readmes to all implementation crates specifying that they do no offer stable interfaces (#2320) 2025-03-06 19:50:17 +00:00
Jeffrey Dallatezza bf82614d9c Send delete updates for unsubscribes (#2271) 2025-02-18 17:46:16 +00:00
Mazdak Farrokhzad b50b6841f1 Add direct indices to datastore (#2221) 2025-02-07 01:06:38 +00:00
joshua-spacetime 75ab91d36d Handle optimization and execution errors on initial subscription (#2213) 2025-02-06 19:14:44 +00:00
Mazdak Farrokhzad 6630a90ee1 Switch DeleteTable impl to one based on FixedBitSet (#2183) 2025-01-29 17:15:17 +00:00
Noa 293aebaef9 Bump to Rust 1.84 (#2001) 2025-01-28 23:11:29 +00:00
joshua-spacetime 3798f468a6 query engine integration (#2074) 2025-01-11 00:01:24 +00:00
Mazdak Farrokhzad d4f03b74b9 datastore: insert via BSATN instead of via PV (#2069) 2025-01-07 21:36:02 +00:00
Jeffrey Dallatezza e9e287b8aa Server-side implementation of incremental subscription changes (#2030) 2025-01-02 18:41:57 +00:00
Mazdak Farrokhzad 6f22261859 Fix subscription benchmarks by fixing create_table_for_test_with_the_works (#2027) 2024-12-05 13:12:09 +00:00
james gilles c657b4f088 Rip useless names out of RawDef (#1918) 2024-11-20 21:02:00 +00:00
Ingvar Stepanyan a7a1d36535 Run and test benchmarks against C# as well (#1965)
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2024-11-15 17:27:11 +00:00
Noa f136670420 Directory structure impl (#1879)
Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2024-11-12 04:24:43 +00:00
Ingvar Stepanyan 15b3e0647d NFC: Remove unused fsync param in benchmarks (#1981) 2024-11-11 18:38:14 +00:00
Ingvar Stepanyan 6d712b4b0d Simplify benchmarking wrappers (#1951) 2024-11-06 17:21:56 +00:00
Mario Montoya cb9e0176e6 Fix benches for ia_loop, circles (#1922) 2024-11-05 14:50:31 +00:00
Mario Montoya a6a6c4f08f Put ExecutionContext inside the Tx context (#1876)
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-10-29 16:24:06 +00:00
Tyler Cloutier 83fc5c33d4 The banishment of Address (#1880)
Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2024-10-23 01:56:20 +00:00
Mazdak Farrokhzad 263511e15b Redefine Address as U128 + Identity and Hash as U256 (#1616)
Co-authored-by: James Gilles <jameshgilles@gmail.com>
2024-10-18 20:00:21 +00:00
Mazdak Farrokhzad 1e35fe681f Add gzip + none compression algos and let SDK pick compression (#1802) 2024-10-09 16:46:41 +00:00
Mazdak Farrokhzad 1ac741aa6b Generic and optimized WebSocket API (#1761)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-09-30 21:57:00 +00:00
joshua-spacetime a15f60bfbc feat: Integrate type checking into current query code (#1756) 2024-09-30 21:27:56 +00:00
james gilles c32f297c47 Update TableSchema & system tables to resemble ABI V9 (#1697) 2024-09-25 20:03:22 +00:00
Ingvar Stepanyan 2cccac4e14 C# module benchmarks (#1679) 2024-09-06 18:08:14 +00:00
james gilles 2be42156b2 Allow converting new ModuleDef to old TableSchema (#1630) 2024-08-29 18:17:29 +00:00
Mazdak Farrokhzad 1ca9b1a933 [WASM ABI 1.0] Change ColId from u32 to u16 (#1597) 2024-08-19 17:56:28 +00:00
james gilles 45b2ceee9a Move schemas to schema crate, rename Def to RawDefV8 (#1498) 2024-07-24 17:38:30 +00:00
james gilles f81f2a7492 Move db module from spacetimedb_sats to spacetimedb_lib (#1479) 2024-07-17 20:59:44 +00:00
Noa 10b151b999 Protobufectomy: server (#1077)
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Jeremie Pelletier <jeremiep@gmail.com>
2024-07-12 18:02:18 +00:00
Mario Montoya 80b64669eb Adding benchmark for deserialize json & product value (#1035) 2024-07-10 14:31:49 +00:00
Mario Montoya 814dd5b738 Add small 'realistic' workload benchmark integration test (#714) 2024-06-13 18:28:35 +00:00
joshua-spacetime 61ee5def83 feat: System table based slow query logging (#1350) 2024-06-07 21:37:34 +00:00
Mazdak Farrokhzad 89aecd15e3 Split ColumnOp into one with row indices and one with FieldName & other enabled changes (#1207)
* 1. Split ColumnOp into ColumnOp & FieldOp, former storing ColId
2. Shrink SqlAst to 80 bytes, so it can be passed in registers
3. Store end-result Header in IndexSemiJoin
4. Remove operational use of Header in ColumnOp & build_query
5. Simplify RowRef::{get, project, project_owned}

* Make parts of build_query actually infallible.

1. Make IndexSemiJoin::filter infallible.
2. Make ColumnOp::compare and friends infallible.
3. Make RowRef::{get, project, project_owned} infallible.

* Make RelOps::next itself infallible

* 1. with_select{_cmp}: ensure type safety o query exec cannot panic
2. Document RelValue::{get, read_or_take_column, project_owned}
3. Refactor optimize_select
4. Ensure in optimize_select that conditions are merged with preceding selects

* remove RelOps::{head, row_count}; head is redundant & row_count is useless

* remove Relation trait; it does not carry its weight

* make build_query infallible

* simplify IndexSemiJoin, make it slightly less branchy

* simplify try_index_join

* split IndexSemiJoin into Left & Right parts

* move get_field_pos to test code

* move test version of build_query to test code
2024-06-03 16:45:32 +00:00
Noa b3ea0f515f Fix select * from * (#1218)
* Add SDK test for `SELECT * FROM *`

Which doesn't pass, because we broke it.

* Fix select * from *

---------

Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
2024-05-14 04:38:15 +00:00
Mazdak Farrokhzad 1be912bddb subscription benches: reorder footprint fields (#1209) 2024-05-07 16:26:40 +00:00
Mazdak Farrokhzad 7c52ef555a clarify cost of dropping the updates in eval_incr (#1192) 2024-05-02 16:47:34 +00:00
Mazdak Farrokhzad 0142e14de5 Implement RelValue: Eq + Hash (#1107)
* impl Eq + Hash for RelValue

* Use Hash for RelValue in incr-eval

* naming: spell out pv, rv, and tro
2024-04-30 22:13:50 +00:00
Mazdak Farrokhzad fd44242e99 1. Add Hash for RowRef + make it consistent with PV. (#1163)
2. Make `RowRef::row_hash` use the above.
3. Make `Table::insert` return a `RowRef`.
4. Use less unsafe because of 1-3.
5. Use `second-stack` to reuse temporary allocations in hashing and serialization.
2024-04-30 17:59:58 +00:00
Mario Montoya 7d5eb1532d Slow query log (#1052)
* Slow query log

* Addressing some PR comments
2024-04-17 13:53:55 +00:00
Mazdak Farrokhzad f560101551 Make Table::clone_structure cheaper by: (#1090)
- Arcing `TableSchema`, and this has benefits elsewhere too.
- Arc<[_]>ing the visitor program instructions.

The data behind the Arcs very rarely change,
which is the perfect case for an Arc.
2024-04-16 19:07:36 +00:00
Mazdak Farrokhzad d6815ebf9c Shrink AV and AT to 24 & 16 bytes respectively, and also friends. (#1047) 2024-04-13 16:51:18 +00:00
Kim Altintop be67d1aa27 core: More compact TxData (#950)
`TxData` is the representation of a transaction after it was committed,
and is passed around for evaluation of subscription queries and sending
the result to clients.

With the new commitlog, it can be represented more compactly, such that
copies for writing to the log can be avoided.

Note that this patch stops short of refactoring `DatabaseUpdate`, which
is another representation of the same information as sent to clients.
This means that `ProductValue`s need to be cloned from `TxData`, just as
before.
2024-04-12 08:06:52 +00:00
Kim Altintop 47048559b4 core: Integrate new commitlog + durability (#926)
This patch attempts to integrate the new commitlog with the minimum
changes.

Most of the diff comes from deletions of the legacy log and the need to
adjust tests due to the requirement for a tokio runtime when a durable
database is used in tests.

The "meat" of the patch are the `RelationalDB` constructors,
`RelationalDB::commit_tx`, and the replay logic in
`locking_tx_datastore`.

While `DataKey` is gone, there is still some redundant data being passed
around, which will be addressed in the follow-up patch.
2024-04-11 22:46:31 +00:00
Mazdak Farrokhzad 344861f290 use nohasher_hash and ahash instead of siphash13 (#1040)
* use nohasher_hash and ahash instead of siphash13

* re-export types in spacetimedb_data_structures::map
2024-04-05 17:30:51 +00:00
Shubham Mishra 84071b5629 Batch metrics with ctx (#916)
* Commit iter metrics

* test: Make full-join benchmark async

* use Vec instead of Hash

* Revert "test: Make full-join benchmark async"

This reverts commit eed5aa8a55.

* rebase on master

* lint

* refector api

* remove lifetime from ctx (#1017)

* move ctx to higher level

* fix boilterplate

* batch more

---------

Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-04-05 06:57:40 +00:00
Mazdak Farrokhzad ddf6048547 Split DatabaseTableUpdate in deletes/inserts vecs (#1019)
* eval_incr: add RelValue::ProjRef(&PV) to avoid cloning PVs

* 1. rename `build_source_query` -> `in_mem_to_rel_ops`
2. `SourceExpr::{MemTable -> InMemory}`
3. clariy some commentary re. SourceExpr/SourceSet and friends
4. cleanup: simplify `compile_select_eval_incr`
5. remove ProgramStore; twas dead code.

* add SourceProvider, simplifying the source set stuff

* use MemTable less

* split DatabaseTableUpdate in deletes/inserts vecs

* incr-join: avoid temp Vec<_> allocs

* store deletes/inserts separately in eval_incr results; mostly cleanup
2024-03-27 20:12:30 +00:00
Mazdak Farrokhzad 9141a42622 Bump Rust to 1.77 + fix warnings + use Bound::map (#1020)
* bump Rust to 1.77 + fix warnings + use Bound::map

* use .truncate(true) for OpenOptions
2024-03-25 20:27:08 +00:00
Phoebe Goldman ba8a8d93c3 BFLATN -> BSATN fast-path for fixed-length rows (#1005)
* Implement (but do not use) a fast path for BFLATN -> BSATN conversion

* fmt and clippy

* `u16` offset rather than `usize`

* Address Joshua's review

* Define methods on `RowRef` and `RelValue` which use the new serializer

* Comment in `align_to` about div-by-zero

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>

* Add benchmark comparing BFLATN -> BSATN with and without the fast path

* Add benchmark on `u64_u64_u32`, which has less interior padding than `u32_u64_u64`

* Remove `to_len` from `to_bsatn_extend`

It turns out to be slower than just eating the `realloc`s.

* Remove unused `to_bsatn_slice`

I thought I would need it, but it ended up not being useful.

* Expand comment with example; `Box<[...]>` to reduce memory footprint

* Comments from Mazdak's review

---------

Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2024-03-25 19:46:10 +00:00
Mazdak Farrokhzad 755457a111 perf(813): Avoid materialization of product values in subscriptions (#959)
Closes #813.

A subscription will no longer materialize product values,
for queries with read-only row operations.
but instead it will serialize from bflatn straight to bsatn.

Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-03-15 22:38:47 +00:00
Mazdak Farrokhzad 5601c18c52 perf: don't clone QueryExpr (#981)
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-03-15 19:55:35 +00:00