Skip to content

[MOD-12243] fix: fix concurrency issue on Reducer#7214

Merged
JoanFM merged 6 commits intomasterfrom
fix-concurrency-issue-reducer
Nov 4, 2025
Merged

[MOD-12243] fix: fix concurrency issue on Reducer#7214
JoanFM merged 6 commits intomasterfrom
fix-concurrency-issue-reducer

Conversation

@JoanFM
Copy link
Collaborator

@JoanFM JoanFM commented Nov 4, 2025

Describe the changes in the pull request

The method RDCR_GetFactory mau be called from different threads and the lazy Initialization can lead to a crash because of lack of concurrency.


Note

Use a compile-time static registry for reducers and iterate it in RDCR_GetFactory, removing lazy initialization and runtime registration.

  • Aggregate/Reducers:
    • Replace dynamic/global array + lazy builtin registration with a compile-time static registry (globalRegistry) of 14 reducers and static_assert size check.
    • Update RDCR_GetFactory to scan the fixed-size registry without lazy init or synchronization.
    • Remove runtime registration APIs and macros: RDCR_RegisterFactory, RDCR_RegisterBuiltins, and RDCR_XBUILTIN.

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

GuyAv46
GuyAv46 previously approved these changes Nov 4, 2025
Copy link
Collaborator

@GuyAv46 GuyAv46 left a comment

Choose a reason for hiding this comment

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

Baffling why is it even registered lazily.
Consider replacing the dynamic array with a static one

@JoanFM JoanFM enabled auto-merge November 4, 2025 15:24
cursor[bot]

This comment was marked as outdated.

@JoanFM JoanFM force-pushed the fix-concurrency-issue-reducer branch from 3d00db7 to 230c891 Compare November 4, 2025 15:45
@JoanFM JoanFM requested a review from GuyAv46 November 4, 2025 16:04
@JoanFM JoanFM requested a review from GuyAv46 November 4, 2025 16:07
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.21%. Comparing base (6f30cc3) to head (bddbe73).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7214      +/-   ##
==========================================
- Coverage   85.23%   85.21%   -0.03%     
==========================================
  Files         341      341              
  Lines       52603    52593      -10     
  Branches    12526    12526              
==========================================
- Hits        44835    44815      -20     
- Misses       7576     7586      +10     
  Partials      192      192              
Flag Coverage Δ
flow 84.10% <100.00%> (-0.14%) ⬇️
unit 52.29% <100.00%> (-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.

@JoanFM JoanFM added this pull request to the merge queue Nov 4, 2025
Merged via the queue into master with commit 7184778 Nov 4, 2025
19 checks passed
@JoanFM JoanFM deleted the fix-concurrency-issue-reducer branch November 4, 2025 18:38
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 4, 2025
* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c

Co-authored-by: GuyAv46 <[email protected]>

---------

Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit 7184778)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 2.8:

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 4, 2025
* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c

Co-authored-by: GuyAv46 <[email protected]>

---------

Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit 7184778)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 2.6:

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 4, 2025
* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c

Co-authored-by: GuyAv46 <[email protected]>

---------

Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit 7184778)
@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 Nov 4, 2025
* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c

Co-authored-by: GuyAv46 <[email protected]>

---------

Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit 7184778)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.2:

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 4, 2025
* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c

Co-authored-by: GuyAv46 <[email protected]>

---------

Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit 7184778)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.4:

github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
fix: fix concurrency issue on Reducer (#7214)

* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c



---------


(cherry picked from commit 7184778)

Co-authored-by: Joan Fontanals <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
fix: fix concurrency issue on Reducer (#7214)

* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c



---------


(cherry picked from commit 7184778)

Co-authored-by: Joan Fontanals <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
fix: fix concurrency issue on Reducer (#7214)

* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c



---------


(cherry picked from commit 7184778)

Co-authored-by: Joan Fontanals <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
fix: fix concurrency issue on Reducer (#7214)

* fix: fix concurrency issue on Reducer

* test: fix test distagg

* fix: make it static array

* fix: fix proper static

* Update src/module-init/module-init.c

* Update src/aggregate/reducer.c



---------


(cherry picked from commit 7184778)

Co-authored-by: Joan Fontanals <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
@JoanFM JoanFM changed the title fix: fix concurrency issue on Reducer [MOD-12243] fix: fix concurrency issue on Reducer Nov 5, 2025
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