fix(geo): make geo store commands return the resulting set size with COUNT#3457
Merged
git-hulk merged 6 commits intoApr 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the integer reply of GEO store commands when COUNT is specified so the reply matches the number of members actually stored in the destination zset (rather than the total matched results).
Changes:
- Adjust
GEORADIUS{,BYMEMBER} ... STOREandGEOSEARCHSTOREto returnmin(matches, COUNT)whenCOUNTis provided. - Refactor result truncation logic into a shared helper (
GetReturnedItemsCount) and update output loops to usesize_t. - Add Go unit tests covering
COUNTbehavior forGEORADIUS STORE,GEORADIUSBYMEMBER STORE, andGEOSEARCHSTORE.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/commands/cmd_geo.cc |
Updates GEO store command integer replies to reflect stored count when COUNT is set; centralizes truncation logic. |
tests/gocase/unit/geo/geo_test.go |
Adds regression tests verifying store commands return the stored item count with COUNT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@jihuayu Good catch! Can we add a test for COUNT > matches to confirm it returns the smaller value? |
81e2cc9 to
9b7b16a
Compare
git-hulk
approved these changes
Apr 21, 2026
|
nagisa-kunhah
pushed a commit
to nagisa-kunhah/kvrocks
that referenced
this pull request
Apr 29, 2026
…COUNT (apache#3457) Fix the return value of geo store commands when `COUNT` is specified. Previously, these commands stored only the limited number of members in the destination zset, but returned the full matched result count instead of the actual stored count. Assisted-by: Codex
nagisa-kunhah
pushed a commit
to nagisa-kunhah/kvrocks
that referenced
this pull request
Apr 29, 2026
…COUNT (apache#3457) Fix the return value of geo store commands when `COUNT` is specified. Previously, these commands stored only the limited number of members in the destination zset, but returned the full matched result count instead of the actual stored count. Assisted-by: Codex
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.



Fix the return value of geo store commands when
COUNTis specified.Previously, these commands stored only the limited number of members in the destination zset, but returned the full matched result count instead of the actual stored count.
Assisted-by: Codex