走读 Redis 代码的时候,发现有一处代码注释的序号不连续,又起了好奇心。翻了翻源码,在 commit <3fd43062c8127857f98c09a06bf70710b2dc2f681>,这处改动是调整 gossip sections 的大小。

        /* Don't include this node: the whole packet header is about us
             * already, so we just gossip about other nodes. */
            if (this == myself) continue;
    
        /* In the gossip section don't include:
         * 1) Nodes in HANDSHAKE state.
         * 3) Nodes with the NOADDR flag set.
         * 4) Disconnected nodes if they don't have configured slots.
         */
    

    git message 摘录如下:

    Cluster: use a number of gossip sections proportional to cluster size.

    Otherwise it is impossible to receive the majority of failure reports in the node_timeout*2 window in larger clusters.

    Still with a 200 nodes cluster, 20 gossip sections are a very reasonable amount of bytes to send.

    A side effect of this change is also fater cluster nodes joins for large clusters, because the cluster layout makes less time to propagate.


    Related Posts


    Published

    Category

    redis

    Tags

    Contact