1. 17 Sep, 2019 1 commit
  2. 16 Sep, 2019 6 commits
  3. 13 Sep, 2019 3 commits
  4. 18 Mar, 2019 1 commit
  5. 29 Jan, 2019 1 commit
  6. 09 Jan, 2019 3 commits
  7. 09 Oct, 2018 1 commit
  8. 30 Sep, 2018 1 commit
  9. 11 Sep, 2018 1 commit
  10. 05 Sep, 2018 3 commits
    • antirez's avatar
      Use commands (effects) replication by default in scripts. · 7895835d
      antirez authored
      See issue #5250 and issue #5292 for more info.
      7895835d
    • antirez's avatar
      Safer script stop condition on OOM. · 7e11825e
      antirez authored
      Here the idea is that we do not want freeMemoryIfNeeded() to propagate a
      DEL command before the script and change what happens in the script
      execution once it reaches the slave. For example see this potential
      issue (in the words of @soloestoy):
      
      On master, we run the following script:
      
          if redis.call('get','key')
          then
              redis.call('set','xxx','yyy')
          end
          redis.call('set','c','d')
      
      Then when redis attempts to execute redis.call('set','xxx','yyy'), we call freeMemoryIfNeeded(), and the key may get deleted, and because redis.call('set','xxx','yyy') has already been executed on master, this script will be replicated to slave.
      
      But the slave received "DEL key" before the script, and will ignore maxmemory, so after that master has xxx and c, slave has only one key c.
      
      Note that this patch (and other related work) was authored collaboratively in
      issue #5250 with the help of @soloestoy and @oranagra.
      
      Related to issue #5250.
      7e11825e
    • antirez's avatar
      Propagate read-only scripts as SCRIPT LOAD. · 092e4de6
      antirez authored
      See issue #5250 and the new comments added to the code in this commit
      for details.
      092e4de6
  11. 03 Sep, 2018 2 commits
  12. 31 Aug, 2018 3 commits
  13. 26 Aug, 2018 1 commit
  14. 31 Jul, 2018 1 commit
  15. 22 Jul, 2018 1 commit
  16. 21 Jul, 2018 1 commit
  17. 16 Jul, 2018 1 commit
    • Oran Agra's avatar
      slave buffers were wasteful and incorrectly counted causing eviction · bf680b6f
      Oran Agra authored
      A) slave buffers didn't count internal fragmentation and sds unused space,
         this caused them to induce eviction although we didn't mean for it.
      
      B) slave buffers were consuming about twice the memory of what they actually needed.
      - this was mainly due to sdsMakeRoomFor growing to twice as much as needed each time
        but networking.c not storing more than 16k (partially fixed recently in 237a38737).
      - besides it wasn't able to store half of the new string into one buffer and the
        other half into the next (so the above mentioned fix helped mainly for small items).
      - lastly, the sds buffers had up to 30% internal fragmentation that was wasted,
        consumed but not used.
      
      C) inefficient performance due to starting from a small string and reallocing many times.
      
      what i changed:
      - creating dedicated buffers for reply list, counting their size with zmalloc_size
      - when creating a new reply node from, preallocate it to at least 16k.
      - when appending a new reply to the buffer, first fill all the unused space of the
        previous node before starting a new one.
      
      other changes:
      - expose mem_not_counted_for_evict info field for the benefit of the test suite
      - add a test to make sure slave buffers are counted correctly and that they don't cause eviction
      bf680b6f
  18. 02 Jul, 2018 1 commit
  19. 09 Jun, 2018 1 commit
  20. 07 Jun, 2018 1 commit
  21. 30 Apr, 2018 1 commit
    • Itamar Haber's avatar
      Adds memory information about the script's cache to INFO · 49890c8e
      Itamar Haber authored
      Implementation notes: as INFO is "already broken", I didn't want to break it further. Instead of computing the server.lua_script dict size on every call, I'm keeping a running sum of the body's length and dict overheads.
      
      This implementation is naive as it **does not** take into consideration dict rehashing, but that inaccuracy pays off in speed ;)
      
      Demo time:
      
      ```bash
      $ redis-cli info memory | grep "script"
      used_memory_scripts:96
      used_memory_scripts_human:96B
      number_of_cached_scripts:0
      $ redis-cli eval "" 0 ; redis-cli info memory | grep "script"
      (nil)
      used_memory_scripts:120
      used_memory_scripts_human:120B
      number_of_cached_scripts:1
      $ redis-cli script flush ; redis-cli info memory | grep "script"
      OK
      used_memory_scripts:96
      used_memory_scripts_human:96B
      number_of_cached_scripts:0
      $ redis-cli eval "return('Hello, Script Cache :)')" 0 ; redis-cli info memory | grep "script"
      "Hello, Script Cache :)"
      used_memory_scripts:152
      used_memory_scripts_human:152B
      number_of_cached_scripts:1
      $ redis-cli eval "return redis.sha1hex(\"return('Hello, Script Cache :)')\")" 0 ; redis-cli info memory | grep "script"
      "1be72729d43da5114929c1260a749073732dc822"
      used_memory_scripts:232
      used_memory_scripts_human:232B
      number_of_cached_scripts:2
       19:03:54 redis [lua_scripts-in-info-memory L ✚…⚑] $ redis-cli evalsha 1be72729d43da5114929c1260a749073732dc822 0
      "Hello, Script Cache :)"
      ```
      49890c8e
  22. 06 Dec, 2017 1 commit
    • antirez's avatar
      Change indentation and other minor details of PR #4489. · 522760fa
      antirez authored
      The main change introduced by this commit is pretending that help
      arrays are more text than code, thus indenting them at level 0. This
      improves readability, and is an old practice when defining arrays of
      C strings describing text.
      
      Additionally a few useless return statements are removed, and the HELP
      subcommand capitalized when printed to the user.
      522760fa
  23. 04 Dec, 2017 3 commits
    • antirez's avatar
      Refactoring: improve luaCreateFunction() API. · 60d26acf
      antirez authored
      The function in its initial form, and after the fixes for the PSYNC2
      bugs, required code duplication in multiple spots. This commit modifies
      it in order to always compute the script name independently, and to
      return the SDS of the SHA of the body: this way it can be used in all
      the places, including for SCRIPT LOAD, without duplicating the code to
      create the Lua function name. Note that this requires to re-compute the
      body SHA1 in the case of EVAL seeing a script for the first time, but
      this should not change scripting performance in any way because new
      scripts definition is a rare event happening the first time a script is
      seen, and the SHA1 computation is anyway not a very slow process against
      the typical Redis script and compared to the actua Lua byte compiling of
      the body.
      
      Note that the function used to assert() if a duplicated script was
      loaded, however actually now two times over three, we want the function
      to handle duplicated scripts just fine: this happens in SCRIPT LOAD and
      in RDB AUX "lua" loading. Moreover the assert was not defending against
      some obvious failure mode, so now the function always tests against
      already defined functions at start.
      60d26acf
    • antirez's avatar
      Remove useless variable check from luaCreateFunction(). · c6eca690
      antirez authored
      The block is already inside if (allow_dup).
      c6eca690
    • antirez's avatar
      Fix issue #4505, Lua RDB AUX field loading of existing scripts. · 68681f2b
      antirez authored
      Unfortunately, as outlined by @soloestoy in #4505, "lua" AUX RDB field
      loading in case of duplicated script was still broken. This commit fixes
      this problem and also a memory leak introduced by the past commit.
      
      Note that now we have a regression test able to duplicate the issue, so
      this commit was actually tested against the regression. The original PR
      also had a valid fix, but I prefer to hide the details of scripting.c
      outside scripting.c, and later "SCRIPT LOAD" should also be able to use
      the function luaCreateFunction() instead of redoing the work.
      68681f2b
  24. 01 Dec, 2017 1 commit