kirito632 opened a new pull request, #3502:
URL: https://github.com/apache/kvrocks/pull/3502

   ## What
   
   This PR introduces the XDELEX 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() used iterator bounds based only on the stream version range
   ([version, version+1)).
   
   Since the InternalKey encoding places the version field before the sub-key,
   consumer records from other groups could still fall within the same iteration
   range.
   
   Fix:
   
   Extract and validate the group name from each internal key during iteration,
   filtering out unrelated consumers.
   
   ## XDELEX
   
   Supported deletion strategies:
   
   KEEPREF (default):
   Delete the stream entry only.
   DELREF:
   Delete the stream entry and remove it from all 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
   so replicas replay the exact same deletion semantics.
   Internal stream metadata and PEL delete events are filtered out in
   WriteBatchExtractor 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]

Reply via email to