Skip to content

Add new stream commands #3711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 24, 2025
Merged

Add new stream commands #3711

merged 3 commits into from
Jul 24, 2025

Conversation

ofekshenawa
Copy link
Contributor

New Redis stream commands (XDELEX, XACKDEL) and extends existing commands (XTRIM, XADD) with enhanced consumer group reference control functionality.

XDELEX

Extended version of XDEL that provides more control over how message entries are deleted concerning consumer groups.

Syntax: XDELEX key [KEEPREF | DELREF | ACKED] IDS numids id [id ...]

XACKDEL

Combines the functionality of XACK and XDEL. Acknowledges messages in a consumer group and simultaneously attempts to delete the corresponding entries from the stream.

Syntax: XACKDEL key group [KEEPREF | DELREF | ACKED] IDS numids id [id ...]

@ofekshenawa ofekshenawa marked this pull request as ready for review July 16, 2025 16:32
@petyaslavova petyaslavova requested a review from Copilot July 22, 2025 14:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds new Redis stream commands (XDELEX, XACKDEL) and extends existing commands (XTRIM, XADD) with enhanced consumer group reference control functionality through a new ref_policy parameter.

  • Introduces XDELEX command for controlled message deletion with consumer group reference handling
  • Adds XACKDEL command that combines acknowledgment and deletion operations
  • Extends XTRIM and XADD commands with optional ref_policy parameter for consumer group reference control

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
redis/commands/core.py Implements the new XDELEX and XACKDEL methods, adds ref_policy parameter to XADD and XTRIM methods
tests/test_commands.py Adds comprehensive test coverage for all new commands and enhanced functionality
tests/test_asyncio/test_commands.py Adds async test coverage mirroring the synchronous tests
Comments suppressed due to low confidence (2)

redis/commands/core.py:3563

  • This line shows the removal of the original NOMKSTREAM placement. The move from this location (after limit processing) to before maxlen processing creates an incorrect command structure that doesn't match Redis XADD command syntax.
        if ref_policy is not None:

redis/commands/core.py:3564

  • The removal of this NOMKSTREAM append operation, combined with its relocation, disrupts the proper Redis command structure. NOMKSTREAM should be positioned correctly according to Redis XADD syntax requirements.
            pieces.append(ref_policy)

@ofekshenawa ofekshenawa force-pushed the create-new-stream-commands branch from 8c83496 to f307cff Compare July 24, 2025 14:16
@petyaslavova petyaslavova merged commit 67ab74d into master Jul 24, 2025
67 of 68 checks passed
@petyaslavova petyaslavova deleted the create-new-stream-commands branch July 24, 2025 16:46
petyaslavova pushed a commit that referenced this pull request Jul 25, 2025
* Add new stream commands

* optimization changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants