1. 16 Jul, 2013 1 commit
  2. 12 Jul, 2013 2 commits
    • antirez's avatar
      SORT ALPHA: use collation instead of binary comparison. · 18fabeb2
      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.
      18fabeb2
    • antirez's avatar
      Fixed compareStringObject() and introduced collateStringObject(). · d8fcbb66
      antirez authored
      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.
      d8fcbb66
  3. 11 Jul, 2013 4 commits
    • antirez's avatar
      getClientPeerId() refactored into two functions. · 3472d045
      antirez authored
      3472d045
    • antirez's avatar
      getClientPeerId() now reports errors. · da183666
      antirez authored
      We now also use it in CLIENT KILL implementation.
      da183666
    • antirez's avatar
      getClientPeerID introduced. · 4fa68b28
      antirez authored
      The function returns an unique identifier for the client, as ip:port for
      IPv4 and IPv6 clients, or as path:0 for Unix socket clients.
      
      See the top comment in the function for more info.
      4fa68b28
    • Geoff Garside's avatar
      Add macro to define clusterNode.ip buffer size. · 68d72aa5
      Geoff Garside authored
      Add REDIS_CLUSTER_IPLEN macro to define the size of the clusterNode ip
      character array. Additionally use this macro in inet_ntop(3) calls where
      the size of the array was being defined manually.
      
      The REDIS_CLUSTER_IPLEN is defined as INET_ADDRSTRLEN which defines the
      correct size of a buffer to store an IPv4 address in. The
      INET_ADDRSTRLEN macro itself is defined in the <netinet/in.h> header
      file and should be portable across the majority of systems.
      68d72aa5
  4. 08 Jul, 2013 2 commits
  5. 01 Jul, 2013 1 commit
  6. 26 Jun, 2013 6 commits
    • antirez's avatar
      bb0d0fd4
    • antirez's avatar
      Don't disconnect pre PSYNC replication clients for timeout. · cdf79c06
      antirez authored
      Clients using SYNC to replicate are older implementations, such as
      redis-cli --slave, and are not designed to acknowledge the master with
      REPLCONF ACK commands, so we don't have any feedback and should not
      disconnect them on timeout.
      cdf79c06
    • antirez's avatar
      Use the RSC to replicate EVALSHA unmodified. · 545fe0c3
      antirez authored
      This commit uses the Replication Script Cache in order to avoid
      translating EVALSHA into EVAL whenever possible for both the AOF and
      slaves.
      545fe0c3
    • antirez's avatar
      Replication of scripts as EVALSHA: sha1 caching implemented. · 9d894b1b
      antirez authored
      This code is only responsible to take an LRU-evicted fixed length cache
      of SHA1 that we are sure all the slaves received.
      
      In this commit only the implementation is provided, but the Redis core
      does not use it to actually send EVALSHA to slaves when possible.
      9d894b1b
    • antirez's avatar
      New API to force propagation. · 8328d993
      antirez authored
      The old REDIS_CMD_FORCE_REPLICATION flag was removed from the
      implementation of Redis, now there is a new API to force specific
      executions of a command to be propagated to AOF / Replication link:
      
          void forceCommandPropagation(int flags);
      
      The new API is also compatible with Lua scripting, so a script that will
      execute commands that are forced to be propagated, will also be
      propagated itself accordingly even if no change to data is operated.
      
      As a side effect, this new design fixes the issue with scripts not able
      to propagate PUBLISH to slaves (issue #873).
      8328d993
    • antirez's avatar
      PUBSUB command implemented. · a8f1474d
      antirez authored
      Currently it implements three subcommands:
      
      PUBSUB CHANNELS [<pattern>]    List channels with non-zero subscribers.
      PUBSUB NUMSUB [channel_1 ...]  List number of subscribers for channels.
      PUBSUB NUMPAT                  Return number of subscribed patterns.
      a8f1474d
  7. 30 May, 2013 1 commit
  8. 27 May, 2013 3 commits
  9. 15 May, 2013 4 commits
  10. 24 Apr, 2013 2 commits
  11. 02 Apr, 2013 1 commit
    • antirez's avatar
      Throttle BGSAVE attempt on saving error. · d6b0c18c
      antirez authored
      When a BGSAVE fails, Redis used to flood itself trying to BGSAVE at
      every next cron call, that is either 10 or 100 times per second
      depending on configuration and server version.
      
      This commit does not allow a new automatic BGSAVE attempt to be
      performed before a few seconds delay (currently 5).
      
      This avoids both the auto-flood problem and filling the disk with
      logs at a serious rate.
      
      The five seconds limit, considering a log entry of 200 bytes, will use
      less than 4 MB of disk space per day that is reasonable, the sysadmin
      should notice before of catastrofic events especially since by default
      Redis will stop serving write queries after the first failed BGSAVE.
      
      This fixes issue #849
      d6b0c18c
  12. 28 Mar, 2013 1 commit
    • antirez's avatar
      DEBUG set-active-expire added. · 10d8e6a7
      antirez authored
      We need the ability to disable the activeExpireCycle() (active
      expired key collection) call for testing purposes.
      10d8e6a7
  13. 11 Mar, 2013 2 commits
  14. 06 Mar, 2013 1 commit
    • antirez's avatar
      API to lookup commands with their original name. · bc1b2e8f
      antirez authored
      A new server.orig_commands table was added to the server structure, this
      contains a copy of the commant table unaffected by rename-command
      statements in redis.conf.
      
      A new API lookupCommandOrOriginal() was added that checks both tables,
      new first, old later, so that rewriteClientCommandVector() and friends
      can lookup commands with their new or original name in order to fix the
      client->cmd pointer when the argument vector is renamed.
      
      This fixes the segfault of issue #986, but does not fix a wider range of
      problems resulting from renaming commands that actually operate on data
      and are registered into the AOF file or propagated to slaves... That is
      command renaming should be handled with care.
      bc1b2e8f
  15. 27 Feb, 2013 1 commit
  16. 26 Feb, 2013 1 commit
    • antirez's avatar
      Set process name in ps output to make operations safer. · ac3100bc
      antirez authored
      This commit allows Redis to set a process name that includes the binding
      address and the port number in order to make operations simpler.
      
      Redis children processes doing AOF rewrites or RDB saving change the
      name into redis-aof-rewrite and redis-rdb-bgsave respectively.
      
      This in general makes harder to kill the wrong process because of an
      error and makes simpler to identify saving children.
      
      This feature was suggested by Arnaud GRANAL in the Redis Google Group,
      Arnaud also pointed me to the setproctitle.c implementation includeed in
      this commit.
      
      This feature should work on all the Linux, OSX, and all the three major
      BSD systems.
      ac3100bc
  17. 12 Feb, 2013 5 commits
    • antirez's avatar
    • antirez's avatar
      5fe2577a
    • antirez's avatar
      700e5eb4
    • antirez's avatar
      Use replicationFeedSlaves() to send PING to slaves. · 01c21f99
      antirez authored
      A Redis master sends PING commands to slaves from time to time: doing
      this ensures that even if absence of writes, the master->slave channel
      remains active and the slave can feel the master presence, instead of
      closing the connection for timeout.
      
      This commit changes the way PINGs are sent to slaves in order to use the
      standard interface used to replicate all the other commands, that is,
      the function replicationFeedSlaves().
      
      With this change the stream of commands sent to every slave is exactly
      the same regardless of their exact state (Transferring RDB for first
      synchronization or slave already online). With the previous
      implementation the PING was only sent to online slaves, with the result
      that the output stream from master to slaves was not identical for all
      the slaves: this is a problem if we want to implement partial resyncs in
      the future using a global replication stream offset.
      
      TL;DR: this commit should not change the behaviour in practical terms,
      but is just something in preparation for partial resynchronization
      support.
      01c21f99
    • antirez's avatar
      Emit SELECT to slaves in a centralized way. · 5a35e485
      antirez authored
      Before this commit every Redis slave had its own selected database ID
      state. This was not actually useful as the emitted stream of commands
      is identical for all the slaves.
      
      Now the the currently selected database is a global state that is set to
      -1 when a new slave is attached, in order to force the SELECT command to
      be re-emitted for all the slaves.
      
      This change is useful in order to implement replication partial
      resynchronization in the future, as makes sure that the stream of
      commands received by slaves, including SELECT commands, are exactly the
      same for every slave connected, at any time.
      
      In this way we could have a global offset that can identify a specific
      piece of the master -> slaves stream of commands.
      5a35e485
  18. 11 Feb, 2013 1 commit
  19. 05 Feb, 2013 1 commit