1. 13 8月, 2014 1 次提交
  2. 08 8月, 2014 1 次提交
    • M
      Reject MOVE to non-integer DBs · 498ad748
      Matt Stancliff 提交于
      Previously, "MOVE key somestring" would move the key to
      DB 0 which is just unexpected and wrong.
      String as DB == error.
      
      Test added too.
      
      Modified by @antirez in order to use the getLongLongFromObject() API
      instead of strtol().
      
      Fixes #1428
      498ad748
  3. 07 8月, 2014 1 次提交
    • M
      Fix key extraction for SORT · 87815ab5
      Matt Stancliff 提交于
      We only want to use the last STORE key, but we have to record
      we actually found a STORE key so we can increment the final return
      key count.
      
      Test added to prevent further regression.
      
      Closes #1883, #1645, #1647
      87815ab5
  4. 27 6月, 2014 1 次提交
  5. 21 5月, 2014 1 次提交
    • M
      Fix blocking operations from missing new lists · 33f943b4
      Matt Stancliff 提交于
      Behrad Zari discovered [1] and Josiah reported [2]: if you block
      and wait for a list to exist, but the list creates from
      a non-push command, the blocked client never gets notified.
      
      This commit adds notification of blocked clients into
      the DB layer and away from individual commands.
      
      Lists can be created by [LR]PUSH, SORT..STORE, RENAME, MOVE,
      and RESTORE.  Previously, blocked client notifications were
      only triggered by [LR]PUSH.  Your client would never get
      notified if a list were created by SORT..STORE or RENAME or
      a RESTORE, etc.
      
      Blocked client notification now happens in one unified place:
        - dbAdd() triggers notification when adding a list to the DB
      
      Two new tests are added that fail prior to this commit.
      
      All test pass.
      
      Fixes #1668
      
      [1]: https://groups.google.com/forum/#!topic/redis-db/k4oWfMkN1NU
      [2]: #1668
      33f943b4
  6. 14 5月, 2014 1 次提交
    • A
      Cluster: better handling of stolen slots. · 6baac558
      antirez 提交于
      The previous code handling a lost slot (by another master with an higher
      configuration for the slot) was defensive, considering it an error and
      putting the cluster in an odd state requiring redis-cli fix.
      
      This was changed, because actually this only happens either in a
      legitimate way, with failovers, or when the admin messed with the config
      in order to reconfigure the cluster. So the new code instead will try to
      make sure that the keys stored match the new slots map, by removing all
      the keys in the slots we lost ownership from.
      
      The function that deletes the keys from the lost slots is called only
      if the node does not lose all its slots (resulting in a reconfiguration
      as a slave of the node that got ownership). This is an optimization
      since the replication code will anyway flush all the instance data in
      a faster way.
      6baac558
  7. 17 4月, 2014 1 次提交
  8. 11 4月, 2014 1 次提交
  9. 31 3月, 2014 1 次提交
    • A
      String value unsharing refactored into proper function. · 543ede03
      antirez 提交于
      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().
      543ede03
  10. 20 3月, 2014 2 次提交
    • A
      struct dictEntry -> dictEntry. · 82b53c65
      antirez 提交于
      82b53c65
    • A
      Obtain LRU clock in a resolution dependent way. · ad6b0f70
      antirez 提交于
      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.
      ad6b0f70
  11. 10 3月, 2014 8 次提交
  12. 08 3月, 2014 1 次提交
    • M
      Fix key extraction for z{union,inter}store · f0782a6e
      Matt Stancliff 提交于
      The previous implementation wasn't taking into account
      the storage key in position 1 being a requirement (it
      was only counting the source keys in positions 3 to N).
      
      Fixes antirez/redis#1581
      f0782a6e
  13. 07 2月, 2014 1 次提交
  14. 03 2月, 2014 1 次提交
    • A
      Scripting: expire keys in scripts only at first access. · b089ba98
      antirez 提交于
      Keys expiring in the middle of the execution of Lua scripts are to
      create inconsistencies in masters and / or AOF files. See the following
      example:
      
          if redis.call("exists",KEYS[1]) == 1
          then
              redis.call("incr","mycounter")
          end
      
          if redis.call("exists",KEYS[1]) == 1
          then
              return redis.call("incr","mycounter")
          end
      
      The script executes two times the same *if key exists then incrementcounter*
      logic. However the two executions will work differently in the master and
      the slaves, provided some unlucky timing happens.
      
      In the master the first time the key may still exist, while the second time
      the key may no longer exist. This will result in the key incremented just one
      time. However as a side effect the master will generate a synthetic
      `DEL` command in the replication channel in order to force the slaves to
      expire the key (given that key expiration is master-driven).
      
      When the same script will run in the slave, the key will no longer be
      there, so the script will not increment the key.
      
      The key idea used to implement the expire-at-first-lookup semantics was
      provided by Marc Gravell.
      b089ba98
  15. 11 12月, 2013 1 次提交
    • A
      dict.c: added optional callback to dictEmpty(). · 2eb781b3
      antirez 提交于
      Redis hash table implementation has many non-blocking features like
      incremental rehashing, however while deleting a large hash table there
      was no way to have a callback called to do some incremental work.
      
      This commit adds this support, as an optiona callback argument to
      dictEmpty() that is currently called at a fixed interval (one time every
      65k deletions).
      2eb781b3
  16. 05 12月, 2013 1 次提交
  17. 06 11月, 2013 2 次提交
  18. 05 11月, 2013 5 次提交
    • A
      SCAN code refactored to parse cursor first. · ebcb6251
      antirez 提交于
      The previous implementation of SCAN parsed the cursor in the generic
      function implementing SCAN, SSCAN, HSCAN and ZSCAN.
      
      The actual higher-level command implementation only checked for empty
      keys and return ASAP in that case. The result was that inverting the
      arguments of, for instance, SSCAN for example and write:
      
          SSCAN 0 key
      
      Instead of
      
          SSCAN key 0
      
      Resulted into no error, since 0 is a non-existing key name very likely.
      Just the iterator returned no elements at all.
      
      In order to fix this issue the code was refactored to extract the
      function to parse the cursor and return the error. Every higher level
      command implementation now parses the cursor and later checks if the key
      exist or not.
      ebcb6251
    • A
      SCAN: when iterating ziplists or intsets always return cursor of 0. · b4048dfe
      antirez 提交于
      The previous implementation assumed that the first call always happens
      with cursor set to 0, this may not be the case, and we want to return 0
      anyway otherwise the (broken) client code will loop forever.
      b4048dfe
    • A
      Use strtoul() instead of sscanf() in SCAN implementation. · 101d4bf8
      antirez 提交于
      101d4bf8
    • A
      HSCAN/ZSCAN: skip value when matching. · f56f78d1
      antirez 提交于
      This fixes issue #1360 and #1362.
      f56f78d1
    • A
      Pass int64_t to intsetGet() instead of long long. · eb95d288
      antirez 提交于
      eb95d288
  19. 31 10月, 2013 2 次提交
  20. 28 10月, 2013 2 次提交
  21. 25 10月, 2013 5 次提交