• Binbin's avatar
    Fix dict resize ratio checks, avoid precision loss from integer division (#12952) · 14b1edfd
    Binbin authored
    In the past we used integers to compare ratios, let us assume that
    we have the following data in expanding:
    ```
    used / size > 5
    `80 / 16 > 5` is false
    `81 / 16 > 5` is false
    `95 / 16 > 5` is false
    `96 / 16 > 5` is true
    ```
    
    Because the integer result is rounded, our resize breaks the ratio
    constraint, this has existed since the beginning, which resulted in
    us not strictly following the ratio (shrink also has the same issue).
    
    This PR change it to multiplication to avoid floating point
    calculations.
    14b1edfd
server.c 290 KB