1. 06 Apr, 2021 4 commits
  2. 05 Apr, 2021 2 commits
    • Huang Zhw's avatar
      Fix "default" and overwritten / reset users will not have pubsub channels... · 3b74b550
      Huang Zhw authored
      Fix "default" and overwritten / reset users will not have pubsub channels permissions by default. (#8723)
      
      Background:
      Redis 6.2 added ACL control for pubsub channels (#7993), which were supposed
      to be permissive by default to retain compatibility with redis 6.0 ACL. 
      But due to a bug, only newly created users got this `acl-pubsub-default` applied,
      while overwritten (updated) users got reset to `resetchannels` (denied).
      
      Since the "default" user exists before loading the config file,
      any ACL change to it, results in an update / overwrite.
      
      So when a "default" user is loaded from config file or include ACL
      file with no channels related rules, the user will not have any
      permissions to any channels. But other users will have default
      permissions to any channels.
      
      When upgraded from 6.0 with config rewrite, this will lead to
      "default" user channels permissions lost.
      When users are loaded from include file, then call "acl load", users
      will also lost channels permissions.
      
      Similarly, the `reset` ACL rule, would have reset the user to be denied
      access to any channels, ignoring `acl-pubsub-default` and breaking
      compatibility with redis 6.0.
      
      The implication of this fix is that it regains compatibility with redis 6.0,
      but breaks compatibility with redis 6.2.0 and 2.0.1. e.g. after the upgrade,
      the default user will regain access to pubsub channels.
      
      Other changes:
      Additionally this commit rename server.acl_pubusub_default to
      server.acl_pubsub_default and fix typo in acl tests.
      3b74b550
    • Huang Zhw's avatar
      redis-cli --bigkeys / memkeys, report detailed error on dbsize failure (#8740) · a3da3e59
      Huang Zhw authored
      When DBSIZE failed (e.g. on AUTH error), the printed error didn't reflect the reason.
      a3da3e59
  3. 04 Apr, 2021 1 commit
    • Sokolov Yura's avatar
      Add cluster-allow-replica-migration option. (#5285) · 1cab9620
      Sokolov Yura authored
      
      
      Previously (and by default after commit) when master loose its last slot
      (due to migration, for example), its replicas will migrate to new last slot
      holder.
      
      There are cases where this is not desired:
      * Consolidation that results with removed nodes (including the replica, eventually).
      * Manually configured cluster topologies, which the admin wishes to preserve.
      
      Needlessly migrating a replica triggers a full synchronization and can have a negative impact, so
      we prefer to be able to avoid it where possible.
      
      This commit adds 'cluster-allow-replica-migration' configuration option that is
      enabled by default to preserve existed behavior. When disabled, replicas will
      not be auto-migrated.
      
      Fixes #4896
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      1cab9620
  4. 01 Apr, 2021 8 commits
    • Wang Yuan's avatar
      Handle remaining fsync errors (#8419) · 1eb85249
      Wang Yuan authored
      In `aof.c`, we call fsync when stop aof, and now print a log to let user know that if fail.
      In `cluster.c`, we now return error, the calling function already handles these write errors.
      In `redis-cli.c`, users hope to save rdb, we now print a message if fsync failed.
      In `rio.c`, we now treat fsync errors like we do for write errors. 
      In `server.c`, we try to fsync aof file when shutdown redis, we only can print one log if fail.
      In `bio.c`, if failing to fsync aof file, we will set `aof_bio_fsync_status` to error , and reject writing just like last writing aof error,  moreover also set INFO command field `aof_last_write_status` to error.
      1eb85249
    • Valentino Geron's avatar
      Fix XAUTOCLAIM response to return the next available id as the cursor (#8725) · 44d8b039
      Valentino Geron authored
      This command used to return the last scanned entry id as the cursor,
      instead of the next one to be scanned.
      so in the next call, the user could / should have sent `(cursor` and not
      just `cursor` if he wanted to avoid scanning the same record twice.
      
      Scanning the record twice would look odd if someone is checking what
      exactly was scanned, but it also has a side effect of incrementing the
      delivery count twice.
      44d8b039
    • Oran Agra's avatar
      Solve sentinel test issue in TLS due to recent tests change. (#8728) · 370ab4c4
      Oran Agra authored
      5629dbe7 added a change that configures the tcp (plaintext) port
      alongside the tls port, this causes the INFO command for tcp_port
      to return that instead of the tls port when running in tls, and that broke
      the sentinel tests that query it.
      
      the fix is to add a method that gets the right port from CONFIG instead
      of relying on the tcp_port info field.
      370ab4c4
    • guybe7's avatar
      zsetAdd: Fix wrong reply in case of INCR and GT/LT (#8717) · 843f769b
      guybe7 authored
      If GT/LT fails the operation we need to reply with
      nill (like failure due to NX).
      
      Other changes:
      Add the missing $encoding suffix to many zset tests
      
      Note: there's a behavior change just in case of INCR + GT/LT that fails.
      The old code was replying with the wrong (rejected) score, and now it'll reply with nil.
      
      Note that that's anyway a corner case so this "behavior change" shouldn't have too much affect.
      Using GT/LT with INCR has a predictable result even before we run the command
      (INCR GT will only only / always fail if the increment is negative).
      843f769b
    • Wen Hui's avatar
      generalize config file check for sentinel (#8730) · d5935bb0
      Wen Hui authored
      The implications of this change is just that in the past when a config file was missing,
      in some cases it was exiting before printing the sever startup prints and sometimes after,
      and now it'll always exit before printing them.
      d5935bb0
    • wuYin's avatar
      reuse existing range comparators in the zset (#8714) · e5d50b23
      wuYin authored
      There are 2 common range comparators for skiplist: zslValueGteMin and
      zslValueLteMax, but they're not being reused in zslDeleteRangeByScore
      
      This is a small change to make code cleaner.
      e5d50b23
    • Dvir Volk's avatar
      Added macros for RM_log logging levels (#4246) · 07f39ae4
      Dvir Volk authored
       Added macros for RM_log logging levels, to avoid typos and the need
      to memorize the level strings by heart
      07f39ae4
    • sundb's avatar
      Use chi-square for random distributivity verification in test (#8709) · 569a3f45
      sundb authored
      Problem:
      Currently, when performing random distribution verification, we determine
      the probability of each element occurring in the sum, but the probability is
      only an estimate, these tests had rare sporadic failures, and we cannot verify
      what the probability of failure will be.
      
      Solution:
      Using the chi-square distribution instead of the original random distribution
      validation makes the test more reasonable and easier to find problems.
      569a3f45
  5. 31 Mar, 2021 2 commits
  6. 30 Mar, 2021 7 commits
    • guybe7's avatar
      XAUTOCLAIM: JUSTID should prevent incrementing delivery_count (#8724) · 2c120af6
      guybe7 authored
      To align with XCLAIM and the XAUTOCLAIM docs
      2c120af6
    • Jérôme Loyet's avatar
      Add replica-announced config option (#8653) · 91f4f416
      Jérôme Loyet authored
      The 'sentinel replicas <master>' command will ignore replicas with
      `replica-announced` set to no.
      
      The goal of disabling the config setting replica-announced is to allow ghost
      replicas. The replica is in the cluster, synchronize with its master, can be
      promoted to master and is not exposed to sentinel clients. This way, it is
      acting as a live backup or living ghost.
      
      In addition, to prevent the replica to be promoted as master, set
      replica-priority to 0.
      91f4f416
    • Yossi Gottlieb's avatar
      Cluster migration test cleanup. (#8726) · 6a052af8
      Yossi Gottlieb authored
      * Dump more output on error (always, cluster tests currently have no
      verbose flag).
      * Slow down redis-cli check iteration.
      6a052af8
    • Viktor Söderqvist's avatar
      Add support for plaintext clients in TLS cluster (#8587) · 5629dbe7
      Viktor Söderqvist authored
      The cluster bus is established over TLS or non-TLS depending on the configuration tls-cluster. The client ports distributed in the cluster and sent to clients are assumed to be TLS or non-TLS also depending on tls-cluster.
      
      The cluster bus is now extended to also contain the non-TLS port of clients in a TLS cluster, when available. The non-TLS port of a cluster node, when available, is sent to clients connected without TLS in responses to CLUSTER SLOTS, CLUSTER NODES, CLUSTER SLAVES and MOVED and ASK redirects, instead of the TLS port.
      
      The user was able to override the client port by defining cluster-announce-port. Now cluster-announce-tls-port is added, so the user can define an alternative announce port for both TLS and non-TLS clients.
      
      Fixes #8134
      5629dbe7
    • yoav-steinberg's avatar
      Minor client output buffer optimizations (#8699) · 8cbd858d
      yoav-steinberg authored
      * Avoid checking output limits if buffer didn't grow.
      * Use previouse node in case it has room in deferred output node.
      8cbd858d
    • JunhuaY's avatar
      re-fix config rewrite for empty save directive (#8722) · 28375ff6
      JunhuaY authored
      the bug was also discussed in #8716, and was solved in #8719, but incompletely:
      when the server is started, and the save option is default, if you issue the " config set save "" "
      to change the save option, and then issue the “config rewrite” command, the " save "" " won't be saved.
      28375ff6
    • Oran Agra's avatar
      solve race conditions in psync2-pingoff test (#8720) · cd81dcf1
      Oran Agra authored
      Another test race condition in the macos tests.
      the test was waiting for PINGs to be generated and put on the replication stream,
      but waiting for 1 or 2 seconds doesn't really guarantee that.
      then the test that expected 6 full syncs, found only 4
      cd81dcf1
  7. 29 Mar, 2021 3 commits
  8. 28 Mar, 2021 2 commits
  9. 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
  10. 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
  11. 24 Mar, 2021 4 commits