MCPcopy Create free account
hub / github.com/Tencent/phxpaxos / InitLastCheckSum

Method InitLastCheckSum

src/algorithm/instance.cpp:203–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203int Instance :: InitLastCheckSum()
204{
205 if (m_oAcceptor.GetInstanceID() == 0)
206 {
207 m_iLastChecksum = 0;
208 return 0;
209 }
210
211 if (m_oAcceptor.GetInstanceID() <= m_oCheckpointMgr.GetMinChosenInstanceID())
212 {
213 m_iLastChecksum = 0;
214 return 0;
215 }
216
217 AcceptorStateData oState;
218 int ret = m_oPaxosLog.ReadState(m_poConfig->GetMyGroupIdx(), m_oAcceptor.GetInstanceID() - 1, oState);
219 if (ret != 0 && ret != 1)
220 {
221 return ret;
222 }
223
224 if (ret == 1)
225 {
226 PLGErr("las checksum not exist, now instanceid %lu", m_oAcceptor.GetInstanceID());
227 m_iLastChecksum = 0;
228 return 0;
229 }
230
231 m_iLastChecksum = oState.checksum();
232
233 PLGImp("ok, last checksum %u", m_iLastChecksum);
234
235 return 0;
236}
237
238int Instance :: PlayLog(const uint64_t llBeginInstanceID, const uint64_t llEndInstanceID)
239{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected