Redis Get Your S* Together
Blog post from Upstash
The blog post discusses an intriguing bug in Redis Streams, focusing on its implications and the author's experience with their own Redis implementation at Upstash. The author introduces the issue with Redis Streams' lag reporting, noting that discrepancies arose when users reported incorrect lag values in QStash, a messaging solution built on their Redis implementation. The problem is traced to differences between QStash's lag calculation and Redis's definition, highlighting a bug in Redis version 7.2.4 where the reported lag doesn't match the specification after certain entries are deleted. The author describes their testing process using miniredis, a Go-based test environment for Redis, and the challenges of aligning with Redis's behavior despite its inconsistencies. They explain that the bug causes Redis to report an incorrect lag value, which should be NULL according to the specification when certain conditions are met. The author proposes a solution of resetting the entries-read counter to align with entries-added to maintain logical consistency. The post concludes with an update on a quick-fix from the Redis team and an invitation for feedback and discussion on Discord.