LPOS with COUNT replies with bulk strings instead of integers
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start in src/commands/cmd_list.cc at CommandLPos::Execute, especially the lines that convert matching indexes and build the COUNT reply. Check the existing command tests for LPOS COUNT reply types, then run the relevant test after changing the response. Done means COUNT replies contain integer elements while preserving the documented empty-array and no-COUNT behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Search before asking
- I had searched in the issues and found no similar issues.
Version
- Kvrocks: unstable, commit 84e88322
- Compared with Redis 7.2.17 and Redis 8.0.5
Minimal reproduce step
DEL l
RPUSH l a b a
LPOS l a COUNT 1
LPOS l a COUNT 0
LPOS l a RANK -1 COUNT 2
What did you expect to see?
An array of integers, as in Redis. Redis 7.2.17 and 8.0.5 give the same output (redis-cli --no-raw):
> LPOS l a COUNT 1
1) (integer) 0
> LPOS l a COUNT 0
1) (integer) 0
2) (integer) 2
> LPOS l a RANK -1 COUNT 2
1) (integer) 2
2) (integer) 0
The LPOS docs say, for both RESP2 and RESP3:
Array reply: If the COUNT option is given, an array of integers representing the matching elements (or an empty array if there are no matches).
What did you see instead?
Kvrocks returns an array of bulk strings:
> LPOS l a COUNT 1
1) "0"
> LPOS l a COUNT 0
1) "0"
2) "2"
> LPOS l a RANK -1 COUNT 2
1) "2"
2) "0"
LPOS without COUNT already returns an integer (or nil) correctly, and the no-match case with COUNT returns an empty array correctly. Only the element type inside the COUNT array is wrong.
Anything Else?
The cause is in CommandLPos::Execute (src/commands/cmd_list.cc:886-891 on unstable). The indexes are converted with std::to_string() and sent with ArrayOfBulkStrings(), so each element is a bulk string instead of an integer reply.
The existing Go tests don't catch this because go-redis's LPosCount parses bulk strings like "2" into int64 without complaint. Clients that check reply types (or RESP3 clients that map types strictly) see strings.
Are you willing to submit a PR?
- I'm willing to submit a PR!
I'd like to work on this.
- Lingua principale
- C++
- Stelle
- 4.5k
- Fork
- 689
- Merge medio
- 1g 23h
- PR unite (30g)
- 36
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/kvrocks
-
HSETEXPIRE with an overflowing TTL returns OK and deletes the whole hashForse già presa @anubhavgupta121 l’ha presa 22 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Add docker build for alpine 3.24Forse già presa @aleksraiden l’ha presa 1 giorno fa. Apertaenhancement
apache/kvrocks#3768 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
`JSON.STRAPPEND` with non JSON value crashes the serverForse già presa @ggyuchive l’ha presa 2 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
apache/kvrocks#3765 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A blocked client that is woken but loses the element to another client is never woken againForse già presa @ggyuchive l’ha presa 3 giorni fa. Apertabug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
`GEOSEARCH` / `GEORADIUS` with a negative radius hangsForse già presa @ggyuchive l’ha presa 11 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/kvrocks
Issue simili
-
area:qmc bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
I maintainer di solito rispondono entro 3 giorni
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ASGC-Game-Jam/asgc-gamejam-2026#563 ·
I maintainer di solito rispondono entro 1 giorno
-
area/ysql kind/bug priority/medium status/awaiting-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
yugabyte/yugabyte-db#37523 ·
I maintainer di solito rispondono entro 1 giorno
-
Let agents name their jobsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Cockatrice/Cockatrice#7896 ·
I maintainer di solito rispondono entro 1 giorno