1. 07 3月, 2014 1 次提交
  2. 04 2月, 2014 1 次提交
    • A
      CLIENT PAUSE and related API implemented. · 4919a13f
      antirez 提交于
      The API is one of the bulding blocks of CLUSTER FAILOVER command that
      executes a manual failover in Redis Cluster. However exposed as a
      command that the user can call directly, it makes much simpler to
      upgrade a standalone Redis instance using a slave in a safer way.
      
      The commands works like that:
      
          CLIENT PAUSE <milliesconds>
      
      All the clients that are not slaves and not in MONITOR state are paused
      for the specified number of milliesconds. This means that slaves are
      normally served in the meantime.
      
      At the end of the specified amount of time all the clients are unblocked
      and will continue operations normally. This command has no effects on
      the population of the slow log, since clients are not blocked in the
      middle of operations but only when there is to process new data.
      
      Note that while the clients are unblocked, still new commands are
      accepted and queued in the client buffer, so clients will likely not
      block while writing to the server while the pause is active.
      4919a13f
  3. 25 1月, 2014 1 次提交
  4. 14 1月, 2014 1 次提交
    • A
      Cluster: support to read from slave nodes. · 28273394
      antirez 提交于
      A client can enter a special cluster read-only mode using the READONLY
      command: if the client read from a slave instance after this command,
      for slots that are actually served by the instance's master, the queries
      will be processed without redirection, allowing clients to read from
      slaves (but without any kind fo read-after-write guarantee).
      
      The READWRITE command can be used in order to exit the readonly state.
      28273394
  5. 26 12月, 2013 1 次提交
  6. 22 12月, 2013 1 次提交
  7. 21 12月, 2013 1 次提交
  8. 10 12月, 2013 1 次提交
    • A
      Slaves heartbeat while loading RDB files. · 27db38d0
      antirez 提交于
      Starting with Redis 2.8 masters are able to detect timed out slaves,
      while before 2.8 only slaves were able to detect a timed out master.
      
      Now that timeout detection is bi-directional the following problem
      happens as described "in the field" by issue #1449:
      
      1) Master and slave setup with big dataset.
      2) Slave performs the first synchronization, or a full sync
         after a failed partial resync.
      3) Master sends the RDB payload to the slave.
      4) Slave loads this payload.
      5) Master detects the slave as timed out since does not receive back the
         REPLCONF ACK acknowledges.
      
      Here the problem is that the master has no way to know how much the
      slave will take to load the RDB file in memory. The obvious solution is
      to use a greater replication timeout setting, but this is a shame since
      for the 0.1% of operation time we are forced to use a timeout that is
      not what is suited for 99.9% of operation time.
      
      This commit tries to fix this problem with a solution that is a bit of
      an hack, but that modifies little of the replication internals, in order
      to be back ported to 2.8 safely.
      
      During the RDB loading time, we send the master newlines to avoid
      being sensed as timed out. This is the same that the master already does
      while saving the RDB file to still signal its presence to the slave.
      
      The single newline is used because:
      
      1) It can't desync the protocol, as it is only transmitted all or
      nothing.
      2) It can be safely sent while we don't have a client structure for the
      master or in similar situations just with write(2).
      27db38d0
  9. 09 12月, 2013 1 次提交
  10. 08 12月, 2013 1 次提交
  11. 05 12月, 2013 1 次提交
  12. 04 12月, 2013 2 次提交
  13. 03 12月, 2013 2 次提交
  14. 04 10月, 2013 2 次提交
    • A
      Replication: fix master timeout. · 6d8c2a48
      antirez 提交于
      Since we started sending REPLCONF ACK from slaves to masters, the
      lastinteraction field of the client structure is always refreshed as
      soon as there is room in the socket output buffer, so masters in timeout
      are detected with too much delay (the socket buffer takes a lot of time
      to be filled by small REPLCONF ACK <number> entries).
      
      This commit only counts data received as interactions with a master,
      solving the issue.
      6d8c2a48
    • A
      Replication: fix master timeout. · b41570f7
      antirez 提交于
      Since we started sending REPLCONF ACK from slaves to masters, the
      lastinteraction field of the client structure is always refreshed as
      soon as there is room in the socket output buffer, so masters in timeout
      are detected with too much delay (the socket buffer takes a lot of time
      to be filled by small REPLCONF ACK <number> entries).
      
      This commit only counts data received as interactions with a master,
      solving the issue.
      b41570f7
  15. 27 8月, 2013 2 次提交
  16. 12 8月, 2013 2 次提交
    • A
      Use precomptued objects for bulk and mbulk prefixes. · 73989307
      antirez 提交于
      73989307
    • A
      Replication: better way to send a preamble before RDB payload. · 89ffba91
      antirez 提交于
      During the replication full resynchronization process, the RDB file is
      transfered from the master to the slave. However there is a short
      preamble to send, that is currently just the bulk payload length of the
      file in the usual Redis form $..length..<CR><LF>.
      
      This preamble used to be sent with a direct write call, assuming that
      there was alway room in the socket output buffer to hold the few bytes
      needed, however this does not scale in case we'll need to send more
      stuff, and is not very robust code in general.
      
      This commit introduces a more general mechanism to send a preamble up to
      2GB in size (the max length of an sds string) in a non blocking way.
      89ffba91
  17. 24 7月, 2013 2 次提交
  18. 23 7月, 2013 2 次提交
    • A
      getStringObjectSdsUsedMemory() function added. · ec7f480e
      antirez 提交于
      Now that EMBSTR encoding exists we calculate the amount of memory used
      by the SDS part of a Redis String object in two different ways:
      
      1) For raw string object, the size of the allocation is considered.
      2) For embstr objects, the length of the string itself is used.
      
      The new function takes care of this logic.
      ec7f480e
    • A
      Fix setDeferredMultiBulkLength() c->reply_bytes handling with EMBSTR · dbaa5b0b
      antirez 提交于
      This function missed proper handling of reply_bytes when gluing to the
      previous object was used. The issue was introduced with the EMBSTR new
      string object encoding.
      
      This fixes issue #1208.
      dbaa5b0b
  19. 22 7月, 2013 2 次提交
    • A
      Fixed a possible bug in client->reply_bytes computation. · 7ed76528
      antirez 提交于
      7ed76528
    • A
      Introduction of a new string encoding: EMBSTR · 894eba07
      antirez 提交于
      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
  20. 17 7月, 2013 1 次提交
  21. 09 7月, 2013 4 次提交
  22. 08 7月, 2013 4 次提交
    • G
      Mark places that might want changing for IPv6. · ca78446c
      Geoff Garside 提交于
      Any places which I feel might want to be updated to work differently
      with IPv6 have been marked with a comment starting "IPV6:".
      
      Currently the only comments address places where an IP address is
      combined with a port using the standard : separated form. These may want
      to be changed when printing IPv6 addresses to wrap the address in []
      such as
      
      	[2001:db8::c0:ffee]:6379
      
      instead of
      
      	2001:db8::c0:ffee:6379
      
      as the latter format is a technically valid IPv6 address and it is hard
      to distinguish the IPv6 address component from the port unless you know
      the port is supposed to be there.
      ca78446c
    • G
      Expand ip char buffers which are too small for v6. · 96b02dc0
      Geoff Garside 提交于
      Increase the size of character buffers being used to store printable IP
      addresses so that they can safely store IPv6 addresses.
      96b02dc0
    • G
      Mark ip string buffers which could be reduced. · f7d9a92d
      Geoff Garside 提交于
      In two places buffers have been created with a size of 128 bytes which
      could be reduced to INET6_ADDRSTRLEN to still hold a full IP address.
      These places have been marked as they are presently big enough to handle
      the needs of storing a printable IPv6 address.
      f7d9a92d
    • G
      Update anetTcpAccept & anetPeerToString calls. · f5494a42
      Geoff Garside 提交于
      Add the additional ip buffer length argument to function calls of
      anetTcpAccept and anetPeerToString in network.c and cluster.c
      f5494a42
  23. 30 5月, 2013 1 次提交
  24. 27 5月, 2013 2 次提交
    • A
      Replication: send REPLCONF ACK to master. · 0292c5f7
      antirez 提交于
      0292c5f7
    • A
      REPLCONF ACK command. · 6b4635f4
      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.
      6b4635f4
  25. 25 5月, 2013 1 次提交