41 Commits

Author SHA1 Message Date
antirez
ded611636f assert.h replaced with redisassert.h when appropriate.
Also a warning was suppressed by including unistd.h in redisassert.h
(needed for _exit()).
2013-08-19 15:01:21 +02:00
Salvatore Sanfilippo
10aca2ba76 Merge pull request #776 from charsyam/ziplist-bug
fix randstring bug in ziplist.c
2013-07-02 03:18:18 -07:00
Pierre Chapuis
d1f1aab148 fix comments forgotten in #285 (zipmap -> ziplist) 2013-01-28 11:07:17 +01:00
charsyam
fad954fd74 fix randstring bug 2012-11-20 02:50:31 +08:00
antirez
a32d1ddff6 BSD license added to every C source and header file. 2012-11-08 18:31:32 +01:00
Pieter Noordhuis
d53250b9b7 Set p to its new offset before modifying it 2012-08-13 14:13:09 -07:00
Pieter Noordhuis
2251ed8462 Add ziplist test for deleting next to last entries 2012-08-13 14:09:40 -07:00
antirez
3fbd3b28a0 Don't assume that "char" is signed.
For the C standard char can be either signed or unsigned, it's up to the
compiler, but Redis assumed that it was signed in a few places.

The practical effect of this patch is that now Redis 2.6 will run
correctly in every system where char is unsigned, notably the RaspBerry
PI and other ARM systems with GCC.

Thanks to Georgi Marinov (@eesn on twitter) that reported the problem
and allowed me to use his RaspBerry via SSH to trace and fix the issue!
2012-07-18 12:04:58 +02:00
antirez
4ed0c22612 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.
2012-06-14 16:01:27 +02:00
Pieter Noordhuis
76196cc805 Compare integers in ziplist regardless of encoding
Because of the introduction of new integer encoding types for ziplists
in the 2.6 tree, the same integer value may have a different encoding in
different versions of the ziplist implementation. This means that the
encoding can NOT be used as a fast path in comparing integers.
2012-05-06 10:06:21 +02:00
antirez
f1f2a1b41f Spurious debugging printf removed. 2012-04-24 17:15:21 +02:00
antirez
e735c72945 Added two new encodings to ziplist.c
1) One integer "immediate" encoding that can encode from 0 to 12 in the
encoding byte itself.
2) One 8 bit signed integer encoding that can encode 8 bit signed small
integers in a single byte.

The idea is to exploit all the not used bits we have around in a
backward compatible way.
2012-04-24 17:04:00 +02:00
antirez
5806a33df0 ziplist.c: added comments about the new 24 bit encoding. 2012-04-24 12:52:36 +02:00
Grisha Trubetskoy
90e3a29f59 Add a 24bit integer to ziplists to save one byte for ints that can
fit in 24 bits (thanks to antirez for catching and solving the two's compliment
bug).

Increment REDIS_RDB_VERSION to 6
2012-04-24 12:02:19 +02:00
antirez
5b89814ce3 Big endian fix. The bug was introduced because of a typo. 2012-03-23 12:42:20 +01:00
antirez
afadac1728 Merge conflicts resolved. 2012-03-09 22:07:45 +01:00
antirez
9a68f79cd5 endian.c/h -> endianconv.c/h to avoid issues with broken libraries search paths. 2012-02-14 16:11:46 +01:00
antirez
f03979dbaf ziplist.c endianess fixes, chapter 5. 2012-02-09 17:09:01 +01:00
antirez
b87552bbb1 ziplist.c endianess fixes, chapter 4. 2012-02-09 16:36:25 +01:00
antirez
2b6f42d9de ziplist.c endianess fixes, chapter 3. 2012-02-09 16:28:35 +01:00
antirez
ab401f90d8 more ziplist.c endianess fixes 2012-02-08 23:20:39 +01:00
antirez
b10e6ebb86 ziplist.c fixes for bigendian 2012-02-08 22:59:35 +01:00
Pieter Noordhuis
3805b34212 Implements ziplistFind
To improve the performance of the ziplist implementation, some
functions have been converted to macros to avoid unnecessary stack
movement and duplicate variable assignments.
2012-01-03 16:13:42 -08:00
antirez
f846ddf3ed Fixed a few warnings compiling on Linux. 2011-10-23 10:57:01 +02:00
Pieter Noordhuis
d23e88bde2 Use string2ll in ziplist code (faster) 2011-05-05 16:26:51 +02:00
Pieter Noordhuis
8ca0b834ad Fix ziplist regression and update stresser 2011-05-05 15:16:51 +02:00
Pieter Noordhuis
b254ad427c Merge branch 'unstable' into unstable-zset
Conflicts:
	src/object.c
2011-04-06 16:15:01 +02:00
Pieter Noordhuis
b423656da7 Offset should be size_t 2011-03-14 10:53:53 +01:00
antirez
deef247f99 ziplist are now endianess agnostic 2011-03-09 18:49:59 +01:00
antirez
67bed5274d encoded types API to get blob length 2011-02-28 14:48:49 +01:00
Pieter Noordhuis
11993c1a39 Fix compiler warnings on Solaris 2010-12-23 11:26:11 +00:00
antirez
fda6e59e9a LRANGE converted into a COW friendly command. Some refactoring, comment, and new addReply*() family function added in the process. 2010-12-07 16:33:13 +01:00
antirez
82105585b2 removed a number of stupid compilation warnings on Linux 2010-11-02 11:15:09 +01:00
Pieter Noordhuis
d53a991b11 Replace ziplist stresser and fix regression 2010-10-14 21:11:42 +02:00
Pieter Noordhuis
37f535eaff Add regression test and fix for >255 byte string entries 2010-09-23 22:04:19 +02:00
Pieter Noordhuis
84403fe7c1 Allow a random seed argument for the ziplist test binary 2010-09-07 00:08:42 +02:00
Pieter Noordhuis
169d2ef1e0 Fix updating the prevlen field of consecutive entries
In the condition where the prevlen field of the next entry on insert
and delete operations needs more bytes to be properly encoded, the next
entry also needs to be updated with a new prevlen. This patch makes sure
that this effect cascades throughout the ziplist.
2010-09-07 00:04:57 +02:00
Pieter Noordhuis
c470538142 Make ziplist schema more efficient for strings with length > 15 2010-08-13 19:29:22 +02:00
antirez
6171250871 fixed a ziplist bug about encoding of integer values overflowing 64 bit 2010-07-27 15:26:08 +02:00
antirez
3688d7f308 Compilation fixed on Linux after the source code split 2010-07-01 21:13:38 +02:00
antirez
e2641e09cc redis.c split into many different C files.
networking related stuff moved into networking.c

moved more code

more work on layout of source code

SDS instantaneuos memory saving. By Pieter and Salvatore at VMware ;)

cleanly compiling again after the first split, now splitting it in more C files

moving more things around... work in progress

split replication code

splitting more

Sets split

Hash split

replication split

even more splitting

more splitting

minor change
2010-07-01 14:38:51 +02:00