Commit Graph

933 Commits

Author SHA1 Message Date
Mario Alejandro Montoya Cortés 12b319417e Reduce the implementation to only cover the bug case 2024-07-29 09:57:24 -05:00
Mario Alejandro Montoya Cortés 7a44f55423 Clippy 2024-07-29 09:57:15 -05:00
Mario Montoya 0557dc79d2 Apply suggestions from code review
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
2024-07-29 09:57:08 -05:00
Mario Alejandro Montoya Cortés 47d94d5e97 Add comment on ugly hack 2024-07-29 09:57:00 -05:00
Mario Alejandro Montoya Cortés 358fabc98c Make error messages more readable & fix unsound type check 2024-07-29 09:56:54 -05:00
Mario Montoya 913fc053f0 Apply suggestions from code review
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
2024-07-29 09:56:47 -05:00
Mario Alejandro Montoya Cortés 485194c310 Implement q temporary type check validation on sql compiling 2024-07-29 09:56:35 -05:00
Phoebe Goldman 02dc502d9e Cherry-pick: ST sequences: respect allocated amount on restart (#1532)
Co-authored-by: Kim Altintop <kim@eagain.io>

Kinda a sketchy rebase, tbh. Some smoketests failing locally.
2024-07-24 12:26:15 -04:00
Phoebe Goldman 0c02728e61 Revert "[alpha-playtest-3]: [alpha-playtest-3]: Cherrypick WIP PR #1532: Don't pre-allocate seqs during bootstrap; fix off-by-ones when allocating."
This reverts commit abf443a6de.
2024-07-24 11:57:27 -04:00
Zeke Foppa 4d21daf522 [heads/alpha-playtest-3]: remove smoketest that uses nonexistent function 2024-07-22 15:09:48 -07:00
Phoebe Goldman abf443a6de [alpha-playtest-3]: [alpha-playtest-3]: Cherrypick WIP PR #1532: Don't pre-allocate seqs during bootstrap; fix off-by-ones when allocating.
Also use `pretty_assertions` in some tests,
because I was having trouble debugging small differences in large structures.
Notably does not use `pretty_assertions` in our whole test suite,
only in the tests broken by the previous commits in this PR.

Prior to this commit, we pre-allocated 4096 values for each sequence during bootstrap.
For user sequences, these were 0..=4096; for system sequences, they were 4097..=8192.
This did not play nicely with restoring after a restart;
we would either incorrectly re-use values starting from 4097 after restart,
or would spuriously allocate after bootstrap without a restart
and begin with values starting from 8193.

With this commit, we do not pre-allocate sequence values during bootstrap.
Each user table sequence starts with `value: 1, allocation: 0`,
and each system sequence with `value: 4097, allocation: 4096`.
This means that the first access to a sequence, either after bootstrap or after a restart,
will perform an allocation.
This is in contrast to previously, where accesses after restart would allocate,
but accesses after bootstrap would not.

Additionally, the logic for determining whether an allocation was necessary
in `MutTxId::get_next_sequence_value` contained an off-by-one value
which caused the last value before an allocation to be skipped.
This commit fixes that off-by-one error, making it so that yielding value `4096`
when `allocation == 4096` is possible, though it does result in a new allocation.
Previously, we would yield 4095 without allocation, skip 4096,
then allocate and yield 4097.
alpha-playtest-3
2024-07-22 13:23:05 -07:00
Mazdak Farrokhzad 8258d922e7 Fix index removal and additions + add smoketest (#1444) 2024-07-19 11:18:18 +02:00
Mazdak Farrokhzad 0b59e6d889 HACK: Tweak schema_updates to allow adding/removing non-unique indices (#1434) 2024-07-19 11:03:12 +02:00
Piotr Sarnacki 2c37a05a97 Build on push 2024-07-18 11:54:08 +02:00
John Detter b97cefaad9 Fix from Phoebe 2024-07-17 23:07:02 +08:00
Zeke Foppa 4089ffe3b2 [release/candidate/v0.10.1]: Bump version to 0.10.1 v0.10.1-beta 2024-06-26 13:48:57 -07:00
SteveBoytsun 70eaf1ddf8 [release/candidate/v0.10.1]: Cherry-pick (#1461) Fixed exceptions in C# SDK when someone disconnects or when a transaction originates from CLI
Co-authored-by: Steve Boytsun <steve@clockwokrlabs.io>
2024-06-26 13:41:40 -07:00
Zeke Foppa 5889691b4b [release/candidate/v0.10.0]: Manually apply open PR: Update tools/publish-crates.sh (#1426) v0.10.0-beta 2024-06-13 10:20:19 -07:00
Zeke Foppa 33e915a784 [release/candidate/v0.10.0]: empty commit to avoid docker tag collision 2024-06-12 20:21:10 -07:00
Noa 6e052cb8dc Fix auth regression (#1413)
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2024-06-12 22:57:30 +00:00
Ingvar Stepanyan 2b7b19ec18 [C#] [NFC] Use semantic model's type where possible (#1401) 2024-06-12 21:50:51 +00:00
Ingvar Stepanyan e73ea7932c Add Option SDK tests (#1405) 2024-06-12 21:16:08 +00:00
Ingvar Stepanyan 0b99e10735 [NFC] [C#] Minor simplifications to type checks in Roslyn codegen (#1400) 2024-06-12 17:34:21 +00:00
joshua-spacetime 2ea93c2b5b chore: Remove max value metrics (#1402) 2024-06-12 16:59:46 +00:00
Ingvar Stepanyan cb2fbb9c4e [C#] Add Roslyn shapshot tests (#1399) 2024-06-11 19:04:16 +00:00
Kim Altintop 0fa94cedc1 durability: Skip fsync if nothing changed (#1360) 2024-06-11 18:10:33 +00:00
Kim Altintop 299789a138 core: Determine dangling clients from st_clients (#1366)
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2024-06-11 18:07:18 +00:00
Phoebe Goldman 6c45e76a98 Integrate snapshotting into core (#1344) 2024-06-11 12:40:02 +00:00
Mario Montoya 114aa994bf Fix output of binary, Identity, Address for SQL output and the 'Display' of them to show a full hex value (#1087) 2024-06-10 16:49:46 +00:00
Zeke Foppa 2d09485f74 Bump version to 0.10.0 (#1349)
Co-authored-by: Zeke Foppa <github.com/bfops>
2024-06-10 16:25:02 +00:00
Ingvar Stepanyan d11c83e53c Add explicit parameter for table visibility (#1359) 2024-06-10 13:38:38 +00:00
joshua-spacetime c2831d06d0 test(1329): Row limit from system table (#1355) 2024-06-10 10:31:18 +00:00
Kim Altintop 1044ebc652 core: Store address, owner and program bytes in st_module (#1305) 2024-06-10 10:25:16 +00:00
joshua-spacetime ccaad88130 fix(1353): Remove underscore based table access checks (#1354) 2024-06-10 09:58:51 +00:00
Kurtis Mullins b5252479a1 Add Jenkinsfile to run internal automation (#1232) 2024-06-09 14:41:49 +00:00
joshua-spacetime 61ee5def83 feat: System table based slow query logging (#1350) 2024-06-07 21:37:34 +00:00
Noa a54399495d Prune bindings deps (#1290) 2024-06-07 20:36:33 +00:00
Ingvar Stepanyan d1033b5d93 Shared C# codegen for BSATN (#1312)
Signed-off-by: Ingvar Stepanyan <me@rreverser.com>
Co-authored-by: james gilles <jameshgilles@gmail.com>
Co-authored-by: John Detter <no-reply@boppygames.gg>
2024-06-07 19:22:02 +00:00
Zeke Foppa 4af892a122 [bfops/update-quickstart]: do thing (#1348)
Co-authored-by: Zeke Foppa <github.com/bfops>
2024-06-06 20:40:45 +00:00
joshua-spacetime b3339c80bc feat(1329): System table for system variables (#1342)
Closes #1329.

Used to persist global parameters for slow query logging and cardinality limits.
2024-06-06 20:30:07 +00:00
Zeke Foppa 8f3f6bd9d7 Fix Config.save failing if /tmp is on a different filesystem (#1346)
* [bfops/fix-config-saving]:  do thing

* [bfops/fix-config-saving]: review

* [bfops/fix-config-saving]: fix smoketests

* [bfops/fix-config-saving]: use create_new to avoid race condition

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-06-06 16:28:17 +00:00
Snoppy 335c5b6e45 chore: fix typos (#1241)
* chore: fix typos

Signed-off-by: snoppy <michaleli@foxmail.com>

* Update lib.rs

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>

---------

Signed-off-by: snoppy <michaleli@foxmail.com>
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2024-06-06 00:05:54 -04:00
Zeke Foppa b06b2e59f1 Fix bug with Lockfile sticking around (#1341)
* [bfops/fix-config-lock]: do thing

* [bfops/fix-config-lock]: review

* [bfops/fix-config-lock]: review

* [bfops/fix-config-lock]: fix

* [bfops/fix-config-lock]: TODOs

* [bfops/fix-config-lock]: review

* [bfops/fix-config-lock]: review

* [bfops/fix-config-lock]: review

* [bfops/fix-config-lock]: review

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-06-05 22:40:24 +00:00
Phoebe Goldman 8c5f40db8d Add the snapshot crate, which implements snapshotting at a low level (#1340)
* Add the `snapshot` crate, which implements snapshotting at a low level

- Requires making `BlobHash` be `Serialize` and `Deserialize`.
  For arcane macro-ology reasons, this requires writing `BlobHash::SIZE`
  instead of `Self::SIZE` (it gets embedded in a visitor struct or something).
- Requires adding two new operators to `BlobStore`.
- Adds a return value to `Page::save_content_hash`, for convenience.
- Impls `DerefMut` for `Pages`.
- **Scary change:** adds `Table::pages_mut`.
  I think possibly this operator should be `unsafe`,
  since write access to the `Pages` allows an undisciplined caller
  to violate the `Table`'s assumptions by corrupting a `Page`.
  It seems like an anti-pattern to mark a method `unsafe` on the grounds that
  misusing its return value can cause UB,
  but I don't see a plausible alternative
  without making most methods on `Page` unsafe.
  Open to feedback on this one!

* Nix `Table::pages_mut`

* Address Mazdak's feedback

* Use `thiserror` rather than `anyhow` for better error hygiene
2024-06-05 21:58:12 +00:00
Phoebe Goldman f9cc84e3b4 Define DirTrie, a git-like on-disk object store (#1336)
* Define `DirTrie`, a git-like on-disk object store

* Remove unused iteration code; add simple tests

* Address Mazdak's review
2024-06-05 17:16:59 +00:00
Mazdak Farrokhzad f08644f840 make update_database insensitive to table access changes (#1338) 2024-06-05 16:31:07 +00:00
Kim Altintop ff851ae5fa commitlog: Make bitflip test a proptest (#1333)
* commitlog: Make bitflip test a proptest

The test sometimes fails. As a proptest, we'll be able to seed it with
failing inputs.

Fixes: #1167

* commitlog: Fix the bitflip test

Turns out we sometimes flipped a bit in the CRC32 itself, which makes
things go wrong in not the expected way.
2024-06-05 05:53:41 +00:00
Phoebe Goldman 697a581886 Make both TX offset counters agree (#1332)
* Make both TX offset counters agree

Prior to this commit, `CommittedState::next_tx_offset` got out of sync
with the commitlog/durability's notion of the tx offset,
because the former counted all committed TXes,
while the latter excluded certain empty TXes
(namely, empty TXes
which were not `__identity_connected__` or `__identity_disconnected__` reducers).

With this commit, the skipping logic is moved earlier into `CommittedState`,
so that it can maintain a counter consistent with that used by the commitlog.

* Remove duplicated increment
2024-06-04 17:57:00 +00:00
Phoebe Goldman db34ff6a8e Create new crate fs-utils; move Lockfile and create_parent_dir (#1334)
* Create new crate `fs-utils`; move `Lockfile` and `create_parent_dir`

The snapshot crate will need to create lockfiles.
Rather than duplicating code to do so, we choose to move our definition of `Lockfile`
into a crate that can be depended on by both `cli` and `snapshot`.
No existing crate seems like an obvious choice for this
-- a `Lockfile` is not really a data structure, so `data-structures` seems wrong --
so we add a new crate, `fs-utils`.
Currently this contains only `Lockfile` and `create_parent_dir`,
but a follow-up PR will add `DirTrie`, a Git-like on-disk object store.

* Deduplicate `map_err` closure

* Zeke's nit: simplify control flow

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>

---------

Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2024-06-04 16:57:28 +00:00
Phoebe Goldman a214f78f0b Impl Serialize, Deserialize for Page (#1335)
* Impl `Serialize`, `Deserialize` for `Page`

Snapshotting needs to write `Page`s to files and read them back again.
To that effect, this commit implements `Serialize` and `Deserialize` for `Page`.

* Address Mazdak's review

- Fix soundness in `FixedBitSet` by moving an assert.
- Add commentary to test.
- Add commentary to `spacetimedb-lib` dependency.
2024-06-04 15:49:27 +00:00