| 89 | } |
| 90 | |
| 91 | int ReplicationImpl::InitFakeMaster() { |
| 92 | MasterInfo info; |
| 93 | int ret = master_manager_->GetMasterInfo(&info); |
| 94 | if (ret) { |
| 95 | ColorLogError("%s get master info fail, ret %d", __func__, ret); |
| 96 | return ret; |
| 97 | } |
| 98 | |
| 99 | string ip = Utils::GetIP(info.svr_id()); |
| 100 | if (info.svr_id() == option_->GetBinLogSvrConfig()->GetEngineSvrID()) { |
| 101 | LogVerbose("%s get other ip %s", __func__, ip.c_str()); |
| 102 | } else { |
| 103 | ctx_->SelfConn(false); |
| 104 | } |
| 105 | |
| 106 | MySqlManager* mysql_manager = MySqlManager::GetGlobalMySqlManager(option_); |
| 107 | if (mysql_manager->IsReplicaProcess()) { |
| 108 | ip = Utils::GetIP(option_->GetBinLogSvrConfig()->GetEngineSvrID()); |
| 109 | ctx_->SelfConn(true); |
| 110 | } |
| 111 | |
| 112 | LogVerbose("%s connect ip %s port %d", __func__, ip.c_str(), info.port()); |
| 113 | |
| 114 | int master_fd = NetIO::Connect(ip.c_str(), info.port()); |
| 115 | if (master_fd < 0) { |
| 116 | STATISTICS(ReplMySqlConnectFail()); |
| 117 | return SOCKET_FAIL; |
| 118 | } |
| 119 | return master_fd; |
| 120 | } |
| 121 | |
| 122 | } |
| 123 |
nothing calls this directly
no test coverage detected