1. 29 Mar, 2021 2 commits
    • Sokolov Yura's avatar
      Add cluster slot migration tests (#8649) · 315df9ad
      Sokolov Yura authored
      
      
      Add tests for fixing migrating slot at all stages:
      
      1. when migration is half inited on "migrating" node
      2. when migration is half inited on "importing" node
      3. migration inited, but not finished
      4. migration is half finished on "migrating" node
      5. migration is half finished on "importing" node
      
      Also add tests for many simultaneous slot migrations.
      Co-authored-by: default avatarYossi Gottlieb <yossigo@gmail.com>
      315df9ad
    • Meir Shpilraien (Spielrein)'s avatar
      Restore old client 'processCommandAndResetClient' to fix false dead client indicator (#8715) · 036963a7
      Meir Shpilraien (Spielrein) authored
      'processCommandAndResetClient' returns 1 if client is dead. It does it
      by checking if serve.current_client is NULL. On script timeout, Redis will re-enter
      'processCommandAndResetClient' and when finish we will set server.current_client
      to NULL. This will cause later to falsely return 1 and think that the client that
      sent the timed-out script is dead (Redis to stop reading from the client buffer).
      036963a7
  2. 28 Mar, 2021 2 commits
  3. 26 Mar, 2021 2 commits
    • Huang Zhw's avatar
      make processCommand check publish channel permissions. (#8534) · e138698e
      Huang Zhw authored
      Add publish channel permissions check in processCommand.
      
      processCommand didn't check publish channel permissions, so we can
      queue a publish command in a transaction. But when exec the transaction,
      it will fail with -NOPERM.
      
      We also union keys/commands/channels permissions check togegher in
      ACLCheckAllPerm. Remove pubsubCheckACLPermissionsOrReply in 
      publishCommand/subscribeCommand/psubscribeCommand. Always 
      check permissions in processCommand/execCommand/
      luaRedisGenericCommand.
      e138698e
    • sundb's avatar
      Fix crash when hz config out of range (#8658) · db6655de
      sundb authored
      Fix crash when hz config out of range
      db6655de
  4. 25 Mar, 2021 5 commits
    • Igor's avatar
      Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call (#8689) · cf0a909e
      Igor authored
      Introduce fast path to bypass expensive serveClientsBlockedOnKeyByModule call
      cf0a909e
    • Wang Yuan's avatar
      1976acfe
    • Oran Agra's avatar
      Fix SLOWLOG for blocked commands (#8632) · 497351ad
      Oran Agra authored
      * SLOWLOG didn't record anything for blocked commands because the client
        was reset and argv was already empty. there was a fix for this issue
        specifically for modules, now it works for all blocked clients.
      * The original command argv (before being re-written) was also reset
        before adding the slowlog on behalf of the blocked command.
      * Latency monitor is now updated regardless of the slowlog flags of the
        command or its execution (their purpose is to hide sensitive info from
        the slowlog, not hide the fact the latency happened).
      * Latency monitor now uses real_cmd rather than c->cmd (which may be
        different if the command got re-written, e.g. GEOADD)
      
      Changes:
      * Unify shared code between slowlog insertion in call() and
        updateStatsOnUnblock(), hopefully prevent future bugs from happening
        due to the later being overlooked.
      * Reset CLIENT_PREVENT_LOGGING in resetClient rather than after command
        processing.
      * Add a test for SLOWLOG and BLPOP
      
      Notes:
      - real_cmd == c->lastcmd, except inside MULTI and Lua.
      - blocked commands never happen in these cases (MULTI / Lua)
      - real_cmd == c->cmd, except for when the command is rewritten (e.g.
        GEOADD)
      - blocked commands (currently) are never rewritten
      - other than the command's CLIENT_PREVENT_LOGGING, and the
        execution flag CLIENT_PREVENT_LOGGING, other cases that we want to
        avoid slowlog are on AOF loading (specifically CMD_CALL_SLOWLOG will
        be off when executed from execCommand that runs from an AOF)
      497351ad
    • hzzb's avatar
      Fix misleading comment (#8690) · 4a2c4477
      hzzb authored
      REPLICAOF actually specifies which master to attach.
      4a2c4477
    • Madelyn Olson's avatar
      98d2e001
  5. 24 Mar, 2021 7 commits
  6. 23 Mar, 2021 2 commits
  7. 22 Mar, 2021 7 commits
  8. 17 Mar, 2021 4 commits
    • Meir Shpilraien (Spielrein)'s avatar
      Fix script kill to work also on scripts that use pcall (#8661) · 9ae4f5c7
      Meir Shpilraien (Spielrein) authored
      pcall function runs another LUA function in protected mode, this means
      that any error will be caught by this function and will not stop the LUA
      execution. The script kill mechanism uses error to stop the running script.
      Scripts that uses pcall can catch the error raise by the script kill mechanism,
      this will cause a script like this to be unkillable:
      
      local f = function()
              while 1 do
                      redis.call('ping')
              end
      end
      while 1 do
              pcall(f)
      end
      
      The fix is, when we want to kill the script, we set the hook function to be invoked 
      after each line. This will promise that the execution will get another
      error before it is able to enter the pcall function again.
      9ae4f5c7
    • Theo Buehler's avatar
      Fixes for systems with 64-bit time (#8662) · 169be042
      Theo Buehler authored
      Some operating systems (e.g., NetBSD and OpenBSD) have switched to
      using a 64-bit integer for time_t on all platforms. This results in currently
      harmless compiler warnings due to potential truncation.
      These changes fix these minor portability concerns.
      
      * Fix format string for systems with 64 bit time
      * use llabs to avoid truncation with 64 bit time
      169be042
    • Wen Hui's avatar
      fix wrong comment for data_age unit (#8665) · 6097d14d
      Wen Hui authored
      fix typo
      6097d14d
    • 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
  9. 16 Mar, 2021 9 commits
    • Huang Zhw's avatar
      When tests exit normally, some processes may still be alive (#8647) · a19c4058
      Huang Zhw authored
      In certain scenario start_server may think it failed to start a redis server
      although it started successfully. in these cases, it'll not terminate it, and
      it'll remain running when the test is over.
      
      In start_server if config doesn't have bind (the minimal.conf in introspection.tcl),
      it will try to bind ipv4 and ipv6. One may success while other fails. It will
      output "Could not create server TCP listening socket".
      wait_server_started uses this message to check whether instance started
      successfully. So it will consider that it failed even though redis started successfully.
      
      Additionally, in some cases it wasn't clear to users why the server exited,
      since the warning message printed to the log, could in some cases be harmless,
      and in some cases fatal.
      
      This PR adds makes a clear distinction between a warning log message and
      a fatal one, and changes the test suite to look for the fatal message.
      a19c4058
    • Saravjeet 'Aman' Singh's avatar
      Update README.md (#3543) · ec34806c
      Saravjeet 'Aman' Singh authored
      prettify
      ec34806c
    • Garen Chan's avatar
      f141329f
    • Ikko Ashimine's avatar
      Fix typo in t_stream.c (#8592) · 6da2bc96
      Ikko Ashimine authored
      arguements -> arguments
      6da2bc96
    • Meir Shpilraien (Spielrein)'s avatar
      Fix issue where error replies are not counted on stats (#8659) · 95360c2e
      Meir Shpilraien (Spielrein) authored
      lookupKeyReadOrReply and lookupKeyWriteOrReply might decide to reply to the user
      with the given robj reply. This reply might be an error reply and if so addReply
      function is used instead of addReplyErrorObject which will cause the error reply not
      to be counted on stats. The fix checks the first char in the reply and if its '-' (error)
      it uses addReplyErrorObject.
      95360c2e
    • Wen Hui's avatar
    • Oran Agra's avatar
      set module eviction context flag only in masters (#8631) · 40d555db
      Oran Agra authored
      REDISMODULE_CTX_FLAGS_EVICT and REDISMODULE_CTX_FLAGS_MAXMEMORY
      shouldn't be set when the module is run inside a replica that doesn't do eviction.
      
      one may argue that the database is under eviction (the master does eviction and sends DELs to the replica).
      but on the other hand, we don't really know the master's configuration.
      all that matters is if the current instance does evictions or not.
      40d555db
    • Yossi Gottlieb's avatar
      Server won't start on alpine/libmusl without IPv6. (#8655) · df5f543b
      Yossi Gottlieb authored
      listenToPort attempts to gracefully handle and ignore certain errors but does not store errno prior to logging, which in turn calls several libc functions that may overwrite errno.
      
      This has been discovered due to libmusl strftime() always returning with errno set to EINVAL, which resulted with docker-library/redis#273.
      df5f543b
    • Madelyn Olson's avatar
      Redact slowlog entries for config with sensitive data. (#8584) · e1d98bca
      Madelyn Olson authored
      Redact config set requirepass/masterauth/masteruser from slowlog in addition to showing ACL commands without sensitive values. 
      e1d98bca