SpacetimeDB
SpacetimeDB copied to clipboard
datastore: fix two inserts in tx state with unique idx
Description of Changes
Fixes https://github.com/clockworklabs/SpacetimeDB/issues/2601.
This fixes two bugs, where if you:
- define a table with
struct T { #[unique] x: u32 } - insert
T { x: 42 }twice => bug 1, will panic but shouldn't. - find row for
42=> empty iterator => bug 2
API and ABI breaking changes
There was a bug where inserting twice caused a unique constraint violation, but again, it's a bug.
Expected complexity level and risk
4 - the datastore is getting messy.
Testing
- The test
test_set_semanticswas buggy and is now fixed. - A regression test
add_twice_and_find_issue_2601is added for bug 2.