• debing.sun's avatar
    Fix the failure of defrag test under 32-bit (#13013) · 676f27ac
    debing.sun authored
    Fail CI:
    https://github.com/redis/redis/actions/runs/7837608438/job/21387609715
    
    
    
    ## Why defragment tests only failed under 32-bit
    
    First of all, under 32-bit jemalloc will allocate more small bins and
    less large bins, which will also lead to more external fragmentation,
    therefore, the fragmentation ratio is higher in 32-bit than in 64-bit,
    so the defragment tests(`Active defrag eval scripts: cluster` and
    `Active defrag big keys: cluster`) always fails in 32-bit.
    
    ## Why defragment tests only failed with cluster
    The fowllowing is the result of `Active defrag eval scripts: cluster`
    test.
    
    1) Before #11695, the fragmentation ratio is 3.11%.
    
    2) After #11695, the fragmentation ratio grew to 4.58%.
    Since we are using per-slot dictionary to manage slots, we will only
    defragment the contents of these dictionaries (keys, values), but not
    the dictionaries' struct and ht_table, which means that frequent
    shrinking and expanding of the dictionaries, will make more fragments.
    
    3) After #12850 and #12948, In cluster mode, a large number of cluster
    slot dicts will be shrunk, creating additional fragmention, and the
    dictionary will not be defragged.
    
    ## Solution
    * Add defragmentation of the per-slot dictionary's own structures, dict
    struct and ht_table.
    
    ## Other change
    * Increase floating point print precision of `frags` and `rss` in debug
    logs for defrag
    
    ---------
    Co-authored-by: default avatarOran Agra <oran@redislabs.com>
    676f27ac
kvstore.c 28.2 KB