Skip to content

[NEW] Blocking SMOVE/ZMOVE #9989

Closed
Closed

Description

@heaven

Building a tool similar to Sidekiq but that works with multiple processes, dedicated for web crawling.

We use the queue where we need:

  • unique values
  • ordered by the priority

Sorted sets sound like a great option and they have BZPOPMIN/MAX. While the work is picked up from Redis we then need to push it back to another sorted set that holds "work in progress".

Depending on a result move it either to throttled, suspended, failed, etc sets, keeping the original score.

The fact we need to get data from Redis and push it back creates a point of failure in the case of an unexpected error, segmentation-fault, or other disruptions the work fetched from Redis will be lost.

Instead, it would be great to have atomic operations such as BLMOVE for lists. This way we can move jobs back and forth without the risk of losing them and properly recover after a failure.

Activity

  1. added this to the Next minor backlog milestone on Dec 23, 2021
  2. heaven commented on Dec 23, 2021

    @heaven
    Author

    Forgot to mention that having non-blocking versions of these would also be fantastic.

  3. itamarhaber commented on Dec 23, 2021

    @itamarhaber
    Member

    Hello @heaven - I like what you're saying, which sounds to me like: BZMOVE <source> <destination> MIN|MAX [BYSCORE | BYLEX] <timeout> (and a ZMOVE w/o the timeout).

    I'm unsure about SMOVE's necessity, especially given SPOP's semi-randomness, so more details would probably help me to understand.

  4. heaven commented on Dec 23, 2021

    @heaven
    Author

    Hello @itamarhaber, regarding sets we also have a use case where we could use them instead of lists to prevent duplicates in the queue and SPOP doesn't work due to race conditions when multiple workers pick up the same job. But our primary missing feature is BZMOVE which would make our application quite bulletproof.

  5. VeaaC commented on May 11, 2022

    @VeaaC

    I am definitely looking forward to BZMOVE, as it enables us to implement reliable per-customer-FIFO priority queues much more efficiently.

  6. moved this to backlog in Redis Backlogon Jul 6, 2022
  7. piskvorky commented on Dec 1, 2022

    @piskvorky

    +1: we have an almost identical need for atomic ZMOVE / BZMOVE. Also to prevent race conditions when shuffling elements between work-in-progress ordered sets.

  8. gabzim commented on Dec 31, 2022

    @gabzim

    Is this still in scope?

  9. guybe7 commented on Jan 16, 2023

    @guybe7
    Collaborator

    [B]ZMOVE added in #10430

  10. linked a pull request that will close this issueAdd bzmove,zmove,zmovemember commands #10430on Jan 18, 2023
  11. sundb commented on Nov 11, 2026

    @sundb
    Collaborator

    Closed via #16135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions