MCPcopy Create free account
hub / github.com/Tencent/phxqueue / ReadCheckpoint

Method ReadCheckpoint

phxqueue/lock/lockmgr.cpp:177–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177comm::RetCode LockMgr::ReadCheckpoint(const GroupVector::size_type paxos_group_id,
178 uint64_t &checkpoint) {
179 comm::LockMgrBP::GetThreadInstance()->
180 OnReadCheckpoint(impl_->lock->GetTopicID(), paxos_group_id);
181
182 string vstr;
183 comm::RetCode ret{leveldb(paxos_group_id).Get(KEY_IGNORE_CHECKPOINT, vstr)};
184
185 if (comm::RetCode::RET_ERR_KEY_NOT_EXIST == ret) {
186 checkpoint = phxpaxos::NoCheckpoint;
187 QLErr("topic_id %d paxos_group_id %d not exist",
188 impl_->lock->GetTopicID(), paxos_group_id);
189 } else if (comm::RetCode::RET_OK == ret) {
190 checkpoint = strtoul(vstr.c_str(), nullptr, 10);
191 QLInfo("topic_id %d paxos_group_id %d cp %llu ok",
192 impl_->lock->GetTopicID(), paxos_group_id, checkpoint);
193 } else {
194 checkpoint = phxpaxos::NoCheckpoint;
195 QLErr("topic_id %d paxos_group_id %d err %d",
196 impl_->lock->GetTopicID(), paxos_group_id, ret);
197 }
198
199 impl_->groups[paxos_group_id].set_checkpoint(checkpoint);
200
201 return ret;
202}
203
204comm::RetCode LockMgr::WriteCheckpoint(const GroupVector::size_type paxos_group_id,
205 const uint64_t checkpoint) {

Callers

nothing calls this directly

Calls 4

OnReadCheckpointMethod · 0.80
set_checkpointMethod · 0.80
GetTopicIDMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected