Inconsistent behavior with Redis in BITFIELD GET command
- Dominant language
- C++
- Stars
- 4.4k
- Forks
- 658
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 10
Description
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
### Version
Docker Image SHA:707f93473e7265df39593d38d83081ec1a6a36da31c97b391008858eb45a437f
kvrocks 镜像版本:sha256:707f93473e7265df39593d38d83081ec1a6a36da31c97b391008858eb45a437f
### Minimal reproduce step
1. kvrocks设置位图01011000对应字母X:
redis-cli -h 192.168.1.72 -p 6666
192.168.1.72:6666> flushdb
OK
192.168.1.72:6666> SETBIT A 0 0
(integer) 0
192.168.1.72:6666> SETBIT A 1 1
(integer) 0
192.168.1.72:6666> SETBIT A 2 0
(integer) 0
192.168.1.72:6666> SETBIT A 3 1
(integer) 0
192.168.1.72:6666> SETBIT A 4 1
(integer) 0
192.168.1.72:6666> SETBIT A 5 0
(integer) 0
192.168.1.72:6666> SETBIT A 6 0
(integer) 0
192.168.1.72:6666> SETBIT A 7 0
(integer) 0
192.168.1.72:6666> GET A
"X"
192.168.1.72:6666> bitfield A get u7 0
1) (integer) 13
2. redis设置位图01011000对应字母X:
redis-cli -h 192.168.1.72 -p 6379
192.168.1.72:6379> flushdb
OK
192.168.1.72:6379> SETBIT A 0 0
(integer) 0
192.168.1.72:6379> SETBIT A 1 1
(integer) 0
192.168.1.72:6379> SETBIT A 2 0
(integer) 0
192.168.1.72:6379> SETBIT A 3 1
(integer) 0
192.168.1.72:6379> SETBIT A 4 1
(integer) 0
192.168.1.72:6379> SETBIT A 5 0
(integer) 0
192.168.1.72:6379> SETBIT A 6 0
(integer) 0
192.168.1.72:6379> SETBIT A 7 0
(integer) 0
192.168.1.72:6379> GET A
"X"
192.168.1.72:6379> bitfield A get u7 0
1) (integer) 44
### What did you expect to see?
设置位图01011000对应字母X,通过bitfield从0偏移量获取7位,kvrocks结果是13(0001101),redis是44(0101100),从bitfield定义中,预期应该是redis对应的结果。
### What did you see instead?
-
### Anything Else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the BITFIELD GET discrepancy using the commands and Docker image SHA in the issue, then locate the command implementation and its existing tests. Compare Kvrocks with Redis for the u7 0 request on the 01011000 bitmap; done means the result follows the documented Redis-compatible behavior, including the expected value of 44.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, redis
- Domain
- backend-api-design, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100