• guybe7's avatar
    Refactor the per-slot dict-array db.c into a new kvstore data structure (#12822) · 8cd62f82
    guybe7 authored
    # Description
    Gather most of the scattered `redisDb`-related code from the per-slot
    dict PR (#11695) and turn it to a new data structure, `kvstore`. i.e.
    it's a class that represents an array of dictionaries.
    
    # Motivation
    The main motivation is code cleanliness, the idea of using an array of
    dictionaries is very well-suited to becoming a self-contained data
    structure.
    This allowed cleaning some ugly code, among others: loops that run twice
    on the main dict and expires dict, and duplicate code for allocating and
    releasing this data structure.
    
    # Notes
    1. This PR reverts the part of https://github.com/redis/redis/pull/12848
    where the `rehashing` list is global (handling rehashing `dict`s is
    under the responsibility of `kvstore`, and should not be managed by the
    server)
    2. This PR also replaces the type of `server.pubsubshard_channels` from
    `dict**` to `kvstore` (original PR:
    https://github.com/redis/redis/p...
    8cd62f82
cluster.c 56.6 KB