| 345 | } |
| 346 | |
| 347 | void Learner :: OnSendNowInstanceID(const PaxosMsg & oPaxosMsg) |
| 348 | { |
| 349 | BP->GetLearnerBP()->OnSendNowInstanceID(); |
| 350 | |
| 351 | PLGHead("START Msg.InstanceID %lu Now.InstanceID %lu Msg.from_nodeid %lu Msg.MaxInstanceID %lu systemvariables_size %zu mastervariables_size %zu", |
| 352 | oPaxosMsg.instanceid(), GetInstanceID(), oPaxosMsg.nodeid(), oPaxosMsg.nowinstanceid(), |
| 353 | oPaxosMsg.systemvariables().size(), oPaxosMsg.mastervariables().size()); |
| 354 | |
| 355 | SetSeenInstanceID(oPaxosMsg.nowinstanceid(), oPaxosMsg.nodeid()); |
| 356 | |
| 357 | bool bSystemVariablesChange = false; |
| 358 | int ret = m_poConfig->GetSystemVSM()->UpdateByCheckpoint(oPaxosMsg.systemvariables(), bSystemVariablesChange); |
| 359 | if (ret == 0 && bSystemVariablesChange) |
| 360 | { |
| 361 | PLGHead("SystemVariables changed!, all thing need to reflesh, so skip this msg"); |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | bool bMasterVariablesChange = false; |
| 366 | if (m_poConfig->GetMasterSM() != nullptr) |
| 367 | { |
| 368 | ret = m_poConfig->GetMasterSM()->UpdateByCheckpoint(oPaxosMsg.mastervariables(), bMasterVariablesChange); |
| 369 | if (ret == 0 && bMasterVariablesChange) |
| 370 | { |
| 371 | PLGHead("MasterVariables changed!"); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | if (oPaxosMsg.instanceid() != GetInstanceID()) |
| 376 | { |
| 377 | PLGErr("Lag msg, skip"); |
| 378 | return; |
| 379 | } |
| 380 | |
| 381 | if (oPaxosMsg.nowinstanceid() <= GetInstanceID()) |
| 382 | { |
| 383 | PLGErr("Lag msg, skip"); |
| 384 | return; |
| 385 | } |
| 386 | |
| 387 | if (oPaxosMsg.minchoseninstanceid() > GetInstanceID()) |
| 388 | { |
| 389 | BP->GetCheckpointBP()->NeedAskforCheckpoint(); |
| 390 | |
| 391 | PLGHead("my instanceid %lu small than other's minchoseninstanceid %lu, other nodeid %lu", |
| 392 | GetInstanceID(), oPaxosMsg.minchoseninstanceid(), oPaxosMsg.nodeid()); |
| 393 | |
| 394 | AskforCheckpoint(oPaxosMsg.nodeid()); |
| 395 | } |
| 396 | else if (!m_bIsIMLearning) |
| 397 | { |
| 398 | ComfirmAskForLearn(oPaxosMsg.nodeid()); |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | //////////////////////////////////////////// |
| 403 |
nothing calls this directly
no test coverage detected