1. 14 1月, 2014 1 次提交
  2. 08 1月, 2014 1 次提交
    • A
      Don't send REPLCONF ACK to old masters. · 2a1a31ca
      antirez 提交于
      Masters not understanding REPLCONF ACK will reply with errors to our
      requests causing a number of possible issues.
      
      This commit detects a global replication offest set to -1 at the end of
      the replication, and marks the client representing the master with the
      REDIS_PRE_PSYNC flag.
      
      Note that this flag was called REDIS_PRE_PSYNC_SLAVE but now it is just
      REDIS_PRE_PSYNC as it is used for both slaves and masters starting with
      this commit.
      
      This commit fixes issue #1488.
      2a1a31ca
  3. 19 12月, 2013 1 次提交
  4. 11 12月, 2013 3 次提交
    • Y
    • A
      Slaves heartbeats during sync improved. · 563d6b3f
      antirez 提交于
      The previous fix for false positive timeout detected by master was not
      complete. There is another blocking stage while loading data for the
      first synchronization with the master, that is, flushing away the
      current data from the DB memory.
      
      This commit uses the newly introduced dict.c callback in order to make
      some incremental work (to send "\n" heartbeats to the master) while
      flushing the old data from memory.
      
      It is hard to write a regression test for this issue unfortunately. More
      support for debugging in the Redis core would be needed in terms of
      functionalities to simulate a slow DB loading / deletion.
      563d6b3f
    • A
      dict.c: added optional callback to dictEmpty(). · b6610a56
      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).
      b6610a56
  5. 03 12月, 2013 1 次提交
  6. 28 11月, 2013 1 次提交
  7. 21 11月, 2013 3 次提交
  8. 06 11月, 2013 1 次提交
    • A
      SCAN code refactored to parse cursor first. · 060d56e7
      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.
      060d56e7
  9. 29 10月, 2013 4 次提交
  10. 06 8月, 2013 3 次提交
    • A
      Add per-db average TTL information in INFO output. · fa48b1fa
      antirez 提交于
      Example:
      
      db0:keys=221913,expires=221913,avg_ttl=655
      
      The algorithm uses a running average with only two samples (current and
      previous). Keys found to be expired are considered at TTL zero even if
      the actual TTL can be negative.
      
      The TTL is reported in milliseconds.
      fa48b1fa
    • A
      Some activeExpireCycle() refactoring. · 00c8cfef
      antirez 提交于
      00c8cfef
    • A
      Draft #1 of a new expired keys collection algorithm. · 500155b9
      antirez 提交于
      The main idea here is that when we are no longer to expire keys at the
      rate the are created, we can't block more in the normal expire cycle as
      this would result in too big latency spikes.
      
      For this reason the commit introduces a "fast" expire cycle that does
      not run for more than 1 millisecond but is called in the beforeSleep()
      hook of the event loop, so much more often, and with a frequency bound
      to the frequency of executed commnads.
      
      The fast expire cycle is only called when the standard expiration
      algorithm runs out of time, that is, consumed more than
      REDIS_EXPIRELOOKUPS_TIME_PERC of CPU in a given cycle without being able
      to take the number of already expired keys that are yet not collected
      to a number smaller than 25% of the number of keys.
      
      You can test this commit with different loads, but a simple way is to
      use the following:
      
      Extreme load with pipelining:
      
      redis-benchmark -r 100000000 -n 100000000  \
              -P 32 set ele:rand:000000000000 foo ex 2
      
      Remove the -P32 in order to avoid the pipelining for a more real-world
      load.
      
      In another terminal tab you can monitor the Redis behavior with:
      
      redis-cli -i 0.1 -r -1 info keyspace
      
      and
      
      redis-cli --latency-history
      
      Note: this commit will make Redis printing a lot of debug messages, it
      is not a good idea to use it in production.
      500155b9
  11. 16 7月, 2013 1 次提交
  12. 12 7月, 2013 2 次提交
    • A
      SORT ALPHA: use collation instead of binary comparison. · 18fabeb2
      antirez 提交于
      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
    • A
      Fixed compareStringObject() and introduced collateStringObject(). · d8fcbb66
      antirez 提交于
      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
  13. 11 7月, 2013 4 次提交
    • A
      getClientPeerId() refactored into two functions. · 3472d045
      antirez 提交于
      3472d045
    • A
      getClientPeerId() now reports errors. · da183666
      antirez 提交于
      We now also use it in CLIENT KILL implementation.
      da183666
    • A
      getClientPeerID introduced. · 4fa68b28
      antirez 提交于
      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
    • G
      Add macro to define clusterNode.ip buffer size. · 68d72aa5
      Geoff Garside 提交于
      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
  14. 08 7月, 2013 2 次提交
  15. 01 7月, 2013 1 次提交
  16. 26 6月, 2013 6 次提交
    • A
      function renamed: popcount_binary -> redisPopcount. · bb0d0fd4
      antirez 提交于
      bb0d0fd4
    • A
      Don't disconnect pre PSYNC replication clients for timeout. · cdf79c06
      antirez 提交于
      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
    • A
      Use the RSC to replicate EVALSHA unmodified. · 545fe0c3
      antirez 提交于
      This commit uses the Replication Script Cache in order to avoid
      translating EVALSHA into EVAL whenever possible for both the AOF and
      slaves.
      545fe0c3
    • A
      Replication of scripts as EVALSHA: sha1 caching implemented. · 9d894b1b
      antirez 提交于
      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
    • A
      New API to force propagation. · 8328d993
      antirez 提交于
      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
    • A
      PUBSUB command implemented. · a8f1474d
      antirez 提交于
      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
  17. 30 5月, 2013 1 次提交
  18. 28 5月, 2013 1 次提交
  19. 27 5月, 2013 2 次提交
    • A
      Replication: send REPLCONF ACK to master. · 146f1d7d
      antirez 提交于
      146f1d7d
    • A
      REPLCONF ACK command. · 1e77b77d
      antirez 提交于
      This special command is used by the slave to inform the master the
      amount of replication stream it currently consumed.
      
      it does not return anything so that we not need to consume additional
      bandwidth needed by the master to reply something.
      
      The master can do a number of things knowing the amount of stream
      processed, such as understanding the "lag" in bytes of the slave, verify
      if a given command was already processed by the slave, and so forth.
      1e77b77d
  20. 15 5月, 2013 1 次提交
    • A
      Added a define for most configuration defaults. · 180cfaae
      antirez 提交于
      Also the logfile option was modified to always have an explicit value
      and to log to stdout when an empty string is used as log file.
      
      Previously there was special handling of the string "stdout" that set
      the logfile to NULL, this always required some special handling.
      180cfaae