sripathikrishnan/redis-rdb-tools — pull request #16 by cgordon (2012-10-04 05:36:59+00:00)
Title: Quick Bug Fix

The dump.rdb for one of our Redis databases was crashing when I ran "rdb" on it, but was loading fine into Redis. After a few hours of hunting around, I figured out that there was an endian issue. The code in ziplist.c, from Redis, writes out the length of ziplist entries as a 4-byte, big-endian value, but only when the entry is more than 16,383 bytes. That doesn't happen by default, since hash-max-ziplist-value is 4096. The database that was having trouble just happened to have a higher value for that option. Everything else written out by Redis is little-endian, as far as I can, so this was pretty surprising!

The change here fixes the bug, and I've added a test to check for it (but you have to run Redis with the appropriate option, or the test doesn't check anything).