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

Method MakeCheckPoint

phxbinlogsvr/core/storage/checkpoint_manager.cpp:130–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130int CheckPointManager::MakeCheckPoint(const vector<string> &gtidlist) {
131 StatusRunningHandler handler(this);
132 int ret = handler.TestAndSet(RUNNINGSTATUS::NONE, RUNNINGSTATUS::RUNNING);
133 if (ret) {
134 ColorLogInfo("%s something is running, skip", __func__);
135 return SVR_FAIL;
136 }
137
138 uint32_t nowtime = time(NULL);
139 if (nowtime - last_checkpoint_time > option_->GetBinLogSvrConfig()->GetCheckPointMakingPeriod()
140 || nowtime - last_checkpoint_time > 60) {
141 if (last_checkpoint_time > 0)
142 ret = RealMakeCheckPoint(gtidlist);
143 if (ret == OK) {
144 last_checkpoint_time = nowtime;
145 }
146 } else {
147 ColorLogInfo("%s now time %u last check time %u, interval time %u", __func__, nowtime, last_checkpoint_time,
148 option_->GetBinLogSvrConfig()->GetCheckPointMakingPeriod());
149 }
150
151 ColorLogInfo("%s check point check done", __func__);
152 return OK;
153}
154
155int CheckPointManager::GetNewestCheckPoint(EventData *eventdata, MasterInfo *masterinfo, EventDataInfo *eventdatainfo) {
156 StatusRunningHandler handler(this);

Callers

nothing calls this directly

Calls 4

ColorLogInfoFunction · 0.85
GetBinLogSvrConfigMethod · 0.80
TestAndSetMethod · 0.45

Tested by

no test coverage detected