| 1505 | |
| 1506 | |
| 1507 | void StorageLocalResourceProviderProcess::acknowledgeOperationStatus( |
| 1508 | const Event::AcknowledgeOperationStatus& acknowledge) |
| 1509 | { |
| 1510 | CHECK_EQ(READY, state); |
| 1511 | |
| 1512 | Try<id::UUID> operationUuid = |
| 1513 | id::UUID::fromBytes(acknowledge.operation_uuid().value()); |
| 1514 | |
| 1515 | CHECK_SOME(operationUuid); |
| 1516 | |
| 1517 | Try<id::UUID> statusUuid = |
| 1518 | id::UUID::fromBytes(acknowledge.status_uuid().value()); |
| 1519 | |
| 1520 | CHECK_SOME(statusUuid); |
| 1521 | |
| 1522 | auto err = [](const id::UUID& uuid, const string& message) { |
| 1523 | LOG(ERROR) |
| 1524 | << "Failed to acknowledge status update for operation (uuid: " << uuid |
| 1525 | << "): " << message; |
| 1526 | }; |
| 1527 | |
| 1528 | // NOTE: It is possible that an incoming acknowledgement races with an |
| 1529 | // outgoing retry of status update, and then a duplicated |
| 1530 | // acknowledgement will be received. In this case, the following call |
| 1531 | // will fail, so we just leave an error log. |
| 1532 | statusUpdateManager.acknowledgement(operationUuid.get(), statusUuid.get()) |
| 1533 | .then(defer(self(), [=](bool continuation) { |
| 1534 | if (!continuation) { |
| 1535 | operations.erase(operationUuid.get()); |
| 1536 | checkpointResourceProviderState(); |
| 1537 | garbageCollectOperationPath(operationUuid.get()); |
| 1538 | } |
| 1539 | |
| 1540 | return Nothing(); |
| 1541 | })) |
| 1542 | .onFailed(std::bind(err, operationUuid.get(), lambda::_1)) |
| 1543 | .onDiscarded(std::bind(err, operationUuid.get(), "future discarded")); |
| 1544 | } |
| 1545 | |
| 1546 | |
| 1547 | void StorageLocalResourceProviderProcess::reconcileOperations( |