flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #2608: [FLINK-4512] [FLIP-10] Add option to persist perio...
Date Tue, 11 Oct 2016 14:16:22 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2608#discussion_r82797030
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointStore.java
---
    @@ -43,24 +125,62 @@
     	 * @return The loaded savepoint
     	 * @throws Exception Failures during load are forwared
     	 */
    -	Savepoint loadSavepoint(String path) throws Exception;
    +	public static Savepoint loadSavepoint(String path) throws IOException {
    +		Preconditions.checkNotNull(path, "Path");
     
    -	/**
    -	 * Disposes the savepoint at the specified path.
    -	 *
    -	 * @param path        Path of savepoint to dispose
    -	 * @throws Exception Failures during diposal are forwarded
    -	 */
    -	void disposeSavepoint(String path) throws Exception;
    +		try (DataInputStream dis = new DataInputViewStreamWrapper(createFsInputStream(new Path(path))))
{
    +			int magicNumber = dis.readInt();
    +
    +			if (magicNumber == MAGIC_NUMBER) {
    +				int version = dis.readInt();
    +
    +				SavepointSerializer<?> serializer = SavepointSerializers.getSerializer(version);
    +				return serializer.deserialize(dis);
    +			} else {
    +				throw new RuntimeException("Unexpected magic number. This is most likely " +
    +						"caused by trying to load a Flink 1.0 savepoint. You cannot load a " +
    +						"savepoint triggered by Flink 1.0 with this version of Flink. If it is " +
    +						"_not_ a Flink 1.0 savepoint, this error indicates that the specified " +
    +						"file is not a proper savepoint or the file has been corrupted.");
    +			}
    +		}
    +	}
     
     	/**
    -	 * Shut downs the savepoint store.
    +	 * Removes the savepoint meta data w/o loading and disposing it.
     	 *
    -	 * <p>Only necessary for implementations where the savepoint life-cycle is
    -	 * bound to the cluster life-cycle.
    -	 *
    -	 * @throws Exception Failures during shut down are forwarded
    +	 * @param path Path of savepoint to remove
    +	 * @throws Exception Failures during disposal are forwarded
     	 */
    -	void shutdown() throws Exception;
    +	public static void removeSavepoint(String path) throws Exception {
    --- End diff --
    
    Could be `IOException`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message