Skip to content

Skip Atempting to Load Key Name - [MOD-9419]#5959

Merged
GuyAv46 merged 7 commits intomasterfrom
guyav-skip_atempt_to_load_key_name
Apr 27, 2025
Merged

Skip Atempting to Load Key Name - [MOD-9419]#5959
GuyAv46 merged 7 commits intomasterfrom
guyav-skip_atempt_to_load_key_name

Conversation

@GuyAv46
Copy link
Collaborator

@GuyAv46 GuyAv46 commented Apr 19, 2025

Describe the changes in the pull request

Implement an optimization that skips attempting to load the value of __key when requesting to load the key name.

The optimization can be enabled by setting ENABLE_UNSTABLE_FEATURES on

The optimization is applied only if __key is the only field the loader was requested to load, or when all the other fields are implicitly loaded (SORTABLE+UNF).

Mark if applicable

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

@codecov
Copy link

codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 4.76190% with 20 lines in your changes missing coverage. Please review.

Project coverage is 87.02%. Comparing base (a9583ed) to head (3f01a3e).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
src/result_processor.c 4.76% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5959      +/-   ##
==========================================
- Coverage   87.09%   87.02%   -0.08%     
==========================================
  Files         211      211              
  Lines       38595    38616      +21     
  Branches     1893     1893              
==========================================
- Hits        33613    33604       -9     
- Misses       4975     5005      +30     
  Partials        7        7              

☔ 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.

@GuyAv46
Copy link
Collaborator Author

GuyAv46 commented Apr 19, 2025

The coverage report is wrong. It ran the test, and it passed. This means the code must be covered

@oshadmi oshadmi requested a review from raz-mon April 20, 2025 10:46
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.

🔥

if (nkeys == 1 && !strcmp(keys[0]->path, UNDERSCORE_KEY)) {
// Return a thin RP that doesn't actually loads anything or access to the key space
// Returning without turning on the `QEXEC_S_HAS_LOAD` flag
return RPKeyNameLoader_New(keys[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is it reported as not covered?

Copy link
Collaborator Author

@GuyAv46 GuyAv46 Apr 20, 2025

Choose a reason for hiding this comment

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

I think something got messed up when I rebased the branch from 2.10 to master. The test runs and passes on the coverage test, so we surely use this code

@GuyAv46 GuyAv46 enabled auto-merge April 22, 2025 08:32
@GuyAv46 GuyAv46 requested review from oshadmi and raz-mon April 22, 2025 12:47
@GuyAv46 GuyAv46 force-pushed the guyav-skip_atempt_to_load_key_name branch 2 times, most recently from adbeed1 to 3f01a3e Compare April 22, 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 optimization and nicely done 🥇
Some more docs would be nice


/*********************************************************************************/

typedef struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to have some docs here, e.g., the purpose of this RP

ResultProcessor *RPLoader_New(AREQ *r, RLookup *lk, const RLookupKey **keys, size_t nkeys, bool forceLoad) {
if (RSGlobalConfig.enableUnstableFeatures) {
if (nkeys == 1 && !strcmp(keys[0]->path, UNDERSCORE_KEY)) {
// Return a thin RP that doesn't actually loads anything or access to the key space
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Return a thin RP that doesn't actually loads anything or access to the key space
// Return a thin RP that doesn't actually load anything or access to the key space

@GuyAv46 GuyAv46 added this pull request to the merge queue Apr 27, 2025
Merged via the queue into master with commit b4ffb1a Apr 27, 2025
10 of 11 checks passed
@GuyAv46 GuyAv46 deleted the guyav-skip_atempt_to_load_key_name branch April 27, 2025 07:49
@redisearch-backport-pull-request
Copy link
Contributor

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

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

git fetch origin 2.10
git worktree add -d .worktree/backport-5959-to-2.10 origin/2.10
cd .worktree/backport-5959-to-2.10
git switch --create backport-5959-to-2.10
git cherry-pick -x b4ffb1aa01d3e33542f52ecd27cde1529c505cde

@redisearch-backport-pull-request
Copy link
Contributor

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

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

git fetch origin 8.0
git worktree add -d .worktree/backport-5959-to-8.0 origin/8.0
cd .worktree/backport-5959-to-8.0
git switch --create backport-5959-to-8.0
git cherry-pick -x b4ffb1aa01d3e33542f52ecd27cde1529c505cde

GuyAv46 added a commit that referenced this pull request Apr 27, 2025
* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes

(cherry picked from commit b4ffb1a)
GuyAv46 added a commit that referenced this pull request Apr 27, 2025
* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes

(cherry picked from commit b4ffb1a)
github-merge-queue bot pushed a commit that referenced this pull request Apr 27, 2025
Skip Atempting to Load Key Name - [MOD-9419] (#5959)

* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes

(cherry picked from commit b4ffb1a)
github-merge-queue bot pushed a commit that referenced this pull request Apr 27, 2025
* Skip Atempting to Load Key Name - [MOD-9419] (#5959)

* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes

(cherry picked from commit b4ffb1a)

* fix `get_RP_name` for 2.10
JoanFM pushed a commit that referenced this pull request May 27, 2025
* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes
JoanFM pushed a commit that referenced this pull request May 27, 2025
* implement new feature

* added a test

* reorder implementation

* fix test for master

* fix spells

* improve test

* review fixes
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