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

Method Process

phxbinlogsvr/core/repl/replication_impl.cpp:61–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61int ReplicationImpl::Process() {
62 if(ctx_->GetSlaveFD()<0){
63 ColorLogInfo("%s slave fd %d close", __func__, ctx_->GetSlaveFD());
64 return SOCKET_FAIL;
65 }
66
67 int master_fd = InitFakeMaster();
68 if (master_fd < 0) {
69 return SOCKET_FAIL;
70 }
71
72 ColorLogInfo("%p process master fd %d, slave fd %d", this, master_fd, ctx_->GetSlaveFD());
73
74 ctx_->SetMasterFD(master_fd);
75
76 ReplicationSlave *slave = new ReplicationSlave(ctx_);
77 ReplicationTransfer *transfer = new ReplicationTransfer(ctx_);
78
79 slave->Run();
80 transfer->Run();
81
82 slave->WaitStop();
83 transfer->WaitStop();
84
85 delete slave;
86 delete transfer;
87
88 return OK;
89}
90
91int ReplicationImpl::InitFakeMaster() {
92 MasterInfo info;

Callers 2

SlaveManagerMethod · 0.45
ThreadProcessMethod · 0.45

Calls 5

ColorLogInfoFunction · 0.85
GetSlaveFDMethod · 0.80
SetMasterFDMethod · 0.80
RunMethod · 0.45
WaitStopMethod · 0.45

Tested by

no test coverage detected