1. 20 Mar, 2024 1 commit
  2. 24 Dec, 2023 1 commit
  3. 17 Apr, 2023 1 commit
    • Joe Hu's avatar
      Fix RDB check regression caused by PR 12022 (#12051) · 644d9455
      Joe Hu authored
      The nightly tests showed that the recent PR #12022 caused random failures
      in aof.tcl on checking RDB preamble inside an AOF file.
      
      Root cause:
      When checking RDB preamble in an AOF file, what's passed into redis_check_rdb is
      aof_filename, not aof_filepath. The newly introduced isFifo function does not check return
      status of the stat call and hence uses the uninitailized stat_p object.
      
      Fix:
      1. Fix isFifo by checking stat call's return code.
      2. Pass aof_filepath instead of aof_filename to redis_check_rdb.
      3. move the FIFO check to rdb.c since the limitation is the re-opening of the file, and not
        anything specific about redis-check-rdb.
      644d9455
  4. 22 Aug, 2022 2 commits
    • zhenwei pi's avatar
      Introduce connAddr · bff7ecc7
      zhenwei pi authored
      
      
      Originally, connPeerToString is designed to get the address info from
      socket only(for both TCP & TLS), and the API 'connPeerToString' is
      oriented to operate a FD like:
      int connPeerToString(connection *conn, char *ip, size_t ip_len, int *port) {
          return anetFdToString(conn ? conn->fd : -1, ip, ip_len, port, FD_TO_PEER_NAME);
      }
      
      Introduce connAddr and implement .addr method for socket and TLS,
      thus the API 'connAddr' and 'connFormatAddr' become oriented to a
      connection like:
      static inline int connAddr(connection *conn, char *ip, size_t ip_len, int *port, int remote) {
          if (conn && conn->type->addr) {
              return conn->type->addr(conn, ip, ip_len, port, remote);
          }
      
          return -1;
      }
      
      Also remove 'FD_TO_PEER_NAME' & 'FD_TO_SOCK_NAME', use a boolean type
      'remote' to get local/remote address of a connection.
      
      With these changes, it's possible to support the other connection
      types which does not use socket(Ex, RDMA).
      
      Thanks to Oran for suggestions!
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      bff7ecc7
    • zhenwei pi's avatar
      Move 'connGetSocketError' to 'anetGetError' · 8045e26e
      zhenwei pi authored
      
      
      getsockopt is part of TCP, rename 'connGetSocketError' to
      'anetGetError', and move it into anet.c.
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      8045e26e
  5. 20 Apr, 2022 1 commit
  6. 06 Oct, 2021 1 commit
  7. 17 Mar, 2021 1 commit
    • Yossi Gottlieb's avatar
      Cleanup: remove dead code from anet. (#8660) · f657315e
      Yossi Gottlieb authored
      In the long term we may want to move away from anet completely and have
      everything implemented natively in connection.c, instead of having an
      extra layer.
      
      For now, just get rid of unused code.
      f657315e
  8. 28 Jan, 2021 1 commit
    • Yossi Gottlieb's avatar
      Add hostname support in Sentinel. (#8282) · bb7cd974
      Yossi Gottlieb authored
      
      
      This is both a bugfix and an enhancement.
      
      Internally, Sentinel relies entirely on IP addresses to identify
      instances. When configured with a new master, it also requires users to
      specify and IP and not hostname.
      
      However, replicas may use the replica-announce-ip configuration to
      announce a hostname. When that happens, Sentinel fails to match the
      announced hostname with the expected IP and considers that a different
      instance, triggering reconfiguration, etc.
      
      Another use case is where TLS is used and clients are expected to match
      the hostname to connect to with the certificate's SAN attribute. To
      properly implement this configuration, it is necessary for Sentinel to
      redirect clients to a hostname rather than an IP address.
      
      The new 'resolve-hostnames' configuration parameter determines if
      Sentinel is willing to accept hostnames. It is set by default to no,
      which maintains backwards compatibility and avoids unexpected DNS
      resolution delays on systems with DNS configuration issues.
      
      Internally, Sentinel continues to identify instances by their resolved
      IP address and will also report the IP by default. The new
      'announce-hostnames' parameter determines if Sentinel should prefer to
      announce a hostname, when available, rather than an IP address. This
      applies to addresses returned to clients, as well as their
      representation in the configuration file, REPLICAOF configuration
      commands, etc.
      
      This commit also introduces SENTINEL CONFIG GET and SENTINEL CONFIG SET
      which can be used to introspect or configure global Sentinel
      configuration that was previously was only possible by directly
      accessing the configuration file and possibly restarting the instance.
      Co-authored-by: default avatarmyl1024 <myl92916@qq.com>
      Co-authored-by: default avatarsundb <sundbcn@gmail.com>
      bb7cd974
  9. 19 Jan, 2021 1 commit
  10. 28 Oct, 2020 1 commit
    • yoav-steinberg's avatar
      Add local address to CLIENT LIST, and a CLIENT KILL filter. (#7913) · 84b3c18f
      yoav-steinberg authored
      Useful when you want to know through which bind address the client connected to
      the server in case of multiple bind addresses.
      
      - Adding `laddr` field to CLIENT list showing the local (bind) address.
      - Adding `LADDR` option to CLIENT KILL to kill all the clients connected
        to a specific local address.
      - Refactoring to share code.
      84b3c18f
  11. 07 Oct, 2019 1 commit
    • Yossi Gottlieb's avatar
      TLS: Connections refactoring and TLS support. · b087dd1d
      Yossi Gottlieb authored
      * Introduce a connection abstraction layer for all socket operations and
      integrate it across the code base.
      * Provide an optional TLS connections implementation based on OpenSSL.
      * Pull a newer version of hiredis with TLS support.
      * Tests, redis-cli updates for TLS support.
      b087dd1d
  12. 08 Jul, 2019 1 commit
    • Oran Agra's avatar
      diskless replication on slave side (don't store rdb to file), plus some other related fixes · 2de544cf
      Oran Agra authored
      The implementation of the diskless replication was currently diskless only on the master side.
      The slave side was still storing the received rdb file to the disk before loading it back in and parsing it.
      
      This commit adds two modes to load rdb directly from socket:
      1) when-empty
      2) using "swapdb"
      the third mode of using diskless slave by flushdb is risky and currently not included.
      
      other changes:
      --------------
      distinguish between aof configuration and state so that we can re-enable aof only when sync eventually
      succeeds (and not when exiting from readSyncBulkPayload after a failed attempt)
      also a CONFIG GET and INFO during rdb loading would have lied
      
      When loading rdb from the network, don't kill the server on short read (that can be a network error)
      
      Fix rdb check when performed on preamble AOF
      
      tests:
      run replication tests for diskless slave too
      make replication test a bit more aggressive
      Add test for diskless load swapdb
      2de544cf
  13. 04 Apr, 2016 1 commit
    • antirez's avatar
      Fix ae.c to avoid timers infinite loop. · 67b70a18
      antirez authored
      This fix was suggested by Anthony LaTorre, that provided also a good
      test case that was used to verify the fix.
      
      The problem with the old implementation is that, the time returned by
      a timer event (that is the time after it want to run again) is added
      to the event *start time*. So if the event takes, in order to run, more
      than the time it says it want to be scheduled again for running, an
      infinite loop is triggered.
      67b70a18
  14. 11 Jun, 2015 1 commit
    • antirez's avatar
      anet.c: new API anetTcpNonBlockBestEffortBindConnect() · a017b7ec
      antirez authored
      This performs a best effort source address binding attempt. If it is
      possible to bind the local address and still have a successful
      connect(), then this socket is returned. Otherwise the call is retried
      without source address binding attempt.
      
      Related to issues #2609 and #2612.
      a017b7ec
  15. 11 Dec, 2014 2 commits
  16. 22 Oct, 2014 1 commit
  17. 17 Oct, 2014 1 commit
  18. 07 Aug, 2014 1 commit
  19. 04 Mar, 2014 1 commit
    • Matt Stancliff's avatar
      Bind source address for cluster communication · e5b1e7be
      Matt Stancliff authored
      The first address specified as a bind parameter
      (server.bindaddr[0]) gets used as the source IP
      for cluster communication.
      
      If no bind address is specified by the user, the
      behavior is unchanged.
      
      This patch allows multiple Redis Cluster instances
      to communicate when running on the same interface
      of the same host.
      e5b1e7be
  20. 31 Jan, 2014 1 commit
    • Nenad Merdanovic's avatar
      Add support for listen(2) backlog definition · d76aa96d
      Nenad Merdanovic authored
      In high RPS environments, the default listen backlog is not sufficient, so
      giving users the power to configure it is the right approach, especially
      since it requires only minor modifications to the code.
      d76aa96d
  21. 10 Jan, 2014 2 commits
    • antirez's avatar
      anetResolveIP() prototype added to anet.h. · d4f296bc
      antirez authored
      d4f296bc
    • antirez's avatar
      anetResolveIP() added to anet.c. · 774f0bd4
      antirez authored
      The new function is used when we want to normalize an IP address without
      performing a DNS lookup if the string to resolve is not a valid IP.
      
      This is useful every time only IPs are valid inputs or when we want to
      skip DNS resolution that is slow during runtime operations if we are
      required to block.
      774f0bd4
  22. 08 Jul, 2013 4 commits
    • Geoff Garside's avatar
      Add IPv6 support to sentinel.c. · e04fdf26
      Geoff Garside authored
      This has been done by exposing the anetSockName() function anet.c
      to be used when the sentinel is publishing its existence to the masters.
      
      This implementation is very unintelligent as it will likely break if used
      with IPv6 as the nested colons will break any parsing of the PUBLISH string
      by the master.
      e04fdf26
    • Geoff Garside's avatar
      Add anetTcp6Server() function. · 56df8271
      Geoff Garside authored
      Refactor the common code from anetTcpServer into internal function which
      can be used by both anetTcpServer and anetTcp6Server.
      56df8271
    • Geoff Garside's avatar
      Use inet_ntop(3) in anet. #apichange · ef839f90
      Geoff Garside authored
      Replace inet_ntoa(3) calls with the more future proof inet_ntop(3)
      function which is capable of handling additional address families.
      
      API Change: anetTcpAccept() & anetPeerToString() additional argument
        additional argument required to specify the length of the character
        buffer the IP address is written to in order to comply with
        inet_ntop(3) function semantics.
      ef839f90
    • Geoff Garside's avatar
      Use getaddrinfo(3) in anetResolve. #apichange · 071963c8
      Geoff Garside authored
      Change anetResolve() function to use getaddrinfo(3) to resolve hostnames.
      Resolved hostnames are limited to those reachable by the AF_INET address
      family.
      
      API Change: anetResolve requires additional argument.
        additional argument required to specify the length of the character
        buffer the IP address is written to in order to comply with
        inet_ntop(3) function semantics. inet_ntop(3) replaces inet_ntoa(3)
        as it has been designed to be compatible with more address families.
      071963c8
  23. 05 Jul, 2013 1 commit
  24. 04 Jul, 2013 1 commit
  25. 08 Feb, 2013 1 commit
  26. 05 Feb, 2013 2 commits
    • antirez's avatar
      b70b459b
    • charsyam's avatar
      Turn off TCP_NODELAY on the slave socket after SYNC. · c85647f3
      charsyam authored
      Further details from @antirez:
      
      It was reported by @StopForumSpam on Twitter that the Redis replication
      link was strangely using multiple TCP packets for multiple commands.
      This wastes a lot of bandwidth and is due to the TCP_NODELAY option we
      enable on the socket after accepting a new connection.
      
      However the master -> slave channel is a one-way channel since Redis
      replication is asynchronous, so there is no point in trying to reduce
      the latency, we should aim to reduce the bandwidth. For this reason this
      commit introduces the ability to disable the nagle algorithm on the
      socket after a successful SYNC.
      
      This feature is off by default because the delay can be up to 40
      milliseconds with normally configured Linux kernels.
      c85647f3
  27. 08 Nov, 2012 1 commit
  28. 10 Oct, 2011 1 commit
  29. 21 Apr, 2011 1 commit
  30. 23 Dec, 2010 1 commit
  31. 13 Oct, 2010 2 commits
  32. 01 Aug, 2010 1 commit