1. 12 Dec, 2022 12 commits
    • Moti Cohen's avatar
      Fix sentinel function that compares hostnames (if failed resolve) (#11419) · 19d01b62
      Moti Cohen authored
      Funcion sentinelAddrEqualsHostname() of sentinel makes DNS resolve
      and based on it determines if two IP addresses are equal. Now, If the
      DNS resolve command fails, the function simply returns 0, even if the
      hostnames are identical.
      
      This might become an issue in case of failover such that sentinel might
      receives from Redis instance, response to regular INFO query it sent,
      and wrongly decide that the instance is pointing to is different leader
      than the one recorded because of this function, yet hostnames are
      identical. In turn sentinel disconnects the connection between sentinel
      and valid slave which leads to -failover-abort-no-good-slave.
      See issue #11241.
      
      I managed to reproduce only part of the flow in which the function
      return wrong result and trigger +fix-slave-config.
      
      The fix is even if the function failed to resolve then compare based on
      hostnames. That is our best effort as long as the server is unavailable
      for some reason. It is fine since Redis instance cannot have multiple
      hostnames for a given setup
      
      (cherry picked from commit bd23b15a)
      19d01b62
    • sundb's avatar
      Fix crash due to to reuse iterator entry after list deletion in module (#11383) · 9fc20f4f
      sundb authored
      
      
      In the module, we will reuse the list iterator entry for RM_ListDelete, but `listTypeDelete` will only update
      `quicklistEntry->zi` but not `quicklistEntry->node`, which will result in `quicklistEntry->node` pointing to
      a freed memory address if the quicklist node is deleted.
      
      This PR sync `key->u.list.index` and `key->u.list.entry` to list iterator after `RM_ListDelete`.
      
      This PR also optimizes the release code of the original list iterator.
      Co-authored-by: default avatarViktor Söderqvist <viktor@zuiderkwast.se>
      (cherry picked from commit 6dd21355)
      9fc20f4f
    • C Charles's avatar
      MIGTATE with AUTH that contains "keys" is getting wrong key names in... · f95af778
      C Charles authored
      MIGTATE with AUTH that contains "keys" is getting wrong key names in migrateGetKeys, leads to ACL errors (#11253)
      
      When using the MIGRATE, with a destination Redis that has the user name or password set to the string "keys",
      Redis would have determine the wrong set of key names the command is gonna access.
      This lead to ACL returning wrong authentication result.
      
      Destination instance:
      ```
      127.0.0.1:6380> acl setuser default >keys
      OK
      127.0.0.1:6380> acl setuser keys on nopass ~* &* +@all
      OK
      ```
      
      Source instance:
      ```
      127.0.0.1:6379> set a 123
      OK
      127.0.0.1:6379> acl setuser cc on nopass ~a* +@all
      OK
      127.0.0.1:6379> auth cc 1
      OK
      127.0.0.1:6379> migrate 127.0.0.1 6380 "" 0 1000 auth keys keys a
      (error) NOPERM this user has no permissions to access one of the keys used as arguments
      127.0.0.1:6379> migrate 127.0.0.1 6380 "" 0 1000 auth2 keys pswd keys a
      (error) NOPERM this user has no permissions to access one of the keys used as arguments
      ```
      
      Using `acl dryrun` we know that the parameters of `auth` and `auth2` are mistaken for the `keys` option.
      ```
      127.0.0.1:6379> acl dryrun cc migrate whatever whatever "" 0 1000 auth keys keys a
      "This user has no permissions to access the 'keys' key"
      127.0.0.1:6379> acl dryrun cc migrate whatever whatever "" 0 1000 auth2 keys pswd keys a
      "This user has no permissions to access the 'pswd' key"
      ```
      
      Fix the bug by editing db.c/migrateGetKeys function, which finds the `keys` option and all the keys following.
      
      (cherry picked from commit 9ab873d9)
      f95af778
    • Oran Agra's avatar
      Improve linux overcommit check and warning (#11357) · 92ad0b5c
      Oran Agra authored
      1. show the overcommit warning when overcommit is disabled (2),
         not just when it is set to heuristic (0).
      2. improve warning text to mention the issue with jemalloc causing VM
         mapping fragmentation when set to 2.
      
      (cherry picked from commit dd60c6c8)
      92ad0b5c
    • Meir Shpilraien (Spielrein)'s avatar
      `RedisModule_ResetDataset` should not clear the functions. (#11268) · 6cf24fa4
      Meir Shpilraien (Spielrein) authored
      As mentioned on docs, `RM_ResetDataset` Performs similar operation to FLUSHALL.
      As FLUSHALL do not clean the function, `RM_ResetDataset` should not clean the functions
      as well.
      
      (cherry picked from commit d2ad01ab)
      6cf24fa4
    • Meir Shpilraien (Spielrein)'s avatar
      Avoid crash on crash report when a bad function pointer was called (#11298) · b1ede212
      Meir Shpilraien (Spielrein) authored
      If Redis crashes due to calling an invalid function pointer,
      the `backtrace` function will try to dereference this invalid pointer
      which will cause a crash inside the crash report and will kill
      the processes without having all the crash report information.
      
      Example:
      
      ```
      === REDIS BUG REPORT START: Cut & paste starting from here ===
      198672:M 19 Sep 2022 18:06:12.936 # Redis 255.255.255 crashed by signal: 11, si_code: 1
      198672:M 19 Sep 2022 18:06:12.936 # Accessing address: 0x1
      198672:M 19 Sep 2022 18:06:12.936 # Crashed running the instruction at: 0x1
      // here the processes is crashing
      ```
      
      This PR tries to fix this crash be:
      1. Identify the issue when it happened.
      2. Replace the invalid pointer with a pointer to some dummy function
         so that `backtrace` will not crash.
      
      I identification is done by comparing `eip` to `info->si_addr`, if they
      are the same we know that the crash happened on the same address it tries to
      accesses and we can conclude that it tries to call and invalid function pointer.
      
      To replace the invalid pointer we introduce a new function, `setMcontextEip`,
      which is very similar to `getMcontextEip` and it knows to set the Eip for the
      different supported OS's. After printing the trace we retrieve the old `Eip` value.
      
      (cherry picked from commit 0bf90d94)
      b1ede212
    • guybe7's avatar
      RM_CreateCommand should not set CMD_KEY_VARIABLE_FLAGS automatically (#11320) · 5b2119c6
      guybe7 authored
      The original idea behind auto-setting the default (first,last,step) spec was to use
      the most "open" flags when the user didn't provide any key-spec flags information.
      
      While the above idea is a good approach, it really makes no sense to set
      CMD_KEY_VARIABLE_FLAGS if the user didn't provide the getkeys-api flag:
      in this case there's not way to retrieve these variable flags, so what's the point?
      
      Internally in redis there was code to ignore this already, so this fix doesn't change
      redis's behavior, it only affects the output of COMMAND command.
      
      (cherry picked from commit 3330ea18)
      5b2119c6
    • Steffen Moser's avatar
      Fixing compilation by removing flock() when compiling on Solaris (#11327) · 929ab58a
      Steffen Moser authored
      SunOS/Solaris and its relatives don't support the flock() function.
      While "redis" has been excluding setting up the lock using flock() on the cluster
      configuration file when compiling under Solaris, it was still using flock() in the
      unlock call while shutting down.
      
      This pull request eliminates the flock() call also in the unlocking stage
      for Oracle Solaris and its relatives.
      
      Fix compilation regression from #10912
      
      (cherry picked from commit 6aab4cb7)
      929ab58a
    • Binbin's avatar
      Fix CLUSTER SHARDS showing empty hostname (#11297) · 79414d45
      Binbin authored
      * Fix CLUSTER SHARDS showing empty hostname
      
      In #10290, we changed clusterNode hostname from `char*`
      to `sds`, and the old `node->hostname` was changed to
      `sdslen(node->hostname)!=0`.
      
      But in `addNodeDetailsToShardReply` it is missing.
      It results in the return of an empty string hostname
      in CLUSTER SHARDS command if it unavailable.
      
      Like this (note that we listed it as optional in the doc):
      ```
       9) "hostname"
      10) ""
      ```
      
      (cherry picked from commit 1de675b3)
      79414d45
    • Shaya Potter's avatar
      Add RM_SetContextUser to support acl validation in RM_Call (and scripts) (#10966) · b8fcd322
      Shaya Potter authored
      Adds a number of user management/ACL validaiton/command execution functions to improve a
      Redis module's ability to enforce ACLs correctly and easily.
      
      * RM_SetContextUser - sets a RedisModuleUser on the context, which RM_Call will use to both
        validate ACLs (if requested and set) as well as assign to the client so that scripts executed via
        RM_Call will have proper ACL validation.
      * RM_SetModuleUserACLString - Enables one to pass an entire ACL string, not just a single OP
        and have it applied to the user
      * RM_GetModuleUserACLString - returns a stringified version of the user's ACL (same format as dump
        and list).  Contains an optimization to cache the stringified version until the underlying ACL is modified.
      * Slightly re-purpose the "C" flag to RM_Call from just being about ACL check before calling the
        command, to actually running the command with the right user, so that it also affects commands
        inside EVAL scripts. see #11231
      
      (cherry picked from commit 6e993a5d)
      b8fcd322
    • Valentino Geron's avatar
      Replica that asks for rdb only should be closed right after the rdb part (#11296) · d279ec25
      Valentino Geron authored
      The bug is that the the server keeps on sending newlines to the client.
      As a result, the receiver might not find the EOF marker since it searches
      for it only on the end of each payload it reads from the socket.
      The but only affects `CLIENT_REPL_RDBONLY`.
      This affects `redis-cli --rdb` (depending on timing)
      
      The fixed consist of two steps:
      1. The `CLIENT_REPL_RDBONLY` should be closed ASAP (we cannot
         always call to `freeClient` so we use `freeClientAsync`)
      2. Add new replication state `SLAVE_STATE_RDB_TRANSMITTED`
      
      (cherry picked from commit e53bf652)
      d279ec25
    • Ariel Shtul's avatar
      [PERF] use snprintf once in addReplyDouble (#11093) · a221fc85
      Ariel Shtul authored
      The previous implementation calls `snprintf` twice, the second time used to
      'memcpy' the output of the first, which could be a very large string.
      The new implementation reserves space for the protocol header ahead
      of the formatted double, and then prepends the string length ahead of it.
      
      Measured improvement of simple ZADD of some 25%.
      
      (cherry picked from commit 90223759)
      a221fc85
  2. 21 Sep, 2022 28 commits
    • dependabot[bot]'s avatar
      Bump vmactions/freebsd-vm from 0.2.3 to 0.2.4 (#11203) · 1571907e
      dependabot[bot] authored
      Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 0.2.3 to 0.2.4.
      - [Release notes](https://github.com/vmactions/freebsd-vm/releases)
      - [Commits](https://github.com/vmactions/freebsd-vm/compare/v0.2.3...v0.2.4
      
      )
      
      ---
      updated-dependencies:
      - dependency-name: vmactions/freebsd-vm
        dependency-type: direct:production
        update-type: version-update:semver-patch
      ...
      Signed-off-by: default avatardependabot[bot] <support@github.com>
      Signed-off-by: default avatardependabot[bot] <support@github.com>
      Co-authored-by: default avatardependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      
      (cherry picked from commit c66eaf4e)
      1571907e
    • dependabot[bot]'s avatar
      Bump vmactions/freebsd-vm from 0.2.0 to 0.2.3 (#11072) · a06b68b9
      dependabot[bot] authored
      Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 0.2.0 to 0.2.3.
      - [Release notes](https://github.com/vmactions/freebsd-vm/releases)
      - [Commits](https://github.com/vmactions/freebsd-vm/compare/v0.2.0...v0.2.3
      
      )
      
      ---
      updated-dependencies:
      - dependency-name: vmactions/freebsd-vm
        dependency-type: direct:production
        update-type: version-update:semver-patch
      ...
      Signed-off-by: default avatardependabot[bot] <support@github.com>
      Co-authored-by: default avatardependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      
      (cherry picked from commit 4fe9242a)
      a06b68b9
    • Yossi Gottlieb's avatar
      CI: Update vmaction. (#11013) · 7c0d1605
      Yossi Gottlieb authored
      
      (cherry picked from commit b550a55c)
      7c0d1605
    • Oran Agra's avatar
      Redis 7.0.5 · b2a250ce
      Oran Agra authored
      b2a250ce
    • Oran Agra's avatar
      Fix heap overflow vulnerability in XAUTOCLAIM (CVE-2022-35951) · fa6815e1
      Oran Agra authored
      Executing an XAUTOCLAIM command on a stream key in a specific state, with a
      specially crafted COUNT argument may cause an integer overflow, a subsequent
      heap overflow, and potentially lead to remote code execution.
      The problem affects Redis versions 7.0.0 or newer.
      fa6815e1
    • Shaya Potter's avatar
      Improve cmd_flags for script/functions in RM_Call (#11159) · a1ec0cae
      Shaya Potter authored
      When RM_Call was used with `M` (reject OOM), `W` (reject writes),
      as well as `S` (rejecting stale or write commands in "Script mode"),
      it would have only checked the command flags, but not the declared
      script flag in case it's a command that runs a script.
      
      Refactoring: extracts out similar code in server.c's processCommand
      to be usable in RM_Call as well.
      
      (cherry picked from commit bed6d759)
      a1ec0cae
    • Madelyn Olson's avatar
      Cluster test infra (taken from #10920) · b8beda61
      Madelyn Olson authored
      * Taking just the test infrastrucutre from that commit.
      
      (cherry picked from commit 8a4e3bcd)
      b8beda61
    • Shay Fadida's avatar
      Fix missing sections for INFO ALL with module (#11291) · c9eabbf9
      Shay Fadida authored
      
      
      When using `INFO ALL <section>`, when `section` is a specific module section. 
      Redis will not print the additional section(s).
      
      The fix in this case, will search the modules info sections if the user provided additional sections to `ALL`.
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      (cherry picked from commit eedb8b17)
      c9eabbf9
    • Binbin's avatar
      Fix Invalid node address specified in redis-cli --cluster create/add-node (#11151) · 842fd1fb
      Binbin authored
      This bug was introduced in #10344 (7.0.3), and it breaks the
      redis-cli --cluster create usage in #10436 (7.0 RC3).
      
      At the same time, the cluster-port support introduced in #10344
      cannot use the DNS lookup brought by #10436.
      
      (cherry picked from commit c2b0c13d)
      842fd1fb
    • sundb's avatar
      Fix crash due to delete entry from compress quicklistNode and wrongly split quicklistNode (#11242) · 01358df3
      sundb authored
      This PR mainly deals with 2 crashes introduced in #9357,
      and fix the QUICKLIST-PACKED-THRESHOLD mess in external test mode.
      
      1. Fix crash due to deleting an entry from a compress quicklistNode
         When inserting a large element, we need to create a new quicklistNode first,
         and then delete its previous element, if the node where the deleted element is
         located is compressed, it will cause a crash.
         Now add `dont_compress` to quicklistNode, if we want to use a quicklistNode
         after some operation, we can use this flag like following:
      
          ```c
          node->dont_compress = 1; /* Prevent to be compressed */
          some_operation(node); /* This operation might try to compress this node */
          some_other_operation(node); /* We can use this node without decompress it */
          node->dont_compress = 0; /* Re-able compression */
          quicklistCompressNode(node);
          ```
      
         Perhaps in the future, we could just disable the current entry from being
         compressed during the iterator loop, but that would require more work.
      
      2. Fix crash due to wrongly split quicklist
         before #9357, the offset param of _quicklistSplitNode() will not negative.
         For now, when offset is negative, the split extent will be wrong.
         following example:
          ```c
          int orig_start = after ? offset + 1 : 0;
          int orig_extent = after ? -1 : offset;
          int new_start = after ? 0 : offset;
          int new_extent = after ? offset + 1 : -1;
          # offset: -2, after: 1, node->count: 2
          # current wrong range: [-1,-1] [0,-1]
          # correct range: [1,-1] [0, 1]
          ```
      
         Because only `_quicklistInsert()` splits the quicklistNode and only
         `quicklistInsertAfter()`, `quicklistInsertBefore()` call _quicklistInsert(), 
         so `quicklistReplaceEntry()` and `listTypeInsert()` might occur this crash.
         But the iterator of `listTypeInsert()` is alway from head to tail(iter->offset is
         always positive), so it is not affected.
         The final conclusion is this crash only occur when we insert a large element
         with negative index into a list, that affects `LSET` command and `RM_ListSet`
         module api.
           
      3. In external test mode, we need to restore quicklist packed threshold after
         when the end of test.
      4. Show `node->count` in quicklistRepr().
      5. Add new tcl proc `config_get_set` to support restoring config in tests.
      
      (cherry picked from commit 13d25dd9)
      01358df3
    • zhaozhao.zz's avatar
      fix infinite sleep in performEvictions when have lazyfree jobs (#11237) · 2f6537dc
      zhaozhao.zz authored
      This bug is introduced in #7653. (Redis 6.2.0)
      
      When `server.maxmemory_eviction_tenacity` is 100, `eviction_time_limit_us` is
      `ULONG_MAX`, and if we cannot find the best key to delete (e.g. maxmemory-policy
      is `volatile-lru` and all keys with ttl have been evicted), in `cant_free` redis will sleep
      forever if some items are being freed in the lazyfree thread.
      
      (cherry picked from commit 464aa041)
      2f6537dc
    • Viktor Söderqvist's avatar
      6edbf707
    • Madelyn Olson's avatar
      Prevent use after free for inbound cluster link (#11255) · 7fc1a8c5
      Madelyn Olson authored
      
      (cherry picked from commit 6c03786b)
      7fc1a8c5
    • chendianqiang's avatar
      Correctly handle scripts with shebang (not read-only) on a cluster replica (#11223) · 8c702f8d
      chendianqiang authored
      
      
      EVAL scripts are by default not considered `write` commands, so they were allowed on a replica.
      But when adding a shebang, they become `write` command (unless the `no-writes` flag is added).
      With this change we'll handle them as write commands, and reply with MOVED instead of
      READONLY when executed on a redis cluster replica.
      Co-authored-by: default avatarchendianqiang <chendianqiang@meituan.com>
      (cherry picked from commit e42d98ed)
      8c702f8d
    • Huang Zhw's avatar
      Remove the NONDETERMINISTIC_OUTPUT flag from most CLUSTER sub-commands. (#11157) · 63db10ef
      Huang Zhw authored
      TLDR: the CLUSTER command originally had the `random` flag,
      so all the sub-commands initially got that new flag, but in fact many
      of them don't need it.
      The only effect of this change is on the output of COMMAND INFO.
      
      (cherry picked from commit a7da7473)
      63db10ef
    • Oran Agra's avatar
      Fix assertion when a key is lazy expired during cluster key migration (#11176) · a2a28b80
      Oran Agra authored
      Redis 7.0 has #9890 which added an assertion when the propagation queue
      was not flushed and we got to beforeSleep.
      But it turns out that when processCommands calls getNodeByQuery and
      decides to reject the command, it can lead to a key that was lazy
      expired and is deleted without later flushing the propagation queue.
      
      This change prevents lazy expiry from deleting the key at this stage
      (not as part of a command being processed in `call`)
      
      (cherry picked from commit c789fb0a)
      a2a28b80
    • Itamar Haber's avatar
      Replaces a made-up term with a real one (#11169) · 1e2876e0
      Itamar Haber authored
      (cherry picked from commit 407b5c91)
      1e2876e0
    • Itamar Haber's avatar
      Adds historical note about lower-case geo units support (#11162) · dbb7337e
      Itamar Haber authored
      This change was part of #9656 (Redis 7.0)
      
      (cherry picked from commit 31ef410e)
      dbb7337e
    • Binbin's avatar
      Fix memory leak in moduleFreeCommand (#11147) · fa60cd13
      Binbin authored
      Currently, we call zfree(cmd->args), but the argument array
      needs to be freed recursively (there might be sub-args).
      Also fixed memory leaks on cmd->tips and cmd->history.
      
      Fixes #11145
      
      (cherry picked from commit fc3956e8)
      fa60cd13
    • DarrenJiang13's avatar
      fix the client type in trackingInvalidateKey() (#11052) · 4dfc487f
      DarrenJiang13 authored
      Fix bug with scripts ignoring client tracking NOLOOP and
      send an invalidation message anyway.
      
      (cherry picked from commit 44859a41)
      4dfc487f
    • Huang Zhw's avatar
      acl: bitfield with get and set|incrby can be executed with readonly permission (#11086) · ab524282
      Huang Zhw authored
      `bitfield` with `get` may not be readonly.
      
      ```
      127.0.0.1:6384> acl setuser hello on nopass %R~* +@all
      
      
      OK
      127.0.0.1:6384> auth hello 1
      OK
      127.0.0.1:6384> bitfield hello set i8 0 1
      (error) NOPERM this user has no permissions to access one of the keys used as arguments
      127.0.0.1:6384> bitfield hello set i8 0 1 get i8 0
      1) (integer) 0
      2) (integer) 1
      ```
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      (cherry picked from commit ec5034a2)
      ab524282
    • Wen Hui's avatar
      Fix function load error message (#10964) · d1b3276b
      Wen Hui authored
      Update error messages for function load
      
      (cherry picked from commit beb9746a)
      d1b3276b
    • Rudi Floren's avatar
      Fix wrong commands json docs for CLIENT KILL (#10970) · 631eb383
      Rudi Floren authored
      The docs state that there is a new and an old argument format.
      The current state of the arguments allows mixing the old and new format,
      thus the need for two additional oneof blocks.
      One for differentiating the new from the old format and then one to
      allow setting multiple filters using the new format.
      
      (cherry picked from commit 4ce3fd51)
      631eb383
    • Huang Zhw's avatar
      tracking pending invalidation message of flushdb sent by (#11068) · 5632bbdc
      Huang Zhw authored
      trackingHandlePendingKeyInvalidations should use proto.
      
      (cherry picked from commit 61451b02)
      5632bbdc
    • Huang Zhw's avatar
      When client tracking is on, invalidation message of flushdb in a (#11038) · ba6ed445
      Huang Zhw authored
      When FLUSHDB / FLUSHALL / SWAPDB is inside MULTI / EXEC, the
      client side tracking invalidation message was interleaved with transaction response.
      
      
      (cherry picked from commit 6f0a27e3)
      ba6ed445
    • Meir Shpilraien (Spielrein)'s avatar
      Fix #11030, use lua_rawget to avoid triggering metatables and crash. (#11032) · ddf1bcf7
      Meir Shpilraien (Spielrein) authored
      Fix #11030, use lua_rawget to avoid triggering metatables.
      
      #11030 shows how return `_G` from the Lua script (either function or eval), cause the
      Lua interpreter to Panic and the Redis processes to exit with error code 1.
      Though return `_G` only panic on Redis 7 and 6.2.7, the underline issue exists on older
      versions as well (6.0 and 6.2). The underline issue is returning a table with a metatable
      such that the metatable raises an error.
      
      The following example demonstrate the issue:
      ```
      127.0.0.1:6379> eval "local a = {}; setmetatable(a,{__index=function() foo() end}) return a" 0
      Error: Server closed the connection
      ```
      ```
      PANIC: unprotected error in call to Lua API (user_script:1: Script attempted to access nonexistent global variable 'foo')
      ```
      
      The Lua panic happened because when returning the result to the client, Redis needs to
      introspect the returning table and transform the table into a resp. In order to scan the table,
      Redis uses `lua_gettable` api which might trigger the metatable (if exists) and might raise an error.
      This code is not running inside `pcall` (Lua protected call), so raising an error causes the
      Lua to panic and exit. Notice that this is not a crash, its a Lua panic that exit with error code 1.
      
      Returning `_G` panics on Redis 7 and 6.2.7 because on those versions `_G` has a metatable
      that raises error when trying to fetch a none existing key.
      
      ### Solution
      
      Instead of using `lua_gettable` that might raise error and cause the issue, use `lua_rawget`
      that simply return the value from the table without triggering any metatable logic.
      This is promised not to raise and error.
      
      The downside of this solution is that it might be considered as breaking change, if someone
      rely on metatable in the returned value. An alternative solution is to wrap this entire logic
      with `pcall` (Lua protected call), this alternative require a much bigger refactoring.
      
      ### Back Porting
      
      The same fix will work on older versions as well (6.2, 6.0). Notice that on those version,
      the issue can cause Redis to crash if inside the metatable logic there is an attempt to accesses
      Redis (`redis.call`). On 7.0, there is not crash and the `redis.call` is executed as if it was done
      from inside the script itself.
      
      ### Tests
      
      Tests was added the verify the fix
      
      (cherry picked from commit 020e046b)
      ddf1bcf7
    • Binbin's avatar
      fsync the old aof file when open a new INCR AOF (#11004) · 5da7fdb7
      Binbin authored
      
      
      In rewriteAppendOnlyFileBackground, after flushAppendOnlyFile(1),
      and before openNewIncrAofForAppend, we should call redis_fsync
      to fsync the aof file.
      
      Because we may open a new INCR AOF in openNewIncrAofForAppend,
      in the case of using everysec policy, the old AOF file may not
      be fsynced in time (or even at all).
      
      When using everysec, we don't want to pay the disk latency from
      the main thread, so we will do a background fsync.
      
      Adding a argument for bioCreateCloseJob, a `need_fsync` flag to
      indicate that a fsync is required before the file is closed. So we will
      fsync the old AOF file before we close it.
      
      A cleanup, we make union become a union, since the free_* args and
      the fd / fsync args are never used together.
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      (cherry picked from commit 03fff10a)
      5da7fdb7
    • chenyang8094's avatar
      Register abs-expire apis (#11025) · c0394286
      chenyang8094 authored
      RM_SetAbsExpire and RM_GetAbsExpire were not actually operational since
      they were introduced, due to omission in API registration.
      
      (cherry picked from commit 39d216a3)
      c0394286