//Recovery public async Task <Task> CompleteOneOperatorRecovery(BarrierOrCommitMsgTrackingInfo msgInfo) { if (!recoveryTrackingMap.ContainsKey(msgInfo.BatchID)) { //Multiple batch has that problem PrettyConsole.Line("The recovery key " + msgInfo.BatchID + " is not exist"); } else { //PrettyConsole.Line("Finish Tracking one message in batchID: " + msgInfo.BatchID); StreamBatch targetBatch = recoveryTrackingMap[msgInfo.BatchID]; targetBatch.CompleteOneMessageTracking(msgInfo); if (targetBatch.readForCommitting) { if (batchCoordinator != null) { PrettyConsole.Line("Batch: " + msgInfo.BatchID + " commit has been successfully recoveryed"); await batchCoordinator.CompleteRecovery(msgInfo.BatchID); recoveryTrackingMap.Remove(msgInfo.BatchID); } } } return(Task.CompletedTask); }
//Should find the target task in the currentBatch public Task CompleteOneOperatorBarrier(BarrierOrCommitMsgTrackingInfo msgInfo) { if (!batchTrackingMap.ContainsKey(msgInfo.BatchID)) { PrettyConsole.Line("Complete Barrier, but The key " + msgInfo.BatchID + " is not exist"); } else { //PrettyConsole.Line("Finish Tracking one message in batchID: " + msgInfo.BatchID); StreamBatch targetBatch = batchTrackingMap[msgInfo.BatchID]; targetBatch.CompleteOneMessageTracking(msgInfo); if (targetBatch.readForCommitting) { if (batchCoordinator != null) { PrettyConsole.Line("Commit Batch: " + msgInfo.BatchID); SetBatchAsCompleted(msgInfo.BatchID); batchCoordinator.StartCommit(msgInfo.BatchID); batchTrackingMap.Remove(msgInfo.BatchID); } } } return(Task.CompletedTask); }