1. 11 Oct, 2020 7 commits
    • 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
  2. 08 Oct, 2020 2 commits
    • Felipe Machado's avatar
      Adds new pop-push commands (LMOVE, BLMOVE) (#6929) · c3f9e017
      Felipe Machado authored
      
      
      Adding [B]LMOVE <src> <dst> RIGHT|LEFT RIGHT|LEFT. deprecating [B]RPOPLPUSH.
      
      Note that when receiving a BRPOPLPUSH we'll still propagate an RPOPLPUSH,
      but on BLMOVE RIGHT LEFT we'll propagate an LMOVE
      
      improvement to existing tests
      - Replace "after 1000" with "wait_for_condition" when wait for
        clients to block/unblock.
      - Add a pre-existing element to target list on basic tests so
        that we can check if the new element was added to the correct
        side of the list.
      - check command stats on the replica to make sure the right
        command was replicated
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      c3f9e017
    • Madelyn Olson's avatar
  3. 07 Oct, 2020 1 commit
  4. 06 Oct, 2020 1 commit
    • Oran Agra's avatar
      Allow blocked XREAD on a cluster replica (#7881) · 216c1106
      Oran Agra authored
      I suppose that it was overlooked, since till recently none of the blocked commands were readonly.
      
      other changes:
      - add test for the above.
      - add better support for additional (and deferring) clients for
        cluster tests
      - improve a test which left the client in MULTI state.
      216c1106
  5. 05 Oct, 2020 3 commits
  6. 04 Oct, 2020 2 commits
  7. 02 Oct, 2020 2 commits
  8. 01 Oct, 2020 3 commits
  9. 30 Sep, 2020 3 commits
    • nitaicaro's avatar
      Fixed Tracking test “The other connection is able to get invalidations” (#7871) · 8fb89a57
      nitaicaro authored
      
      
      PROBLEM:
      
      [$rd1 read] reads invalidation messages one by one, so it's never going to see the second invalidation message produced after INCR b, whether or not it exists. Adding another read will block incase no invalidation message is produced.
      
      FIX:
      
      We switch the order of "INCR a" and "INCR b" - now "INCR b" comes first. We still only read the first invalidation message produces. If an invalidation message is wrongly produces for b - then it will be produced before that of a, since "INCR b" comes before "INCR a".
      Co-authored-by: default avatarNitai Caro <caronita@amazon.com>
      8fb89a57
    • Yossi Gottlieb's avatar
      Modules: expose real client on conn events. · 67b43f75
      Yossi Gottlieb authored
      When REDISMODULE_EVENT_CLIENT_CHANGE events are delivered, modules may
      want to mutate the client state (e.g. perform authentication).
      
      This change links the module context with the real client rather than a
      fake client for these events.
      67b43f75
    • Yossi Gottlieb's avatar
      Module API: Fail ineffective auth calls. · cfccfbd6
      Yossi Gottlieb authored
      The client pointed to by the module context may in some cases be a fake
      client. RM_Authenticate*() calls in this case would be ineffective but
      appear to succeed, and this change fails them to make it easier to catch
      such cases.
      cfccfbd6
  10. 29 Sep, 2020 6 commits
  11. 28 Sep, 2020 1 commit
  12. 27 Sep, 2020 3 commits
  13. 25 Sep, 2020 3 commits
    • Wang Yuan's avatar
      Set 'loading' and 'shutdown_asap' to volatile sig_atomic_t type (#7845) · f1863a1f
      Wang Yuan authored
      We may access and modify these two variables in signal handler function,
      to guarantee them async-signal-safe, so we should set them to volatile
      sig_atomic_t type.
      
      It doesn't look like this could have caused any real issue, and it seems that
      signals are handled in main thread on most platforms. But we want to follow C
      and POSIX standard in signal handler function.
      f1863a1f
    • Uri Shachar's avatar
      Fix config rewrite file handling to make it really atomic (#7824) · c30bd02c
      Uri Shachar authored
      Make sure we handle short writes correctly, sync to disk after writing  and use
      rename to make sure the replacement is actually atomic.
      In any case of failure old configuration will remain in place.
      
      Also, add some additional logging to make it easier to diagnose rewrite problems.
      c30bd02c
    • WuYunlong's avatar
      Add fsync to readSyncBulkPayload(). (#7839) · 0d62caab
      WuYunlong authored
      We should sync temp DB file before renaming as rdb_fsync_range does not use
      flag `SYNC_FILE_RANGE_WAIT_AFTER`.
      
      Refer to `Linux Programmer's Manual`:
      SYNC_FILE_RANGE_WAIT_AFTER
          Wait upon write-out of all pages in the range after performing any write.
      0d62caab
  14. 24 Sep, 2020 3 commits
    • Wen Hui's avatar
      rdb.c: handle fclose error case differently to avoid double fclose (#7307) · 323029ba
      Wen Hui authored
      When fclose would fail, the previous implementation would have attempted to do fclose again
      this can in theory lead to segfault.
      
      other changes:
      check for non-zero return value as failure rather than a specific error code.
      this doesn't fix a real bug, just a minor cleanup.
      323029ba
    • Wang Yuan's avatar
      Don't write replies if close the client ASAP (#7202) · 57709c4b
      Wang Yuan authored
      
      
      Before this commit, we would have continued to add replies to the reply buffer even if client
      output buffer limit is reached, so the used memory would keep increasing over the configured limit.
      What's more, we shouldn’t write any reply to the client if it is set 'CLIENT_CLOSE_ASAP' flag
      because that doesn't conform to its definition and we will close all clients flagged with
      'CLIENT_CLOSE_ASAP' in ‘beforeSleep’.
      
      Because of code execution order, before this, we may firstly write to part of the replies to
      the socket before disconnecting it, but in fact, we may can’t send the full replies to clients
      since OS socket buffer is limited. But this unexpected behavior makes some commands work well,
      for instance ACL DELUSER, if the client deletes the current user, we need to send reply to client
      and close the connection, but before, we close the client firstly and write the reply to reply
      buffer. secondly, we shouldn't do this despite the fact it works well in most cases.
      
      We add a flag 'CLIENT_CLOSE_AFTER_COMMAND' to mark clients, this flag means we will close the
      client after executing commands and send all entire replies, so that we can write replies to
      reply buffer during executing commands, send replies to clients, and close them later.
      
      We also fix some implicit problems. If client output buffer limit is enforced in 'multi/exec',
      all commands will be executed completely in redis and clients will not read any reply instead of
      partial replies. Even more, if the client executes 'ACL deluser' the using user in 'multi/exec',
      it will not read the replies after 'ACL deluser' just like before executing 'client kill' itself
      in 'multi/exec'.
      
      We added some tests for output buffer limit breach during multi-exec and using a pipeline of
      many small commands rather than one with big response.
      Co-authored-by: default avatarOran Agra <oran@redislabs.com>
      57709c4b
    • Guy Korland's avatar
      Fix RedisModule_HashGet examples (#6697) · b464afb9
      Guy Korland authored
      b464afb9