kirito632 opened a new pull request, #3504: URL: https://github.com/apache/kvrocks/pull/3504
## What This PR introduces the XACKDEL stream command with configurable PEL cleanup behaviors. It also fixes an existing issue in XINFO CONSUMERS where consumer metadata from different groups could leak into the same scan result. ## XINFO CONSUMERS Fix Root cause: [`GetConsumerInfo()`](src/types/redis_stream.cc) sets `iterate_upper_bound` by incrementing only the stream version while keeping the sub-key prefix unchanged. Since `InternalKey` encoding places the version field before the sub-key, consumer records belonging to other groups can still fall within the same `[version, version+1)` iteration range. Fix: Extract and validate the group name from each internal key during iteration, filtering out unrelated consumers. ## XACKDEL `XACKDEL key group [KEEPREF|DELREF|ACKED] IDS numids id [id ...]` Deletes stream entries with configurable PEL cleanup behavior. Supported deletion strategies: **KEEPREF** (default): Delete the stream entry only, without touching existing PEL references. **DELREF**: Delete the stream entry and remove it from all consumer groups' PELs. **ACKED**: Delete the stream entry only if it has been acknowledged by all consumer groups. Per-ID return codes: - `1`: entry deleted - `2`: entry retained (e.g. ACKED condition not satisfied) - `-1`: entry not found or duplicate ID within the same request ## Implementation Notes - Pending-number decrements are aggregated in memory and flushed through a single WriteBatch to avoid repeated metadata updates during DELREF operations. - Duplicate IDs are deduplicated to preserve idempotency and prevent stream metadata corruption. - The originating command name is propagated into [`WriteBatchExtractor`](src/storage/batch_extractor.cc) so replicas replay the exact same deletion semantics. - Internal stream metadata and PEL delete events are filtered out in [`WriteBatchExtractor`](src/storage/batch_extractor.cc) to avoid generating invalid replicated XDEL commands. ## Testing Added Go integration tests covering: - multi-group DELREF cleanup - ACKED blocking semantics - duplicate-ID idempotency - invalid syntax handling - XINFO CONSUMERS group isolation ## AI-Assisted Contribution Disclosure This contribution complies with the ASF AI-assisted contribution guidelines. AI tools were used to assist with English phrasing and some test scaffolding. The core C++ implementation, debugging, correctness analysis, and final verification were independently completed by me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
