[8.2] MOD-13948: Fix indexing discrepancy w.r.t the index filter#8601
Merged
[8.2] MOD-13948: Fix indexing discrepancy w.r.t the index filter#8601
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
dacd135 to
283b43e
Compare
Collaborator
Author
|
Approved by me. |
* 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 * Fix loaded document in rename flow * Address review * Add test * Fix FILTER bug with multiple indexes with the same field alias * Move test
283b43e to
6fb0e5f
Compare
|
Itzikvaknin
approved these changes
Mar 10, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.2 #8601 +/- ##
==========================================
- Coverage 88.96% 88.95% -0.01%
==========================================
Files 260 260
Lines 41992 41990 -2
Branches 3851 3851
==========================================
- Hits 37358 37354 -4
- Misses 4585 4587 +2
Partials 49 49
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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Backport of commit 2ed1841 from master to 8.2 branch.
This PR fixes an indexing discrepancy where documents were incorrectly indexed when the filter expression evaluation should have failed (e.g., due to missing fields).
Related Jira: MOD-14340
Original PR: #8320
Conflicts Resolved
The following conflicts were encountered during the cherry-pick and resolved as follows:
1.
src/aggregate/expr/expression.cEvalCtx_Create(), the 8.2 branch hadRLookup_Init(&r->lk, NULL),RLookupRow _row = {0}; r->row = _row;, andQueryError _status = {0}initialization calls, while the MOD-13948 commit removes the RLookup/Row initialization and changes toQueryError _status = QueryError_Default().QueryError _status = {0};instead ofQueryError_Default()sinceQueryError_Default()is not available in 8.2.2.
src/rules.cEvalCtx_EvalExprandRSValue_BoolTestcalls, while MOD-13948 introduces the centralizedSchemaRule_FilterPassesfunction.SchemaRule_FilterPasses. Fixed call toRSValue_BoolTest(&r->res)(passing address instead of value) sinceRSValue_BoolTestexpectsconst RSValue *.3.
src/spec.cSchemaRule_FilterPasseswith the correct negation logic.4.
tests/pytests/test_filter.pytestFilterWithMissingFields.Pull Request opened by Augment Code with guidance from the PR author
Note
Medium Risk
Changes core indexing eligibility logic for rule filters, which can alter which documents are indexed/unindexed in edge cases (evaluation errors/NULLs). Covered by a focused regression test but could impact existing deployments relying on prior buggy behavior.
Overview
Fixes a discrepancy where documents could be indexed even when a schema rule
FILTERexpression could not be evaluated (e.g., missing fields).This centralizes filter evaluation in new
SchemaRule_FilterPasses()and updates bothSchemaRule_ShouldIndex()and the spec-matching logic inIndexes_FindMatchingSchemaRules()to treat evaluation failures as filter not passing (skip/delete), rather than accidentally indexing. Adds a regression test (testFilterWithMissingFields) to cover pre/post-index document creation and subsequent updates.Written by Cursor Bugbot for commit 6fb0e5f. This will update automatically on new commits. Configure here.