1. 05 Dec, 2013 1 commit
  2. 22 Jul, 2013 1 commit
    • antirez's avatar
      Introduction of a new string encoding: EMBSTR · 894eba07
      antirez authored
      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.
      894eba07
  3. 12 Jul, 2013 1 commit
    • antirez's avatar
      SORT ALPHA: use collation instead of binary comparison. · cf1579a7
      antirez authored
      Note that we only do it when STORE is not used, otherwise we want an
      absolutely locale independent and binary safe sorting in order to ensure
      AOF / replication consistency.
      
      This is probably an unexpected behavior violating the least surprise
      rule, but there is currently no other simple / good alternative.
      cf1579a7
  4. 28 Jan, 2013 2 commits
  5. 19 Jan, 2013 1 commit
  6. 08 Nov, 2012 1 commit
  7. 03 Oct, 2012 1 commit
    • antirez's avatar
      "SORT by nosort" (skip sorting) respect sorted set ordering. · 9a914a63
      antirez authored
      When SORT is called with the option BY set to a string constant not
      inclduing the wildcard character "*", there is no way to sort the output
      so any ordering is valid. This allows the SORT internals to optimize its
      work and don't really sort the output at all.
      
      However it was odd that this option was not able to retain the natural
      order of a sorted set. This feature was requested by users multiple
      times as sometimes to call SORT with GET against sorted sets as a way to
      mass-fetch objects can be handy.
      
      This commit introduces two things:
      
      1) The ability of SORT to return sorted sets elements in their natural
      ordering when `BY nosort` is specified, accordingly to `DESC / ASC` options.
      2) The ability of SORT to optimize this case further if LIMIT is passed
      as well, avoiding to really fetch the whole sorted set, but directly
      obtaining the specified range.
      
      Because in this case the sorting is always deterministic, no
      post-sorting activity is performed when SORT is called from a Lua
      script.
      
      This commit fixes issue #98.
      9a914a63
  8. 04 Sep, 2012 1 commit
    • antirez's avatar
      Scripting: Force SORT BY constant determinism inside SORT itself. · 36741b2c
      antirez authored
      SORT is able to return (faster than when ordering) unordered output if
      the "BY" clause is used with a constant value. However we try to play
      well with scripting requirements of determinism providing always sorted
      outputs when SORT (and other similar commands) are called by Lua
      scripts.
      
      However we used the general mechanism in place in scripting in order to
      reorder SORT output, that is, if the command has the "S" flag set, the
      Lua scripting engine will take an additional step when converting a
      multi bulk reply to Lua value, calling a Lua sorting function.
      
      This is suboptimal as we can do it faster inside SORT itself.
      This is also broken as issue #545 shows us: basically when SORT is used
      with a constant BY, and additionally also GET is used, the Lua scripting
      engine was trying to order the output as a flat array, while it was
      actually a list of key-value pairs.
      
      What we do know is to recognized if the caller of SORT is the Lua client
      (since we can check this using the REDIS_LUA_CLIENT flag). If so, and if
      a "don't sort" condition is triggered by the BY option with a constant
      string, we force the lexicographical sorting.
      
      This commit fixes this bug and improves the performance, and at the same
      time simplifies the implementation. This does not mean I'm smart today,
      it means I was stupid when I committed the original implementation ;)
      36741b2c
  9. 18 Apr, 2012 1 commit
  10. 17 Apr, 2012 1 commit
    • antirez's avatar
      lookupKeyByPattern() used by SORT GET/BY rewritten. Fixes issue #460. · 3c25c4a6
      antirez authored
      lookupKeyByPattern() was implemented with a trick to speedup the lookup
      process allocating two fake Redis obejcts on the stack. However now that
      we propagate expires to the slave as DEL operations the lookup of the
      key may result into a call to expireIfNeeded() having the stack
      allocated object as argument, that may in turn use it to create the
      protocol to send to the slave. But since this fake obejcts are
      inherently read-only this is a problem.
      
      As a side effect of this fix there are no longer size limits in the
      pattern to be used with GET/BY option of SORT.
      
      See https://github.com/antirez/redis/issues/460 for bug details.
      3c25c4a6
  11. 01 Feb, 2012 2 commits
    • antirez's avatar
      Make SORT BY <constant> STORE ... to always produce the same output by force... · de79a2ee
      antirez authored
      Make SORT BY <constant> STORE ... to always produce the same output by force sorting, so that we have deterministic replication of this command.
      de79a2ee
    • antirez's avatar
      SORT is now more deterministic: does not accept to compare by score items that... · 2c861050
      antirez authored
      SORT is now more deterministic: does not accept to compare by score items that have scores not representing a valid double. Also items with the same score are compared lexycographically. At the same time the scripting side introduced the ability to sort the output of SORT when sort uses the BY <constant> optimization, resulting in no specific ordering. Since in this case the user may use GET, and the result of GET can be null, converted into false as Lua data type, this commit also introduces the ability to sort Lua tables containining false, only if the first (faster) attempt at using just table.sort with a single argument fails.
      2c861050
  12. 30 Jan, 2012 1 commit
  13. 19 Dec, 2011 1 commit
    • BigCat's avatar
      Fix issue #247 : Accepting non-integer parameters when shouldn't · 706b32e0
      BigCat authored
      Using `getLongFromObjectOrReply` instead of `atoi` if possible.
      The following functions are modified.
      
      * lrangeCommand
      * ltrimCommand
      * lremCommand
      * lindexCommand
      * lsetCommand
      * zunionInterGenericCommand
      * genericZrangebyscoreCommand
      * sortCommand
      706b32e0
  14. 01 Dec, 2011 1 commit
  15. 08 Nov, 2011 1 commit
  16. 04 Oct, 2011 1 commit
  17. 20 Jun, 2011 1 commit
  18. 06 Apr, 2011 1 commit
  19. 14 Mar, 2011 1 commit
  20. 29 Dec, 2010 1 commit
  21. 10 Dec, 2010 1 commit
  22. 09 Dec, 2010 1 commit
  23. 02 Sep, 2010 2 commits
  24. 21 Aug, 2010 2 commits
  25. 12 Jul, 2010 1 commit
  26. 01 Jul, 2010 1 commit
    • antirez's avatar
      redis.c split into many different C files. · e2641e09
      antirez authored
      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
      e2641e09