Skip to content

[MOD-9998] Migrate RSIndexResult to Rust#6301

Merged
chesedo merged 6 commits intomasterfrom
migrate_rs_index_result_to_rust
Jun 17, 2025
Merged

[MOD-9998] Migrate RSIndexResult to Rust#6301
chesedo merged 6 commits intomasterfrom
migrate_rs_index_result_to_rust

Conversation

@chesedo
Copy link
Copy Markdown
Collaborator

@chesedo chesedo commented Jun 11, 2025

Describe the changes in the pull request

This PR moves the RSIndexResult struct to be defined in Rust. This is the last step to be able to more easily migrate the inverted index to Rust too.

This only differs to the C type in that the anonymous "data" union field now has a name. This required updating all the C files.

pack(16)

The original C had a pack(16) attribute which no longer exists with this. The cbindgen we are using does not support packed(N). I also wrote tests to ensure the Rust implementation has the exact same size and field offsets of the original C definitions before removing the C definitions.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

This is the last step to be able to more easily migrate the inverted
index to Rust too.
@chesedo chesedo force-pushed the migrate_rs_index_result_to_rust branch from 34c46ea to 2fd3627 Compare June 11, 2025 14:47
@chesedo chesedo requested a review from zeenix June 11, 2025 14:47
@chesedo chesedo changed the title Migrate RSIndexResult to Rust [MOD-9998] Migrate RSIndexResult to Rust Jun 11, 2025
Copy link
Copy Markdown
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, the only concern is that it ended up a very disruptive change on the C side and this PR/commit ends up really big (compared to the actual change) but I guess that can't be helped.

@chesedo chesedo requested a review from alonre24 June 12, 2025 09:30
@chesedo chesedo marked this pull request as ready for review June 12, 2025 14:34
alonre24
alonre24 previously approved these changes Jun 12, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 88.32117% with 16 lines in your changes missing coverage. Please review.

Project coverage is 88.75%. Comparing base (5291f97) to head (4144ca8).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/index_result.c 77.41% 7 Missing ⚠️
src/ext/default.c 84.61% 4 Missing ⚠️
src/geo_index.c 0.00% 3 Missing ⚠️
src/numeric_index.c 85.71% 1 Missing ⚠️
src/redisearch_rs/inverted_index/src/lib.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6301      +/-   ##
==========================================
- Coverage   88.85%   88.75%   -0.11%     
==========================================
  Files         240      243       +3     
  Lines       40524    40893     +369     
  Branches     3165     3483     +318     
==========================================
+ Hits        36007    36293     +286     
- Misses       4482     4557      +75     
- Partials       35       43       +8     
Flag Coverage Δ
flow 82.17% <84.55%> (-0.15%) ⬇️
unit 46.30% <63.50%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

chesedo added 2 commits June 17, 2025 09:32
The problem with copy on raw pointers is that we might end up with
multiple mutable references to the raw types or just mixed mutable and
immutable references. This is obviously a memory / data race concert
which we don't want.
Remove things which are no longer needed.
@chesedo chesedo requested a review from LukeMathWalker June 17, 2025 08:18
@chesedo chesedo enabled auto-merge June 17, 2025 08:30
@chesedo chesedo added this pull request to the merge queue Jun 17, 2025
Merged via the queue into master with commit a1b894e Jun 17, 2025
15 checks passed
@chesedo chesedo deleted the migrate_rs_index_result_to_rust branch June 17, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants