Skip to content

Commit

Permalink
Updated comments on dictResizeEnable for new dict shrink (redis#12946)
Browse files Browse the repository at this point in the history
The new shrink was added in redis#12850.
Also updated outdated comments, see redis#11692.
  • Loading branch information
enjoy-binbin authored and roggervalf committed Feb 11, 2024
1 parent 1f5115e commit b6b0884
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@
#include "redisassert.h"
#include "monotonic.h"

/* Using dictEnableResize() / dictDisableResize() we make possible to disable
/* Using dictSetResizeEnabled() we make possible to disable
* resizing and rehashing of the hash table as needed. This is very important
* for Redis, as we use copy-on-write and don't want to move too much memory
* around when there is a child performing saving operations.
*
* Note that even when dict_can_resize is set to DICT_RESIZE_AVOID, not all
* resizes are prevented: a hash table is still allowed to grow if the ratio
* between the number of elements and the buckets > dict_force_resize_ratio. */
* resizes are prevented:
* - A hash table is still allowed to expand if the ratio between the number
* of elements and the buckets > dict_force_resize_ratio.
* - A hash table is still allowed to shrink if the ratio between the number
* of elements and the buckets < HASHTABLE_MIN_FILL / dict_force_resize_ratio. */
static dictResizeEnable dict_can_resize = DICT_RESIZE_ENABLE;
static unsigned int dict_force_resize_ratio = 5;

Expand Down

0 comments on commit b6b0884

Please sign in to comment.