flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] yanghua commented on a change in pull request #7571: [FLINK-10724] Refactor failure handling in check point coordinator
Date Fri, 26 Apr 2019 15:20:39 GMT
yanghua commented on a change in pull request #7571: [FLINK-10724] Refactor failure handling
in check point coordinator
URL: https://github.com/apache/flink/pull/7571#discussion_r278994671
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java
 ##########
 @@ -405,54 +404,30 @@ public void addMasterState(MasterState state) {
 	// ------------------------------------------------------------------------
 
 	/**
-	 * Aborts a checkpoint because it expired (took too long).
+	 * Aborts a checkpoint with reason and cause.
 	 */
-	public void abortExpired() {
+	public void abort(CheckpointFailureReason reason, Throwable cause) {
 		try {
-			Exception cause = new Exception("Checkpoint expired before completing");
-			onCompletionPromise.completeExceptionally(cause);
-			reportFailedCheckpoint(cause);
+			CheckpointException exception = new CheckpointException(reason, cause);
+			onCompletionPromise.completeExceptionally(exception);
+			reportFailedCheckpoint(exception);
+			assertAbortSubsumedForced(reason);
 		} finally {
 			dispose(true);
 		}
 	}
 
 	/**
-	 * Aborts the pending checkpoint because a newer completed checkpoint subsumed it.
+	 * Aborts a checkpoint with reason and cause.
 	 */
-	public void abortSubsumed() {
-		try {
-			Exception cause = new Exception("Checkpoints has been subsumed");
-			onCompletionPromise.completeExceptionally(cause);
-			reportFailedCheckpoint(cause);
-
-			if (props.forceCheckpoint()) {
-				throw new IllegalStateException("Bug: forced checkpoints must never be subsumed");
-			}
-		} finally {
-			dispose(true);
-		}
-	}
-
-
-	public void abortDeclined() {
-		abortWithCause(new Exception("Checkpoint was declined (tasks not ready)"));
-	}
-
-	/**
-	 * Aborts the pending checkpoint due to an error.
-	 * @param cause The error's exception.
-	 */
-	public void abortError(@Nonnull Throwable cause) {
-		abortWithCause(new Exception("Checkpoint failed: " + cause.getMessage(), cause));
+	public void abort(CheckpointFailureReason reason) {
+		abort(reason, null);
 	}
 
-	private void abortWithCause(@Nonnull Exception cause) {
-		try {
-			onCompletionPromise.completeExceptionally(cause);
-			reportFailedCheckpoint(cause);
-		} finally {
-			dispose(true);
+	private void assertAbortSubsumedForced(CheckpointFailureReason reason) {
+		if (props.forceCheckpoint()) {
 
 Review comment:
   Actually, I agree with the first part of this suggestion. For the second part, if we assume
the behavior of the caller end, I think you are right. However, it seems a good experience
is that we should not assume the caller's behavior, because it may be changed in the future,
right? IMO, We can only assume someone calls the abort method, it could be `CheckpointCoordinator#dropSubsumedCheckpoints`
or somewhere in a test case. So I think this method is valuable.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message