Skip to content

MOD-8561: Fix Inverted Index SeekTo Edge Case#5528

Merged
kei-nan merged 3 commits intomasterfrom
master_jk_fix_mod_8561
Jan 22, 2025
Merged

MOD-8561: Fix Inverted Index SeekTo Edge Case#5528
kei-nan merged 3 commits intomasterfrom
master_jk_fix_mod_8561

Conversation

@kei-nan
Copy link
Collaborator

@kei-nan kei-nan commented Jan 20, 2025

Describe the changes in the pull request

A clear and concise description of what the PR is solving, including:

  1. Current: Seeking to the last doc id in the last block when the reader is already pointing at it can crash.
  2. Change: Avoid advancing to the next block if the id we need is in the end of the current block.
  3. Outcome: Avoid crashing in this edge case.

We revert part of the changes from MOD-8255, PR #5350

Main objects this PR modified

  1. Inverted index

Mark if applicable

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

@codecov
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.90%. Comparing base (5f3e051) to head (5db341e).
Report is 4 commits behind head on master.

Current head 5db341e differs from pull request most recent head 94e4b47

Please upload reports for the commit 94e4b47 to get more accurate results.

Files with missing lines Patch % Lines
src/index.c 80.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (5f3e051) and HEAD (5db341e). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (5f3e051) HEAD (5db341e)
3 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5528      +/-   ##
==========================================
- Coverage   87.21%   80.90%   -6.32%     
==========================================
  Files         196      196              
  Lines       35226    35221       -5     
==========================================
- Hits        30723    28494    -2229     
- Misses       4503     6727    +2224     

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

@kei-nan kei-nan requested a review from raz-mon January 20, 2025 13:22
Copy link
Collaborator

@raz-mon raz-mon left a comment

Choose a reason for hiding this comment

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

Nice catch

Comment on lines 1019 to 1021
const t_docId lastIdOfCurrentBlock = IR_CURRENT_BLOCK(ir).lastId;
if (lastIdOfCurrentBlock < docId || (BufferReader_AtEnd(&ir->br) && lastIdOfCurrentBlock != docId)) {
// We need to skip to a next block since the requested doc id isn't in the current block
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just remove the || BufferReader_AtEnd(&ir->br) from the condition? Is there something special we should do in that case?

GuyAv46
GuyAv46 previously approved these changes Jan 20, 2025
@kei-nan kei-nan added this pull request to the merge queue Jan 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 22, 2025
@kei-nan kei-nan added this pull request to the merge queue Jan 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 22, 2025
@kei-nan kei-nan added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit 50e3f01 Jan 22, 2025
18 checks passed
@kei-nan kei-nan deleted the master_jk_fix_mod_8561 branch January 22, 2025 18:05
@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-5528-to-2.8 origin/2.8
cd .worktree/backport-5528-to-2.8
git switch --create backport-5528-to-2.8
git cherry-pick -x 50e3f01dc9ad5b272a11a5053f5d0327d5904b13

@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.6
git worktree add -d .worktree/backport-5528-to-2.6 origin/2.6
cd .worktree/backport-5528-to-2.6
git switch --create backport-5528-to-2.6
git cherry-pick -x 50e3f01dc9ad5b272a11a5053f5d0327d5904b13

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 22, 2025
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 2.10:

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 22, 2025
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.0:

kei-nan added a commit that referenced this pull request Jan 23, 2025
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)
kei-nan added a commit that referenced this pull request Jan 23, 2025
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)

Co-authored-by: kei-nan <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)

* * small fix

* * small fix
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

(cherry picked from commit 50e3f01)

* * compilation fix

---------

Co-authored-by: kei-nan <[email protected]>
dor-forer pushed a commit that referenced this pull request Jan 26, 2025
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2025
* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 30, 2025
* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit e4d8fa0)
github-merge-queue bot pushed a commit that referenced this pull request Feb 4, 2025
* Fix Empty Numeric Value - [MOD-7244] (#5566)

* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit e4d8fa0)

* Change python to fit python3.7

---------

Co-authored-by: dor-forer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants