]> git.saurik.com Git - redis.git/commit
ziplistFind(): don't assume that entries are comparable by encoding.
authorantirez <antirez@gmail.com>
Thu, 14 Jun 2012 13:59:25 +0000 (15:59 +0200)
committerantirez <antirez@gmail.com>
Thu, 14 Jun 2012 14:01:27 +0000 (16:01 +0200)
commitba779119b8b08294cdb776302638ee5b7b9b5b84
tree3e10799a2a00da986c14348d1ab61d9217cb5303
parent96b8ff3760b18d2962410322a56308d8410917c8
ziplistFind(): don't assume that entries are comparable by encoding.

Because Redis 2.6 introduced new integer encodings it is no longer true
that if two entries have a different encoding they are not equal.

An old ziplist can be loaded from an RDB file generated with Redis 2.4,
in this case for instance a small unsigned integers is encoded with a
16 bit encoding, while in Redis 2.6 a more specific 8 bit encoding
format is used.

Because of this bug hashes ended with duplicated values or fields lookup
failed, causing many bad behaviors.
This in turn caused a crash while converting the ziplist encoded hash into
a real hash table because an assertion was raised on duplicated elements.

This commit fixes issue #547.

Many thanks to Pinterest's Marty Weiner and colleagues for discovering
the problem and helping us in the debugging process.
src/ziplist.c