1. 28 Oct, 2020 5 commits
  2. 27 Oct, 2020 6 commits
    • WuYunlong's avatar
      Fix waste of CPU time about server log in serverCron. · 66037309
      WuYunlong authored
      When all the work is just adding logs, we could pull
      the condition out so as to use less CPU time when
      loglevel is bigger than LL_VERBOSE.
      66037309
    • Oran Agra's avatar
      Fix cluster access to unaligned memory (SIGBUS on old ARM) (#7958) · 380f6048
      Oran Agra authored
      Turns out this was broken since version 4.0 when we added sds size
      classes.
      The cluster code uses sds for the receive buffer, and then casts it to a
      struct and accesses a 64 bit variable.
      This commit replaces the use of sds with a simple reallocated buffer.
      380f6048
    • zhenwei pi's avatar
      Disable THP if enabled (#7381) · a9c06021
      zhenwei pi authored
      In case redis starts and find that THP is enabled ("always"), instead
      of printing a log message, which might go unnoticed, redis will try to
      disable it (just for the redis process).
      
      Note: it looks like on self-bulit kernels THP is likely be set to "always" by default.
      
      Some discuss about THP side effect on Linux:
      according to http://www.antirez.com/news/84
      
      , we can see that
      redis latency spikes are caused by linux kernel THP feature.
      I have tested on E3-2650 v3, and found that 2M huge page costs
      about 0.25ms to fix COW page fault.
      
      Add a new config 'disable-thp', the recommended setting is 'yes',
      (default) the redis tries to disable THP by prctl syscall. But
      users who really want THP can set it to "no"
      
      Thanks to Oran & Yossi for suggestions.
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      a9c06021
    • Andrij Fedyk's avatar
      rdb.c: fix typo in a comment (#7970) · 825fe7bd
      Andrij Fedyk authored
      825fe7bd
    • WuYunlong's avatar
      Speedup cluster failover. (#7948) · 7fa56dd7
      WuYunlong authored
      
      
      This commit deals with manual failover as well as non-manual failover.
      
      We did tests with manual failover as follows:
      1, Setup redis cluster which holds 16 partions, each having only
         1 corresponding replica.
      2, Write a batch of data to redis cluster and make sure the redis is doing
         a active expire in serverCron.
      3, Do a manual failover sequentially to each partions with a time interval
         of 3 minutes.
      4, Collect logs and do some computaiton work.
      
      The result:
      case    avgTime    maxTime    minTime
      C1      95.8ms	   227ms      25ms
      C2      47.9ms     96ms       12ms
      C3      12.6ms     27ms       7ms
      
      Explanation
      case C1: All nodes use the version before optimization
      case C2: Masters use the elder version while replicas use the optimized version
      case C3: All nodes use the optimized version
      failover time: The time between when replica got a `manual failover request` and
                     when it `won the failover election`.
      avgTime: average failover time
      maxTime: maximum failover time
      minTime: mimimum failover time
      ms: millisecond
      Co-authored-by: default avatarchendq8 <c.d_q@163.com>
      7fa56dd7
    • Madelyn Olson's avatar
      Only supress implitic fallthrough on GCC 7 · dac26729
      Madelyn Olson authored
      dac26729
  3. 26 Oct, 2020 2 commits
    • Yossi Gottlieb's avatar
      Fix wrong zmalloc_size() assumption. (#7963) · 9824fe3e
      Yossi Gottlieb authored
      When using a system with no malloc_usable_size(), zmalloc_size() assumed
      that the heap allocator always returns blocks that are long-padded.
      
      This may not always be the case, and will result with zmalloc_size()
      returning a size that is bigger than allocated. At least in one case
      this leads to out of bound write, process crash and a potential security
      vulnerability.
      
      Effectively this does not affect the vast majority of users, who use
      jemalloc or glibc.
      
      This problem along with a (different) fix was reported by Drew DeVault.
      9824fe3e
    • filipe oliveira's avatar
      redis-benchmark: add tests, --version, a minor bug fixes (#7947) · 01acfa71
      filipe oliveira authored
      
      
      - add test suite coverage for redis-benchmark
      - add --version (similar to what redis-cli has)
      - fix bug sending more requests than intended when pipeline > 1.
      - when done sending requests, avoid freeing client in the write handler, in theory before
        responses are received (probably dead code since the read handler will call clientDone first)
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      01acfa71
  4. 25 Oct, 2020 2 commits
  5. 23 Oct, 2020 1 commit
  6. 22 Oct, 2020 2 commits
    • Wen Hui's avatar
      do not add save parameter during config rewrite in sentinel mode (#7945) · 0f370f9b
      Wen Hui authored
      Previous code would have added default redis save parameters
      to the config file on rewrite, which would have been silently ignored
      when the config file is loaded.
      
      The new code avoids adding this, and also actively removes these lines
      If added by a previous config rewrite. 
      0f370f9b
    • Qu Chen's avatar
      WATCH no longer ignores keys which have expired for MULTI/EXEC. (#7920) · 556acefe
      Qu Chen authored
      This wrong behavior was backed by a test, and also documentation, and dates back to 2010.
      But it makes no sense to anyone involved so it was decided to change that.
      
      Note that 20eeddfb (invalidate watch on expire on access) was released in 6.0 RC2
      and 2d1968f8 released in in 6.0.0 GA (invalidate watch when key is evicted).
      both of which do similar changes.
      556acefe
  7. 20 Oct, 2020 2 commits
  8. 19 Oct, 2020 2 commits
    • Wen Hui's avatar
      fix double fclose in aofrewrite (#7919) · 04a0af90
      Wen Hui authored
      minor fix for a bug which happen on error handling code
      and doesn't look like it could have caused any real harm
      (fd number wouldn't have been reused yet)
      04a0af90
    • Wen Hui's avatar
      Support ACL for Sentinel Mode (#7888) · 0047702a
      Wen Hui authored
      
      
      This commit implements ACL for Sentinel mode, main work of this PR includes:
      
      - Update Sentinel command table in order to better support ACLs.
      - Fix couple of things which currently blocks the support for ACL on sentinel mode.
      - Provide "sentinel sentinel-user" and "sentinel sentinel-pass " configuration in order to let sentinel authenticate with a specific user in other sentinels.
      - requirepass is kept just for compatibility with old config files
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      0047702a
  9. 18 Oct, 2020 4 commits
    • Oran Agra's avatar
      INFO report peak memory before eviction (#7894) · 457b7073
      Oran Agra authored
      In some cases one command added a very big bulk of memory, and this
      would be "resolved" by the eviction before the next command.
      
      Seeing an unexplained mass eviction we would wish to
      know the highest momentary usage too.
      
      Tracking it in call() and beforeSleep() adds some hooks in AOF and RDB
      loading.
      
      The fix in clientsCronTrackExpansiveClients is related to #7874
      457b7073
    • Wen Hui's avatar
      support NOMKSTREAM option in xadd command (#7910) · f328194d
      Wen Hui authored
      introduces a NOMKSTREAM option for xadd command, this would be useful for some
      use cases when we do not want to create new stream by default:
      
      XADD key [MAXLEN [~|=] <count>] [NOMKSTREAM] <ID or *> [field value] [field value]
      f328194d
    • Pierre Jambet's avatar
      t_set.c comment update for srandmemberWithCountCommand (#7922) · f6010e10
      Pierre Jambet authored
      Reference the correct "case", case 4, in the comment explaining the need
      for case 3, when the number of request items is too close to the
      cardinality of the set. Case 4 is indeed the "natural approach"
      referenced earlier in that sentence.
      f6010e10
    • Tommy Joe Lund's avatar
      Fix typo in server.h (#7921) · 786d6d55
      Tommy Joe Lund authored
      786d6d55
  10. 14 Oct, 2020 1 commit
    • Oran Agra's avatar
      Allow requirepass config to clear the password (#7899) · 19418b6b
      Oran Agra authored
      This is a compatibility issue with redis 5.0 that was introduced by ACL.
      Before this commit, setting requirepass to an empty string will result
      in a server that needs an empty AUTH, unlike redis 5.0 which would
      accept connections without an AUTH.
      19418b6b
  11. 13 Oct, 2020 4 commits
  12. 12 Oct, 2020 1 commit
    • guybe7's avatar
      Minor improvements to module blocked on keys (#7903) · addf47dc
      guybe7 authored
      - Clarify some documentation comments
      - Make sure blocked-on-keys client privdata is accessible
        from withing the timeout callback
      - Handle blocked clients in beforeSleep - In case a key
        becomes "ready" outside of processCommand
      
      See #7879 #7880
      addf47dc
  13. 11 Oct, 2020 8 commits
    • Andreas Lind's avatar
      Support redis-cli -u rediss://... (#7900) · 8b497881
      Andreas Lind authored
      8b497881
    • Yossi Gottlieb's avatar
      Modules: fix RM_GetCommandKeys API. (#7901) · 056a43e1
      Yossi Gottlieb authored
      This cleans up and simplifies the API by passing the command name as the
      first argument. Previously the command name was specified explicitly,
      but was still included in the argv.
      056a43e1
    • Meir Shpilraien (Spielrein)'s avatar
      Add Module API for version and compatibility checks (#7865) · adc3183c
      Meir Shpilraien (Spielrein) authored
      
      
      * Introduce a new API's: RM_GetContextFlagsAll, and
      RM_GetKeyspaceNotificationFlagsAll that will return the
      full flags mask of each feature. The module writer can
      check base on this value if the Flags he needs are
      supported or not.
      
      * For each flag, introduce a new value on redismodule.h,
      this value represents the LAST value and should be there
      as a reminder to update it when a new value is added,
      also it will be used in the code to calculate the full
      flags mask (assuming flags are incrementally increasing).
      In addition, stated that the module writer should not use
      the LAST flag directly and he should use the GetFlagAll API's.
      
      * Introduce a new API: RM_IsSubEventSupported, that returns for a given
      event and subevent, whether or not the subevent supported.
      
      * Introduce a new macro RMAPI_FUNC_SUPPORTED(func) that returns whether
      or not a function API is supported by comparing it to NULL.
      
      * Introduce a new API: int RM_GetServerVersion();, that will return the
      current Redis version in the format 0x00MMmmpp; e.g. 0x00060008;
      
      * Changed unstable version from 999.999.999 to 255.255.255
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      Co-authored-by: default avatarYossi Gottlieb <yossigo@gmail.com>
      adc3183c
    • Yossi Gottlieb's avatar
      Module API: Add RM_GetClientCertificate(). (#7866) · 0aec98dc
      Yossi Gottlieb authored
      This API function makes it possible to retrieve the X.509 certificate
      used by clients to authenticate TLS connections.
      0aec98dc
    • Yossi Gottlieb's avatar
      Modules: Add RM_GetDetachedThreadSafeContext(). (#7886) · 907da058
      Yossi Gottlieb authored
      The main motivation here is to provide a way for modules to create a
      single, global context that can be used for logging.
      
      Currently, it is possible to obtain a thread-safe context that is not
      attached to any blocked client by using `RM_GetThreadSafeContext`.
      However, the attached context is not linked to the module identity so
      log messages produced are not tagged with the module name.
      
      Ideally we'd fix this in `RM_GetThreadSafeContext` itself but as it
      doesn't accept the current context as an argument there's no way to do
      that in a backwards compatible manner.
      907da058
    • Yossi Gottlieb's avatar
      Modules: add RM_GetCommandKeys(). · 7d117d75
      Yossi Gottlieb authored
      This is essentially the same as calling COMMAND GETKEYS but provides a
      more efficient interface that can be used in every context (i.e. not a
      Redis command).
      7d117d75
    • Yossi Gottlieb's avatar
      Introduce getKeysResult for getKeysFromCommand. · 9b7f8ba8
      Yossi Gottlieb authored
      Avoid using a static buffer for short key index responses, and make it
      caller's responsibility to stack-allocate a result type. Responses that
      don't fit are still allocated on the heap.
      9b7f8ba8
    • Uri Shachar's avatar
      Support getting configuration from both stdin and file at the same time (#7893) · dab5ec9b
      Uri Shachar authored
      This allows supplying secret configuration (for example - masterauth) via a secure channel
      instead of having it in a plaintext file / command line param, while still allowing for most
      of the configuration to reside there.
      
      Also, remove 'special' case handling for --check-rdb which hasn't been relevant
      since 4.0.0.
      dab5ec9b