Grab

Uncovering the Truth Behind Lua and Redis Data Consistency

Sep 7, 2020Allen Wang
Uncovering the Truth Behind Lua and Redis Data Consistency
SummaryAI, from the source post

This post details the investigation and resolution of Redis master/replica data inconsistency caused by Lua scripts executing differently on master and replica nodes, leading to divergent hash encodings (hashtable vs. ziplist). The root cause was identified as Redis's behavior of executing Lua scripts independently on replicas and the potential for different hash encodings during RDB loading. The solution implemented was to ensure deterministic Lua script behavior by sorting the outputs of HKEYS/HGETALL, preventing data divergence and high CPU usage on replicas.

More from the Redis Data Consistency and Replication trail