ERM redis data_error ai_generated true

ERR Consumer group offset rollback detected: last-delivered-id < oldest-id

ID: redis/stream-consumer-group-offset-rollback

Also available as: JSON · Markdown · 中文
90%Fix Rate
83%Confidence
1Evidence
2024-01-25First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
6.2 active
7.0 active
7.2 active

Root Cause

The stream was trimmed or deleted, causing the consumer group's last-delivered-id to be older than the oldest entry in the stream, leading to an inconsistent state.

generic

中文

流被修剪或删除,导致消费者组的 last-delivered-id 早于流中最旧的条目,导致状态不一致。

Official Documentation

https://redis.io/docs/latest/commands/xgroup-setid/

Workarounds

  1. 92% success Run 'XGROUP SETID mystream mygroup 0-0' to reset to the beginning, then use XREADGROUP to re-process from the oldest entry.
    Run 'XGROUP SETID mystream mygroup 0-0' to reset to the beginning, then use XREADGROUP to re-process from the oldest entry.
  2. 88% success Set XTRIM with a minimum ID that is older than the group's last-delivered-id: 'XTRIM mystream MINID ~ <last-delivered-id>'.
    Set XTRIM with a minimum ID that is older than the group's last-delivered-id: 'XTRIM mystream MINID ~ <last-delivered-id>'.

中文步骤

  1. 运行 'XGROUP SETID mystream mygroup 0-0' 重置到开头,然后使用 XREADGROUP 从最旧条目重新处理。
  2. 设置 XTRIM 的最小 ID 早于组的 last-delivered-id:'XTRIM mystream MINID ~ <last-delivered-id>'。

Dead Ends

Common approaches that don't work:

  1. 70% fail

    May cause duplicate processing of already-consumed messages.

  2. 60% fail

    Loses all pending messages and consumer state; not suitable for production.

  3. 90% fail

    Consumer group will be stuck; no new messages delivered.