1. 11 Aug, 2020 1 commit
  2. 07 May, 2020 1 commit
  3. 05 May, 2020 1 commit
  4. 04 May, 2020 1 commit
  5. 28 Mar, 2020 1 commit
  6. 06 Feb, 2020 1 commit
    • Oran Agra's avatar
      RM_Scan disable dict rehashing · 28ef18a8
      Oran Agra authored
      The callback approach we took is very efficient, the module can do any
      filtering of keys without building any list and cloning strings, it can
      also read data from the key's value. but if the user tries to re-open
      the key, or any other key, this can cause dict re-hashing (dictFind does
      that), and that's very bad to do from inside dictScan.
      
      this commit protects the dict from doing any rehashing during scan, but
      also warns the user not to attempt any writes or command calls from
      within the callback, for fear of unexpected side effects and crashes.
      28ef18a8
  7. 19 Feb, 2019 1 commit
  8. 18 Feb, 2019 2 commits
  9. 17 Jul, 2018 1 commit
  10. 16 Jul, 2018 2 commits
  11. 03 Jul, 2018 1 commit
  12. 08 May, 2018 1 commit
  13. 29 Mar, 2018 1 commit
  14. 05 Dec, 2017 2 commits
  15. 20 Feb, 2017 2 commits
    • antirez's avatar
      84fa8230
    • antirez's avatar
      Use SipHash hash function to mitigate HashDos attempts. · adeed29a
      antirez authored
      This change attempts to switch to an hash function which mitigates
      the effects of the HashDoS attack (denial of service attack trying
      to force data structures to worst case behavior) while at the same time
      providing Redis with an hash function that does not expect the input
      data to be word aligned, a condition no longer true now that sds.c
      strings have a varialbe length header.
      
      Note that it is possible sometimes that even using an hash function
      for which collisions cannot be generated without knowing the seed,
      special implementation details or the exposure of the seed in an
      indirect way (for example the ability to add elements to a Set and
      check the return in which Redis returns them with SMEMBERS) may
      make the attacker's life simpler in the process of trying to guess
      the correct seed, however the next step would be to switch to a
      log(N) data structure when too many items in a single bucket are
      detected: this seems like an overkill in the case of Redis.
      
      SPEED REGRESION TESTS:
      
      In order to verify that switching from MurmurHash to SipHash had
      no impact on speed, a set of benchmarks involving fast insertion
      of 5 million of keys were performed.
      
      The result shows Redis with SipHash in high pipelining conditions
      to be about 4% slower compared to using the previous hash function.
      However this could partially be related to the fact that the current
      implementation does not attempt to hash whole words at a time but
      reads single bytes, in order to have an output which is endian-netural
      and at the same time working on systems where unaligned memory accesses
      are a problem.
      
      Further X86 specific optimizations should be tested, the function
      may easily get at the same level of MurMurHash2 if a few optimizations
      are performed.
      adeed29a
  16. 02 Jan, 2017 1 commit
  17. 30 Dec, 2016 1 commit
  18. 20 Sep, 2016 1 commit
    • antirez's avatar
      dict.c: fix dictGenericDelete() return ASAP condition. · 67058671
      antirez authored
      Recently we moved the "return ASAP" condition for the Delete() function
      from checking .size to checking .used, which is smarter, however while
      testing the first table alone always works to ensure the dict is totally
      emtpy, when we test the .size field, testing .used requires testing both
      T0 and T1, since a rehashing could be in progress.
      67058671
  19. 14 Sep, 2016 3 commits
    • antirez's avatar
      dict.c: dictReplaceRaw() -> dictAddOrFind(). · 09a50d34
      antirez authored
      What they say about "naming things" in programming?
      09a50d34
    • antirez's avatar
      Apply the new dictUnlink() where possible. · a636aeac
      antirez authored
      Optimizations suggested and originally implemented by @oranagra.
      Re-applied by @antirez using the modified API.
      a636aeac
    • oranagra's avatar
      dict.c: introduce dictUnlink(). · afcbcc0e
      oranagra authored
      Notes by @antirez:
      
      This patch was picked from a larger commit by Oran and adapted to change
      the API a bit. The basic idea is to avoid double lookups when there is
      to use the value of the deleted entry.
      
      BEFORE:
      
          entry = dictFind( ... ); /* 1st lookup. */
          /* Do somethjing with the entry. */
          dictDelete(...);         /* 2nd lookup. */
      
      AFTER:
      
          entry = dictUnlink( ... ); /* 1st lookup. */
          /* Do somethjing with the entry. */
          dictFreeUnlinkedEntry(entry); /* No lookups!. */
      afcbcc0e
  20. 12 Sep, 2016 1 commit
  21. 07 Sep, 2016 6 commits
  22. 25 Apr, 2016 1 commit
  23. 01 Oct, 2015 1 commit
  24. 23 Aug, 2015 1 commit
  25. 14 Jul, 2015 1 commit
    • antirez's avatar
      DEBUG HTSTATS <dbid> added. · 0f64080d
      antirez authored
      The command reports information about the hash table internal state
      representing the specified database ID.
      
      This can be used in order to investigate rehashings, memory usage issues
      and for other debugging purposes.
      0f64080d
  26. 27 Mar, 2015 2 commits
  27. 11 Feb, 2015 2 commits
    • antirez's avatar
      SPOP: reimplemented for speed and better distribution. · 9feee428
      antirez authored
      The old version of SPOP with "count" argument used an API call of dict.c
      which was actually designed for a different goal, and was not capable of
      good distribution. We follow a different three-cases approach optimized
      for different ratiion between sets and requested number of elements.
      
      The implementation is simpler and allowed the removal of a large amount
      of code.
      9feee428
    • antirez's avatar
      dict.c: reset emptylen when bucket is not empty. · 8ddc1452
      antirez authored
      Fixed by @oranagra, thank you.
      8ddc1452