[8.4] Implement slots tracker for ASM - [MOD-12167]#7291
[8.4] Implement slots tracker for ASM - [MOD-12167]#7291redisearch-backport-pull-request[bot] merged 1 commit into8.4from
Conversation
* initial component layout * layout `slots_tracker_set_local_slots` plan * layout `slots_tracker_set_partially_available_slots` plan * layout `slots_tracker_set_fully_available_slots` plan * layout `slots_tracker_remove_deleted_slots` and `slots_tracker_has_fully_available_overlap` plan * layout `slots_tracker_check_availability` plan * minimal refactor to the API * implement helpers for the version management * initial implementation of SlotsSet * another iteration * refine implementation * add some tests * formatting * group state parts and other cleanup * reuse functions * rename * set unit test module in slot_set.rs * formatting * move helpers * implement separately slots_tracker for safer API and easier testing * refactor API to use SlotsTracker * add some tests * tidy ups and fix lifetime * format * better struct exposure * better memory management in union_relation * add test * rewrite some comments * switch values anf six comments * allow empty SlotRangeArray input (not null) * Check complete state in tests with a custom PartialEq implementation * update comments * add promote_to_local_slots functionality * add tests * formatting * tests cleanup * add coverage_relation algorithm * refactor union_relation to use new coverage_relation * formatting * linting * an attempt to create an FFI correctly * address some review comments * another review comment fix * update ffi and header * fix cbindgen build * more idiomatic * add debug assert to promote_to_local_slots * remove tests for unexpected situations * refactor has_overlap to use "any" * minor improvement * reorder match cases for better readability * use thread_local to avoid unsafe sync * replace boolean assert with thread id validation * implement version enum for slots_tracker * address review comments * improve comments * rename value to version * optimize atomic access * simplify helpers * use assert * move atomic manipulations to the C side * improve tests * improve API comments (cherry picked from commit 742f192)
|
|
||
| // TODO ASM: use this to decide if we need to filter by slots | ||
| extern atomic_uint key_space_version; | ||
| atomic_uint key_space_version = 0; |
There was a problem hiding this comment.
Bug: Misplaced Extern Keyword
The key_space_version variable has both an extern declaration and a definition with initialization in the same file. Line 91 declares it as extern (indicating it's defined elsewhere), but line 92 immediately defines and initializes it. This creates a conflicting declaration - the extern keyword should be removed from line 91 since the variable is being defined in this file, not just declared.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 8.4 #7291 +/- ##
==========================================
+ Coverage 85.65% 85.73% +0.07%
==========================================
Files 326 329 +3
Lines 50934 52014 +1080
Branches 10921 12001 +1080
==========================================
+ Hits 43628 44592 +964
- Misses 7140 7255 +115
- Partials 166 167 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Backport of #7200 to
8.4.Note
Introduces a Rust slots tracking library with a C FFI, generates a public header, wires it into the workspace, and adds an atomic key-space version to result processing.
slots_tracker(coreSlotSet/SlotsTrackerwith versioning and availability checks) andslots_tracker_ffi(C FFI layer).c_entrypoint/slots_tracker_ffiaddsbuild.rsandcbindgen.tomlto generateheaders/slots_tracker.h.slots_trackertomembersandworkspace.dependencies.slots_tracker_set_local_slots_internal,slots_tracker_mark_partially_available_slots_internal,slots_tracker_promote_to_local_slots,slots_tracker_mark_fully_available_slots,slots_tracker_remove_deleted_slots,slots_tracker_has_fully_available_overlap,slots_tracker_check_availability.atomic_uint key_space_versionfor cheap reads across the boundary.extern atomic_uint key_space_versioninsrc/result_processor.cto track key-space state version.Written by Cursor Bugbot for commit f447680. This will update automatically on new commits. Configure here.