LPOS with COUNT replies with bulk strings instead of integers
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 4.5k
- Forks
- 689
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 36
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/kvrocks
-
HSETEXPIRE with an overflowing TTL returns OK and deletes the whole hashPosiblemente ocupada @anubhavgupta121 la tomó hace 22 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Add docker build for alpine 3.24Posiblemente ocupada @aleksraiden la tomó hace 1 día. Abiertoenhancement
apache/kvrocks#3768 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`JSON.STRAPPEND` with non JSON value crashes the serverPosiblemente ocupada @ggyuchive la tomó hace 2 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
apache/kvrocks#3765 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
A blocked client that is woken but loses the element to another client is never woken againPosiblemente ocupada @ggyuchive la tomó hace 3 días. Abiertobug
Dificultad 4/5 1-2 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
`GEOSEARCH` / `GEORADIUS` with a negative radius hangsPosiblemente ocupada @ggyuchive la tomó hace 11 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/kvrocks
Issues similares
-
area:qmc bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Los mantenedores suelen responder en 3 días
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
ASGC-Game-Jam/asgc-gamejam-2026#563 ·
Los mantenedores suelen responder en 1 día
-
area/ysql kind/bug priority/medium status/awaiting-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
yugabyte/yugabyte-db#37523 ·
Los mantenedores suelen responder en 1 día
-
Let agents name their jobsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Cockatrice/Cockatrice#7896 ·
Los mantenedores suelen responder en 1 día