summaryrefslogtreecommitdiff
path: root/src/object.c
Commit message (Collapse)AuthorAgeFilesLines
* Lazyfree: Hash converted to use plain SDS WIP 4.antirez2015-10-011-1/+1
|
* Lazyfree: Hash converted to use plain SDS WIP 2.antirez2015-10-011-31/+1
|
* Lazyfree: Hash converted to use plain SDS WIP 1.antirez2015-10-011-6/+15
|
* Lazyfree: Convert Sets to use plains SDS (several commits squashed).antirez2015-10-011-1/+5
|
* Lazyfree: a first implementation of non blocking DEL.antirez2015-10-011-3/+20
|
* RDMF: More consistent define names.antirez2015-07-271-18/+18
|
* RDMF: REDIS_OK REDIS_ERR -> C_OK C_ERR.antirez2015-07-261-20/+20
|
* RDMF: redisAssert -> serverAssert.antirez2015-07-261-8/+8
|
* RDMF: OBJ_ macros for object related stuff.antirez2015-07-261-72/+72
|
* RDMF: use client instead of redisClient, like Disque.antirez2015-07-261-8/+8
|
* RDMF (Redis/Disque merge friendlyness) refactoring WIP 1.antirez2015-07-261-1/+1
|
* sds size classes - memory optimizationOran Agra2015-07-141-4/+5
|
* CONFIG refactoring: configEnum abstraction.antirez2015-03-111-3/+3
| | | | | | Still many things to convert inside config.c in the next commits. Some const safety in String objects creation and addReply() family functions.
* String: use new sdigits10() API in stringObjectLen().antirez2015-02-271-3/+1
| | | | | | Should be much faster, and regardless, the code is more obvious now compared to generating a string just to get the return value of the ll2stirng() function.
* Add quicklist implementationMatt Stancliff2015-01-021-10/+6
| | | | | | | | This replaces individual ziplist vs. linkedlist representations for Redis list operations. Big thanks for all the reviews and feedback from everybody in https://github.com/antirez/redis/pull/2143
* Handle infinite explicitly in createStringObjectFromLongLong().antirez2014-12-031-8/+20
|
* Use exp format and more precision output for ZSCAN.antirez2014-12-021-11/+17
| | | | Ref: issue #2175
* tryObjectEncoding(): use shared objects with maxmemory and non-LRU policy.antirez2014-07-181-1/+3
| | | | | | | | In order to make sure every object has its own private LRU counter, when maxmemory is enabled tryObjectEncoding() does not use the pool of shared integers. However when the policy is not LRU-based, it does not make sense to do so, and it is much better to save memory using shared integers.
* Fix OBJECT aritymichael-grunder2014-07-111-1/+1
| | | | | | | | | | | | | | | Previously, the command definition for the OBJECT command specified a minimum of two args (and that it was variadic), which meant that if you sent this: OBJECT foo When cluster was enabled, it would result in an assertion/SEGFAULT when Redis was attempting to extract keys. It appears that OBJECT is not variadic, and only ever takes 3 args. https://gist.github.com/michael-grunder/25960ce1508396d0d36a
* Fix lack of strtold under CygwinMatt Stancliff2014-05-121-0/+4
| | | | | | Renaming strtold to strtod then casting the result is the standard way of dealing with no strtold in Cygwin.
* REDIS_ENCODING_EMBSTR_SIZE_LIMIT set to 39.antirez2014-05-071-2/+5
| | | | | | The new value is the limit for the robj + SDS header + string + null-term to stay inside the 64 bytes Jemalloc arena in 64 bits systems.
* tryObjectEncoding() refactoring.antirez2014-04-041-42/+54
| | | | We also avoid to re-create an object that is already in EMBSTR encoding.
* String value unsharing refactored into proper function.antirez2014-03-301-1/+1
| | | | | | | | | | | All the Redis functions that need to modify the string value of a key in a destructive way (APPEND, SETBIT, SETRANGE, ...) require to make the object unshared (if refcount > 1) and encoded in raw format (if encoding is not already REDIS_ENCODING_RAW). This was cut & pasted many times in multiple places of the code. This commit puts the small logic needed into a function called dbUnshareStringValue().
* Use LRU_CLOCK() instead of function getLRUClock()Matt Stancliff2014-03-241-2/+2
| | | | | lookupKey() uses LRU_CLOCK(), so it seems object creation should use LRU_CLOCK() too.
* Use getLRUClock() instead of server.lruclock to create objects.antirez2014-03-211-2/+2
| | | | | Thanks to Matt Stancliff for noticing this error. It was in the original code but somehow I managed to remove the change from the commit...
* Fix OBJECT IDLETIME return value converting to seconds.antirez2014-03-201-2/+2
| | | | | estimateObjectIdleTime() returns a value in milliseconds now, so we need to scale the output of OBJECT IDLETIME to seconds.
* Obtain LRU clock in a resolution dependent way.antirez2014-03-201-3/+4
| | | | | | | | | | | | For testing purposes it is handy to have a very high resolution of the LRU clock, so that it is possible to experiment with scripts running in just a few seconds how the eviction algorithms works. This commit allows Redis to use the cached LRU clock, or a value computed on demand, depending on the resolution. So normally we have the good performance of a precomputed value, and a clock that wraps in many days using the normal resolution, but if needed, changing a define will switch behavior to an high resolution LRU clock.
* Specify LRU resolution in milliseconds.antirez2014-03-201-1/+1
|
* Fixed grammar: before H the article is a, not an.antirez2013-12-051-1/+1
|
* Remove useful check from tryObjectEncoding().antirez2013-08-271-2/+1
| | | | | | We are sure the string is large, since when the sds optimization branch is entered it means that it was not possible to encode it as EMBSTR for size concerns.
* tryObjectEncoding(): optimize sds strings if possible.antirez2013-08-271-1/+16
| | | | | | When no encoding is possible, at least try to reallocate the sds string with one that does not waste memory (with free space at the end of the buffer) when the string is large enough.
* tryObjectEncoding(): don't call stringl2() for too big strings.antirez2013-08-271-2/+6
| | | | | | | We are sure that a string that is longer than 21 chars cannot be represented by a 64 bit signed integer, as -(2^64) is 21 chars: strlen(-18446744073709551616) => 21
* Remove dead variable bothsds from object.c.antirez2013-07-281-3/+0
| | | | | | | | | | Thanks to @run and @badboy for spotting this. Triva: clang was not able to provide me a warning about that when compiling. This closes #1024 and #1207, committing the change myself as the pull requests no longer apply cleanly after other changes to the same function.
* Introduction of a new string encoding: EMBSTRantirez2013-07-221-20/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously two string encodings were used for string objects: 1) REDIS_ENCODING_RAW: a string object with obj->ptr pointing to an sds stirng. 2) REDIS_ENCODING_INT: a string object where the obj->ptr void pointer is casted to a long. This commit introduces a experimental new encoding called REDIS_ENCODING_EMBSTR that implements an object represented by an sds string that is not modifiable but allocated in the same memory chunk as the robj structure itself. The chunk looks like the following: +--------------+-----------+------------+--------+----+ | robj data... | robj->ptr | sds header | string | \0 | +--------------+-----+-----+------------+--------+----+ | ^ +-----------------------+ The robj->ptr points to the contiguous sds string data, so the object can be manipulated with the same functions used to manipulate plan string objects, however we need just on malloc and one free in order to allocate or release this kind of objects. Moreover it has better cache locality. This new allocation strategy should benefit both the memory usage and the performances. A performance gain between 60 and 70% was observed during micro-benchmarks, however there is more work to do to evaluate the performance impact and the memory usage behavior.
* Make sure that ZADD can accept the full range of double values.antirez2013-07-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes issue #1194, that contains many details. However in short, it was possible for ZADD to not accept as score values that was however possible to obtain with multiple calls to ZINCRBY, like in the following example: redis 127.0.0.1:6379> zadd k 2.5e-308 m (integer) 1 redis 127.0.0.1:6379> zincrby k -2.4e-308 m "9.9999999999999694e-310" redis 127.0.0.1:6379> zscore k m "9.9999999999999694e-310" redis 127.0.0.1:6379> zadd k 9.9999999999999694e-310 m1 (error) ERR value is not a valid float The problem was due to strtod() returning ERANGE in the following case specified by POSIX: "If the correct value would cause an underflow, a value whose magnitude is no greater than the smallest normalized positive number in the return type shall be returned and errno set to [ERANGE].". Now instead the returned value is accepted even when ERANGE is returned as long as the return value of the function is not negative or positive HUGE_VAL or zero.
* Fixed compareStringObject() and introduced collateStringObject().antirez2013-07-121-8/+33
| | | | | | | | | | | | | | | | | | | | | | | compareStringObject was not always giving the same result when comparing two exact strings, but encoded as integers or as sds strings, since it switched to strcmp() when at least one of the strings were not sds encoded. For instance the two strings "123" and "123\x00456", where the first string was integer encoded, would result into the old implementation of compareStringObject() to return 0 as if the strings were equal, while instead the second string is "greater" than the first in a binary comparison. The same compasion, but with "123" encoded as sds string, would instead return a value < 0, as it is correct. It is not impossible that the above caused some obscure bug, since the comparison was not always deterministic, and compareStringObject() is used in the implementation of skiplists, hash tables, and so forth. At the same time, collateStringObject() was introduced by this commit, so that can be used by SORT command to return sorted strings usign collation instead of binary comparison. See next commit.
* decrRefCount -> decrRefCountVoid in list constructor.antirez2013-01-281-1/+1
|
* Fix decrRefCount() prototype from void to robj pointer.antirez2013-01-281-3/+8
| | | | | | | | | decrRefCount used to get its argument as a void* pointer in order to be used as destructor where a 'void free_object(void*)' prototype is expected. However this made simpler to introduce bugs by freeing the wrong pointer. This commit fixes the argument type and introduces a new wrapper called decrRefCountVoid() that can be used when the void* argument is needed.
* Fixed many typos.guiquanz2013-01-191-1/+1
|
* BSD license added to every C source and header file.antirez2012-11-081-0/+30
|
* remove mentions of VM in commentsPremysl Hruby2012-04-021-11/+1
|
* remove disk-store related commentsPremysl Hruby2012-03-271-3/+1
|
* Code style hack.antirez2012-03-221-3/+3
|
* Result of INCRBYFLOAT and HINCRBYFLOAT should never be in exponential form, ↵antirez2012-03-221-2/+11
| | | | and also should never contain trailing zeroes. This is not possible with vanilla printf() format specifiers, so we alter the output.
* Encode small hashes with a ziplistPieter Noordhuis2012-01-021-8/+4
|
* string to number API is now more strict not accepting spaces before or after ↵antirez2011-11-141-10/+8
| | | | the number. A few tests converted to match the new error messages using the word float instead of double.
* INCRBYFLOAT implementationantirez2011-11-121-2/+57
|
* dict.c API names modified to be more coincise and consistent.antirez2011-11-081-1/+1
|
* replaced redisAssert() with redisAssertWithInfo() in a shitload of places.antirez2011-10-041-7/+7
|
* Replicate EVALSHA as EVAL taking a dictionary of sha1 -> script source code.antirez2011-07-131-0/+17
|