{"action":"created","issue":{"url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/86","repository_url":"https://api.github.com/repos/tencent-wechat/phxsql","labels_url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/86/comments","events_url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/86/events","html_url":"https://github.com/tencent-wechat/phxsql/issues/86","id":189925978,"number":86,"title":"Phxbinlogsvr Bug：集群无法正常初始化，出现问题后也无法从过期状态恢复","user":{"login":"zqdai","id":22090539,"avatar_url":"https://avatars.githubusercontent.com/u/22090539?v=3","gravatar_id":"","url":"https://api.github.com/users/zqdai","html_url":"https://github.com/zqdai","followers_url":"https://api.github.com/users/zqdai/followers","following_url":"https://api.github.com/users/zqdai/following{/other_user}","gists_url":"https://api.github.com/users/zqdai/gists{/gist_id}","starred_url":"https://api.github.com/users/zqdai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zqdai/subscriptions","organizations_url":"https://api.github.com/users/zqdai/orgs","repos_url":"https://api.github.com/users/zqdai/repos","events_url":"https://api.github.com/users/zqdai/events{/privacy}","received_events_url":"https://api.github.com/users/zqdai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-11-17T03:29:00Z","updated_at":"2016-12-05T06:55:44Z","closed_at":null,"body":"可能有1～2个较为严重的逻辑漏洞（可能是同一个问题）：\r\n1、第一个集群不能正常初始化，不能稳定重现。\r\n2、重现后会发现整个集群会处于错误的状态，目前我重现之后，集群出现了master过期，然而却不能选举新master的情况。debug后发现系统出在以下状态：\r\n\r\nmaster节点（初始化时指定）\r\n--\r\n 在AgentMonitor中， 可以看到status = RUNNING，此时master此时已经处在过期状态，照理来说应该触发CheckMasterTimeOut()，但实际上，由于master处在过期状态时，check_master始终为false，原因是CheckRuning()中的这段逻辑：\r\n bool is_master = master_manager_->CheckMasterBySvrID(option_->GetBinLogSvrConfig()->GetEngineSvrID());\r\nCheckMasterBySvrID()有一个默认的第二参数，导致该检查返回false。\r\n\r\n这样一来，master永远不知道自己是master，也无法执行 CheckMasterTimeOut()。\r\n\r\nslave节点\r\n--\r\nSlave节点处于status=MASTER_CHANGING状态。而且由于自己不是master，check_master同样为false。也不能执行CheckMasterTimeOut()。\r\n\r\n因此，初始化时若系统处于过期状态时，系统将不能从这个状态中恢复。\r\n\r\np.s. paxos库中已经有了选主的逻辑（MasterDamon中），不明白为什么phxbinlogsvr还要自己实现一个？"},"comment":{"url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/comments/264780614","html_url":"https://github.com/tencent-wechat/phxsql/issues/86#issuecomment-264780614","issue_url":"https://api.github.com/repos/tencent-wechat/phxsql/issues/86","id":264780614,"user":{"login":"zqdai","id":22090539,"avatar_url":"https://avatars.githubusercontent.com/u/22090539?v=3","gravatar_id":"","url":"https://api.github.com/users/zqdai","html_url":"https://github.com/zqdai","followers_url":"https://api.github.com/users/zqdai/followers","following_url":"https://api.github.com/users/zqdai/following{/other_user}","gists_url":"https://api.github.com/users/zqdai/gists{/gist_id}","starred_url":"https://api.github.com/users/zqdai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zqdai/subscriptions","organizations_url":"https://api.github.com/users/zqdai/orgs","repos_url":"https://api.github.com/users/zqdai/repos","events_url":"https://api.github.com/users/zqdai/events{/privacy}","received_events_url":"https://api.github.com/users/zqdai/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T06:55:44Z","updated_at":"2016-12-05T06:55:44Z","body":"经过debug，mysql是没有问题的，当前所知的情况：\r\n1、mysql在执行语句后要发送binlog，但binlogsvr没有回复，mysql卡死在recv系统调用上\r\n2、binlogsvr发送paxos event，卡死在：phxpaxos::CommitCtx::GetResult，代码如下。该代码在等待另一个线程把m_bIsCommitEnd设为true。\r\n\r\nint CommitCtx :: GetResult(uint64_t & llSuccInstanceID)\r\n{\r\n while (!m_bIsCommitEnd)。{  \r\nm_oSerialLock.WaitTime(1000); \r\n}\r\n...\r\n}\r\n\r\n综上，问题出现在新paxos库中的可能性比较大。\r\n"}}
{"actor":{"display_login":"zqdai"}}