Conversation
8af3f83 to
540a61c
Compare
f2a54d2 to
cd33f8b
Compare
d83a594 to
da20694
Compare
cd33f8b to
cca9973
Compare
da20694 to
a56bd01
Compare
cca9973 to
f68438f
Compare
gefjon
left a comment
There was a problem hiding this comment.
Looks reasonable. I'd appreciate better generic names in bindings/src/table.rs, but otherwise am good with this PR. I haven't really looked at the TypeScript, C# or Unreal codegen; ideally we should get @cloutiertyler or @coolreader18 , @rekhoff and @JasonAtClockwork respectively.
I've double-checked and the impact to the Unreal codegen seems minor here and rebuilt Unreal Blackholio to test locally and it looks good to me. |
|
The TS, C#, and C++ changes are very minor, as can be seen if you hide whitespace changes. They amount only to not caring what kind of index it is, treating all indices as a B-Tree, since B-Trees are "the most general". So the change is basically removing panics and using |
f68438f to
a7f981f
Compare
# Description of Changes Fixes #1122. Adds hash indices and exposes them through `#[index(hash)]` for Rust modules, with support for typescript and C# to come in follow ups. On the client/sdk side, for now, any index is backed via a BTree/native index as it is the most general. A hash index may only be queried through point scan and never ranged scans. Attempting a ranged scan results in an error, with the mechanism implemented in the previous PR (#3974). # API and ABI breaking changes None # Expected complexity level and risk 2? # Testing A test for ensuring that hash indices cannot be used for range scans is added. Tests exercising hash indices will come in the next PR.
When reading indexes back from the st_indexes system table, StIndexAlgorithm::Hash was incorrectly converted to BTreeAlgorithm instead of HashAlgorithm. This caused check_compatible to fail with 'Index algorithm mismatch' on any republish of a module containing hash indexes, since the database schema would report BTree while the module def specified Hash. Introduced in #3976 (Add Hash indices) — the conversion imported HashAlgorithm but used BTreeAlgorithm for the Hash variant.
## Description of Changes One-line fix in `system_tables.rs`: when reading indexes back from `st_index`, `StIndexAlgorithm::Hash` was incorrectly converted to `BTreeAlgorithm` instead of `HashAlgorithm`. This caused `check_compatible` to fail with `Index algorithm mismatch` on **any** republish of a module containing hash indexes — the database schema would report BTree while the module def specified Hash. Effectively, any database with a hash index was stuck and could not be updated. ### Root Cause `system_tables.rs:1234` in the `From<StIndexAlgorithm> for IndexAlgorithm` impl: ```rust // Before (bug — introduced in #3976): StIndexAlgorithm::Hash { columns } => BTreeAlgorithm { columns }.into(), // After (fix): StIndexAlgorithm::Hash { columns } => HashAlgorithm { columns }.into(), ``` The PR that added hash indices (#3976) imported `HashAlgorithm` but used `BTreeAlgorithm` for the Hash variant conversion. ## API and ABI breaking changes None. ## Expected complexity level and risk 1 — single word change, restores correct behavior. ## Testing Existing schema tests cover index round-trips. The bug was caught by attempting to republish a module with hash indexes. --------- Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
When reading indexes back from the st_indexes system table, StIndexAlgorithm::Hash was incorrectly converted to BTreeAlgorithm instead of HashAlgorithm. This caused check_compatible to fail with 'Index algorithm mismatch' on any republish of a module containing hash indexes, since the database schema would report BTree while the module def specified Hash. Introduced in #3976 (Add Hash indices) — the conversion imported HashAlgorithm but used BTreeAlgorithm for the Hash variant.
Description of Changes
Fixes #1122.
Adds hash indices and exposes them through
#[index(hash)]for Rust modules,with support for typescript and C# to come in follow ups.
On the client/sdk side, for now, any index is backed via a BTree/native index as it is the most general.
A hash index may only be queried through point scan and never ranged scans.
Attempting a ranged scan results in an error, with the mechanism implemented in the previous PR (#3974).
API and ABI breaking changes
None
Expected complexity level and risk
2?
Testing
A test for ensuring that hash indices cannot be used for range scans is added.
Tests exercising hash indices will come in the next PR.