• sundb's avatar
    RAND* commands: fix risk of OOM panic in hash and zset, use fair random in... · 18ac4197
    sundb authored
    
    RAND* commands: fix risk of OOM panic in hash and zset, use fair random in hash, and add tests for even distribution to all (#8429)
    
    Changes to HRANDFIELD and ZRANDMEMBER:
    * Fix risk of OOM panic when client query a very big negative count (avoid allocating huge temporary buffer).
    * Fix uneven random distribution in HRANDFIELD with negative count (wasn't using dictGetFairRandomKey).
    * Add tests to check an even random distribution (HRANDFIELD, SRANDMEMBER, ZRANDMEMBER).
    Co-authored-by: default avatarOran Agra <oran@redislabs.com>
    18ac4197
ziplist.c 88.8 KB