apache / apache/kvrocks

[bug] xpending not include the end

Open
#3,276 0 comments 0 reactions 0 assignees View on GitHub
bug
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

kvrocks_version:2.14.0

### Minimal reproduce step
```
# 1. 清理旧数据
DEL smtp

# 2. 创建 Consumer Group (send),同时创建流 (smtp),从 0 开始消费
XGROUP CREATE smtp send 0 MKSTREAM

# 3. 构造指定 ID 的消息
XADD smtp 1764415413212-0 type "bug_repro"

# 4. 首次读取:让消息进入 Pending 状态 (Delivery Count = 1)
# 此时消费者为 "test"
XREADGROUP GROUP send test COUNT 1 STREAMS smtp >

# 5. 再次认领并篡改状态:
# 使用 XCLAIM 强制将消息归属给 "test" (FORCE)
# 将 Delivery Count 增加 (此时变为 2)
# 强制设置空闲时间为 33444572 毫秒 (IDLE 33444572)
XCLAIM smtp send test 0 1764415413212-0 IDLE 33444572 FORCE

# ==========================================
# 下面开始演示 Bug 现象
# ==========================================

# 6. 第一步:运行指定 ID 范围的 XPENDING (你提到的返回为空的命令)
# 期望:应该返回 1 条数据
# 实际(Bug场景):(empty list or set)
XPENDING smtp send 1764415413212-0 1764415413212-0 1

# 7. 第二步:运行全范围 XPENDING (你提到的能查到的命令)
# 期望:返回包含 id, consumer(test), idle(33444572), count(2) 的数据
XPENDING smtp send - + 1

# 8. 第三步:再次运行指定 ID 范围确认
XPENDING smtp send 1764415413212-0 1764415413212-0 1
```
### What did you expect to see?

输出应该包含end

### What did you see instead?

没有包含end

### XPENDING 和 xrange 一样,都要包含end
https://redis.io/docs/latest/commands/xrange/
Image

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported XPENDING commands against Kvrocks 2.14.0, comparing the equal start and end ID query with the full-range query. Trace the XPENDING command entry point and verify that the specified end ID is included; done means the bounded query returns the same pending entry shown by the full-range query.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, redis
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.