1. 13 Sep, 2016 1 commit
    • antirez's avatar
      objectComputeSize(): estimate collections sampling N elements. · 89dec692
      antirez authored
      For most tasks, we need the memory estimation to be O(1) by default.
      This commit also implements an initial MEMORY command.
      Note that objectComputeSize() takes the number of samples to check as
      argument, so MEMORY should be able to get the sample size as option
      to make precision VS CPU tradeoff tunable.
      
      Related to: PR #3223.
      89dec692
  2. 09 Sep, 2016 2 commits
  3. 09 Aug, 2016 1 commit
  4. 03 Aug, 2016 2 commits
    • antirez's avatar
      Security: Cross Protocol Scripting protection. · a81a92ca
      antirez authored
      This is an attempt at mitigating problems due to cross protocol
      scripting, an attack targeting services using line oriented protocols
      like Redis that can accept HTTP requests as valid protocol, by
      discarding the invalid parts and accepting the payloads sent, for
      example, via a POST request.
      
      For this to be effective, when we detect POST and Host: and terminate
      the connection asynchronously, the networking code was modified in order
      to never process further input. It was later verified that in a
      pipelined request containing a POST command, the successive commands are
      not executed.
      a81a92ca
    • antirez's avatar
      Fix comment over 80 cols. · ede6e22c
      antirez authored
      ede6e22c
  5. 27 Jul, 2016 1 commit
    • antirez's avatar
      Ability of slave to announce arbitrary ip/port to master. · 55385f99
      antirez authored
      This feature is useful, especially in deployments using Sentinel in
      order to setup Redis HA, where the slave is executed with NAT or port
      forwarding, so that the auto-detected port/ip addresses, as listed in
      the "INFO replication" output of the master, or as provided by the
      "ROLE" command, don't match the real addresses at which the slave is
      reachable for connections.
      55385f99
  6. 21 Jul, 2016 1 commit
    • antirez's avatar
      Avoid simultaneous RDB and AOF child process. · 0a628e51
      antirez authored
      This patch, written in collaboration with Oran Agra (@oranagra) is a companion
      to 780a8b1d. Together the two patches should avoid that the AOF and RDB saving
      processes can be spawned at the same time. Previously conditions that
      could lead to two saving processes at the same time were:
      
      1. When AOF is enabled via CONFIG SET and an RDB saving process is
         already active.
      
      2. When the SYNC command decides to start an RDB saving process ASAP in
         order to serve a new slave that cannot partially resynchronize (but
         only if we have a disk target for replication, for diskless
         replication there is not such a problem).
      
      Condition "1" is not very severe but "2" can happen often and is
      definitely good at degrading Redis performances in an unexpected way.
      
      The two commits have the effect of always spawning RDB savings for
      replication in replicationCron() instead of attempting to start an RDB
      save synchronously. Moreover when a BGSAVE or AOF rewrite must be
      performed, they are instead just postponed using flags that will try to
      perform such operations ASAP.
      
      Finally the BGSAVE command was modified in order to accept a SCHEDULE
      option so that if an AOF rewrite is in progress, when this option is
      given, the command no longer returns an error, but instead schedules an
      RDB rewrite operation for when it will be possible to start it.
      0a628e51
  7. 20 Jul, 2016 1 commit
  8. 13 Jul, 2016 1 commit
    • antirez's avatar
      LRU: Make cross-database choices for eviction. · e423f76e
      antirez authored
      The LRU eviction code used to make local choices: for each DB visited it
      selected the best key to evict. This was repeated for each DB. However
      this means that there could be DBs with very frequently accessed keys
      that are targeted by the LRU algorithm while there were other DBs with
      many better candidates to expire.
      
      This commit attempts to fix this problem for the LRU policy. However the
      TTL policy is still not fixed by this commit. The TTL policy will be
      fixed in a successive commit.
      
      This is an initial (partial because of TTL policy) fix for issue #2647.
      e423f76e
  9. 12 Jul, 2016 1 commit
  10. 06 Jul, 2016 1 commit
  11. 01 Jul, 2016 1 commit
  12. 30 Jun, 2016 1 commit
    • antirez's avatar
      In Redis RDB check: initial POC. · e97fadb0
      antirez authored
      So far we used an external program (later executed within Redis) and
      parser in order to check RDB files for correctness. This forces, at each
      RDB format update, to have two copies of the same format implementation
      that are hard to keep in sync. Morover the former RDB checker only
      checked the very high-level format of the file, without actually trying
      to load things in memory. Certain corruptions can only be handled by
      really loading key-value pairs.
      
      This first commit attempts to unify the Redis RDB loadig code with the
      task of checking the RDB file for correctness. More work is needed but
      it looks like a sounding direction so far.
      e97fadb0
  13. 16 Jun, 2016 1 commit
  14. 14 Jun, 2016 1 commit
  15. 08 Jun, 2016 1 commit
  16. 05 Jun, 2016 1 commit
  17. 28 May, 2016 1 commit
    • Itamar Haber's avatar
      Allow SPOP from Lua scripts · 2866e023
      Itamar Haber authored
      The existing `R` flag appears to be sufficient and there's no apparent reason why the command should be blocked.
      2866e023
  18. 10 May, 2016 2 commits
  19. 09 May, 2016 1 commit
  20. 05 May, 2016 5 commits
  21. 04 May, 2016 3 commits
  22. 22 Apr, 2016 1 commit
    • therealbill's avatar
      fix for #3187 · 14086a46
      therealbill authored
      I've renamed maxmemoryToString to evictPolicyToString since that is
      more accurate (and easier to mentally connect with the correct data), as
      well as updated the function to user server.maxmemory_policy rather than
      server.maxmemory. Now with a default config it is actually returning
      the correct policy rather than volatile-lru.
      14086a46
  23. 02 Mar, 2016 1 commit
  24. 26 Feb, 2016 1 commit
    • antirez's avatar
      BITFIELD command initial implementation. · 70af626d
      antirez authored
      The new bitfield command is an extension to the Redis bit operations,
      where not just single bit operations are performed, but the array of
      bits composing a string, can be addressed at random, not aligned
      offsets, with any width unsigned and signed integers like u8, s5, u10
      (up to 64 bit signed integers and 63 bit unsigned integers).
      
      The BITFIELD command supports subcommands that can SET, GET, or INCRBY
      those arbitrary bit counters, with multiple overflow semantics.
      
      Trivial and credits:
      
      A similar command was imagined a few times in the past, but for
      some reason looked a bit far fetched or not well specified.
      Finally the command was proposed again in a clear form by
      Yoav Steinberg from Redis Labs, that proposed a set of commands on
      arbitrary sized integers stored at bit offsets.
      
      Starting from this proposal I wrote an initial specification of a single
      command with sub-commands similar to what Yoav envisioned, using short
      names for types definitions, and adding control on the overflow.
      
      This commit is the resulting implementation.
      
      Examples:
      
          BITFIELD mykey OVERFLOW wrap INCRBY i2 10 -1 GET i2 10
      70af626d
  25. 18 Feb, 2016 1 commit
  26. 03 Feb, 2016 1 commit
  27. 29 Jan, 2016 2 commits
  28. 26 Jan, 2016 1 commit
  29. 07 Jan, 2016 1 commit
    • antirez's avatar
      New security feature: Redis protected mode. · edd4d555
      antirez authored
      An exposed Redis instance on the internet can be cause of serious
      issues. Since Redis, by default, binds to all the interfaces, it is easy
      to forget an instance without any protection layer, for error.
      
      Protected mode try to address this feature in a soft way, providing a
      layer of protection, but giving clues to Redis users about why the
      server is not accepting connections.
      
      When protected mode is enabeld (the default), and if there are no
      minumum hints about the fact the server is properly configured (no
      "bind" directive is used in order to restrict the server to certain
      interfaces, nor a password is set), clients connecting from external
      intefaces are refused with an error explaining what to do in order to
      fix the issue.
      
      Clients connecting from the IPv4 and IPv6 lookback interfaces are still
      accepted normally, similarly Unix domain socket connections are not
      restricted in any way.
      edd4d555
  30. 17 Dec, 2015 1 commit
    • antirez's avatar
      Fix a race that may lead to the active (slave) client to be freed. · bb215375
      antirez authored
      In issue #2948 a crash was reported in processCommand(). Later Oran Agra
      (@oranagra) traced the bug (in private chat) in the following sequence
      of events:
      
      1. Some maxmemory is set.
      2. The slave is the currently active client and is executing PING or
         REPLCONF or whatever a slave can send to its master.
      3. freeMemoryIfNeeded() is called since maxmemory is set.
      4. flushSlavesOutputBuffers() is called by freeMemoryIfNeeded().
      5. During slaves buffers flush, a write error could be encoutered in
         writeToClient() or sendReplyToClient() depending on the version of
         Redis. This will trigger freeClient() against the currently active
         client, so a segmentation fault will likely happen in
         processCommand() immediately after the call to freeMemoryIfNeeded().
      
      There are different possible fixes:
      
      1. Add flags to writeToClient() (recent versions code base) so that
         we can ignore the write errors, and use this flag in
         flushSlavesOutputBuffers(). However this is not simple to do in older
         versions of Redis.
      2. Use freeClientAsync() during write errors. This works but changes the
         current behavior of releasing clients ASAP when possible. Normally
         we write to clients during the normal event loop processing, in the
         writable client, where there is no active client, so no care must be
         taken.
      3. The fix of this commit: to detect that the current client is no
         longer valid. This fix is a bit "ad-hoc", but works across all the
         versions and has the advantage of not changing the remaining
         behavior. Only alters what happens during this race condition,
         hopefully.
      bb215375