MCPcopy Create free account
hub / github.com/apache/mesos / received

Method received

src/log/consensus.cpp:355–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353 }
354
355 void received(const PromiseResponse& response)
356 {
357 if (response.has_type() && response.type() ==
358 PromiseResponse::IGNORED) {
359 ignoresReceived++;
360
361 // A quorum of replicas have ignored the request.
362 if (ignoresReceived >= quorum) {
363 LOG(INFO) << "Aborting implicit promise request because "
364 << ignoresReceived << " ignores received";
365
366 // If the "type" is PromiseResponse::IGNORED, the rest of the
367 // fields don't matter.
368 PromiseResponse result;
369 result.set_type(PromiseResponse::IGNORED);
370
371 promise.set(result);
372 terminate(self());
373 }
374
375 return;
376 }
377
378 responsesReceived++;
379
380 if (isRejectedPromise(response)) {
381 // Failed to get the promise from a replica because it has
382 // promised a proposer with a higher proposal number. The
383 // 'proposal' field in the response specifies the proposal
384 // number. It is found to be larger than the proposal number
385 // used in this phase.
386 if (highestNackProposal.isNone() ||
387 highestNackProposal.get() < response.proposal()) {
388 highestNackProposal = response.proposal();
389 }
390 } else if (highestNackProposal.isSome()) {
391 // We still want to wait for more potential NACK responses so we
392 // can return the highest proposal number seen but we don't care
393 // about any more ACK responses.
394 } else {
395 CHECK(response.has_position());
396 if (highestEndPosition.isNone() ||
397 highestEndPosition.get() < response.position()) {
398 highestEndPosition = response.position();
399 }
400 }
401
402 if (responsesReceived >= quorum) {
403 // A quorum of replicas have replied.
404 PromiseResponse result;
405
406 if (highestNackProposal.isSome()) {
407 result.set_type(PromiseResponse::REJECT);
408 result.set_okay(false);
409 result.set_proposal(highestNackProposal.get());
410 } else {
411 CHECK_SOME(highestEndPosition);
412

Callers

nothing calls this directly

Calls 8

isRejectedPromiseFunction · 0.85
typeMethod · 0.80
terminateFunction · 0.50
setMethod · 0.45
isNoneMethod · 0.45
getMethod · 0.45
isSomeMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected