IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    DeathVoteExpirationTimeout in Orleans

    金庆发表于 2021-12-08 01:43:00
    love 0
    DeathVoteExpirationTimeout in Orleans

    (Jin Qing's Column, Dec., 2021)

    Try to find out why Orleans need a DeathVoteExpirationTimeout config.

    https://dotnet.github.io/orleans/docs/implementation/cluster_management.html#extension-to-totally-order-membership-views

    DeathVoteExpirationTimeout - Expiration time in seconds for death vote in the membership table. Default is 120 seconds
    
    GetFreshVotes

    DeathVoteExpirationTimeout is only used by GetFreshVotes(), which has 3 occurence:

        class ClusterHealthMonitor
        {
            ...
            private UpdateMonitoredSilos(...)
            {
                ...
                bool isSuspected = candidateEntry.GetFreshVotes(now, DeathVoteExpirationTimeout).Count > 0;
                ...
            }
        }
    
        class LocalSiloHealthMonitor
        {
            ...
            private int CheckSuspectingNodes(DateTime now, List<string> complaints)
            {
                ...
                var freshVotes = membershipEntry.GetFreshVotes(now, DeathVoteExpirationTimeout);
                ...
            }
            ...
        }
    
        class MembershipTableManager
        {
            ...
            public TryToSuspectOrKill(SiloAddress silo)
            {
                ...
                // get all valid (non-expired) votes
                var freshVotes = entry.GetFreshVotes(DateTime.UtcNow, DeathVoteExpirationTimeout);
                ...
            }
            ...
        }
    

    GetFreshVotes() uses this expiration time to ignore old voter:

            internal GetFreshVotes(DateTime now, TimeSpan expiration)
            {
                ...
                foreach (var voter in this.SuspectTimes)
                {
                    var otherVoterTime = voter.Item2;
                    if (now.Subtract(otherVoterTime) < expiration)
                    {
                        result.Add(voter);
                    }
                }
                return result.ToImmutable();
            }
    


    金庆 2021-12-08 09:43 发表评论


沪ICP备19023445号-2号
友情链接