MCPcopy Create free account
hub / github.com/Tencent/phxsql / Process

Method Process

phxbinlogsvr/core/repl/replication_slave.cpp:58–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int ReplicationSlave::Process() {
59 //stop monitor to check connection
60
61 SlaveMonitor::SlaveConnecting(true);
62 status_ = CommandStatus::MSG;
63 int ret = OK;
64 while (1) {
65 ret = ProcessWithMasterMsg();
66 if (ret) {
67 ColorLogError("%s process master msg fail ret %d", __func__, ret);
68 break;
69 }
70
71 if (status_ == CommandStatus::RUNNING) {
72 //all things is done
73 int ret = CheckIsMaster();
74 if (ret == NOT_MASTER) {
75 STATISTICS(ReplSlaveLogin());
76 ColorLogInfo("%s it is not master, do with slave", __func__);
77 ret = OK;
78 } else if (ret != OK) {
79 ColorLogInfo("%s check master fail", __func__);
80 } else if (ret == OK) {
81 STATISTICS(ReplMasterLogin());
82 }
83 SlaveInitDone();
84 ColorLogInfo("check master ret %d", ret);
85 break;
86 }
87
88 ret = ProcessWithSlaveMsg();
89
90 if (ret) {
91 ColorLogError("%s process slave msg fail ret %d", __func__, ret);
92 break;
93 }
94
95 }
96 if (ret == 0) {
97 STATISTICS(ReplLoginSucess());
98 } else {
99 STATISTICS(ReplLoginFail());
100 }
101 ColorLogInfo("%s slave exit, ret %d", __func__, ret);
102 SlaveMonitor::SlaveConnecting(false);
103 return ret;
104}
105
106int ReplicationSlave::ProcessWithSlaveMsg() {
107 string recv_buff;

Callers

nothing calls this directly

Calls 2

ColorLogErrorFunction · 0.85
ColorLogInfoFunction · 0.85

Tested by

no test coverage detected