Skip to content

[8.4] MOD-14064: Avoid loading and evaluating filter expressions for indexes that do not match the document type#8598

Merged
raz-mon merged 1 commit into8.4from
backport-MOD-14064-to-8.4
Mar 10, 2026
Merged

[8.4] MOD-14064: Avoid loading and evaluating filter expressions for indexes that do not match the document type#8598
raz-mon merged 1 commit into8.4from
backport-MOD-14064-to-8.4

Conversation

@raz-mon
Copy link
Copy Markdown
Collaborator

@raz-mon raz-mon commented Mar 4, 2026

Summary

Backport of commit 27e2e31 from master to 8.4 branch.

This PR avoids loading and evaluating filter expressions for indexes that do not match the document type (e.g., HASH vs JSON), improving performance and correctness.

Related Jira: MOD-14336
Original PR: #8378

Conflicts Resolved

No conflicts - cherry-pick applied cleanly.


Pull Request opened by Augment Code with guidance from the PR author


Note

Medium Risk
Touches core indexing notification paths and changes how index rules are selected, which could affect which documents are updated/deleted in indexes if type detection is wrong. Scope is small and primarily adds a type check to avoid unnecessary work.

Overview
Release note: Improves indexing performance and correctness by only considering schema rules (and evaluating their FILTER expressions) for indexes whose configured document type (HASH vs JSON) matches the changed key.

This threads the detected DocumentType through Indexes_FindMatchingSchemaRules/Indexes_DeleteMatchingWithSchemaRules and updates keyspace-notification handling so deletions/updates avoid loading data for irrelevant index types (with a DocumentType_Unsupported escape hatch for CRDT empty/deleted keys).

Written by Cursor Bugbot for commit a57ff40. This will update automatically on new commits. Configure here.

…s that do not match the document type (#8378)

* Fix incoherent indexing w.r.t index filter for index creation vs. updates/writes

* Add test for unified behavior

* Load from correct key when replacing (rename)

* Remove EVAL_EXPR_NULL

* Fix bug - json index interferes with hash index and vice-versa

* Remove unecessary initialization

* Fix exists function

* Revert the removal of EXPR_EVAL_NULL

* Fix bad reuse of RLookUp and RLookUpRow

* Remove split PRs' code

* Remove more for splitting

* Avoid loading and evaluating filter expressions for indexes that do not match the document type

* Fix loaded document in rename flow

* Align fix
@raz-mon raz-mon requested review from nafraf and oshadmi March 4, 2026 11:18
@github-actions github-actions Bot added the size:S label Mar 4, 2026
@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Mar 4, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread src/spec.c
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 4, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.51%. Comparing base (aa15829) to head (a57ff40).
⚠️ Report is 3 commits behind head on 8.4.

Files with missing lines Patch % Lines
src/notifications.c 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #8598      +/-   ##
==========================================
- Coverage   85.54%   85.51%   -0.04%     
==========================================
  Files         337      337              
  Lines       53352    53352              
  Branches    11023    11023              
==========================================
- Hits        45640    45623      -17     
- Misses       7568     7586      +18     
+ Partials      144      143       -1     
Flag Coverage Δ
flow 84.43% <88.88%> (-0.31%) ⬇️
unit 51.07% <22.22%> (-0.01%) ⬇️

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.

@raz-mon
Copy link
Copy Markdown
Collaborator Author

raz-mon commented Mar 9, 2026

Approved by me.

@raz-mon raz-mon added this pull request to the merge queue Mar 10, 2026
Merged via the queue into 8.4 with commit 1764241 Mar 10, 2026
32 of 36 checks passed
@raz-mon raz-mon deleted the backport-MOD-14064-to-8.4 branch March 10, 2026 18:02
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.

2 participants