iota-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonyfaust...@apache.org
Subject [09/10] incubator-iota git commit: Orchestration should not be deleted from checkpoint in case of failure, just when it is explicitly asked to be deleted
Date Wed, 28 Sep 2016 01:19:19 GMT
Orchestration should not be deleted from checkpoint in case of failure, just when it is explicitly
asked to be deleted


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/9d1a4e1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/9d1a4e1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/9d1a4e1d

Branch: refs/heads/master
Commit: 9d1a4e1dedf93af8c901d788b5d109909f0877d7
Parents: 5e0ccb8
Author: Barbara Gomes <barbaramaltagomes@gmail.com>
Authored: Fri Aug 19 15:33:49 2016 -0700
Committer: Barbara Gomes <barbaramaltagomes@gmail.com>
Committed: Fri Aug 19 15:33:49 2016 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/iota/fey/FeyCore.scala  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/9d1a4e1d/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
index 8541ee4..3018d03 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyCore.scala
@@ -63,7 +63,9 @@ protected class FeyCore extends Actor with ActorLogging{
 
     case STOP_EMPTY_ORCHESTRATION(orchID) =>
       log.warning(s"Deleting Empty Orchestration $orchID")
-      deleteOrchestration(orchID)
+      /* In most of the cases, this message will represent an orchestration that failed
+       * In this case, we don't want to remove it from the checkpoint dir */
+      deleteOrchestration(orchID, false)
 
     case Terminated(actor) => processTerminatedMessage(actor)
 
@@ -160,7 +162,7 @@ protected class FeyCore extends Actor with ActorLogging{
       case "RECREATE" => recreateOrchestration(ensembles, orchestrationID, orchestrationName,
orchestrationTimestamp)
       case "CREATE" => createOrchestration(ensembles, orchestrationID, orchestrationName,
orchestrationTimestamp)
       case "UPDATE" => updateOrchestration(ensembles, orchestrationID, orchestrationName,
orchestrationTimestamp)
-      case "DELETE" => deleteOrchestration(orchestrationID)
+      case "DELETE" => deleteOrchestration(orchestrationID,true)
       case x => throw new CommandNotRecognized(s"Command: $x")
     }
   }
@@ -186,7 +188,7 @@ protected class FeyCore extends Actor with ActorLogging{
           if(orchestration._1 != orchestrationTimestamp){
             val orchestrationInfo = new OrchestrationInformation(ensemblesSpecJson,orchestrationID,orchestrationName,orchestrationTimestamp)
             FEY_CACHE.orchestrationsAwaitingTermination.put(orchestrationID, orchestrationInfo)
-            deleteOrchestration(orchestrationID)
+            deleteOrchestration(orchestrationID, true)
           }else{
             log.warning(s"Orchestration ${orchestrationID} not recreated. Timestamp did not
change.")
           }
@@ -254,13 +256,15 @@ protected class FeyCore extends Actor with ActorLogging{
     * @param orchestrationID
     * @return
     */
-  private def deleteOrchestration(orchestrationID: String) = {
+  private def deleteOrchestration(orchestrationID: String, updateCheckpoint: Boolean) = {
     try{
       FEY_CACHE.activeOrchestrations.get(orchestrationID) match {
         case Some(orchestration) =>
           orchestration._2 ! PoisonPill
           FEY_CACHE.activeOrchestrations.remove(orchestrationID)
-          updateOrchestrationState(orchestrationID,true)
+          if(updateCheckpoint) {
+            updateOrchestrationState(orchestrationID, true)
+          }
         case None =>
           log.warning(s"No active Orchestration $orchestrationID to be deleted")
       }


Mime
View raw message