Skip to content

Commit

Permalink
[hotfix] Backwards compatible deserialization of RocksDB backend UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanRRichter committed Jul 20, 2017
1 parent 4341c8a commit 2ba5f87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -391,8 +392,17 @@ private static KeyedStateHandle deserializeKeyedStateHandle(DataInputStream dis)
Map<StateHandleID, StreamStateHandle> sharedStates = deserializeStreamStateHandleMap(dis);
Map<StateHandleID, StreamStateHandle> privateStates = deserializeStreamStateHandleMap(dis);

UUID uuid;

try {
uuid = UUID.fromString(backendId);
} catch (Exception ex) {
// compatibility with old format pre FLINK-6964:
uuid = UUID.nameUUIDFromBytes(backendId.getBytes(StandardCharsets.UTF_8));
}

return new IncrementalKeyedStateHandle(
UUID.fromString(backendId),
uuid,
keyGroupRange,
checkpointId,
sharedStates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,6 @@ class TestingCluster(
def requestCheckpoint(jobId: JobID, options : CheckpointOptions): String = {
val jobManagerGateway = getLeaderGateway(timeout)

// wait until the cluster is ready to take a checkpoint.
val allRunning = jobManagerGateway.ask(
TestingJobManagerMessages.WaitForAllVerticesToBeRunning(jobId), timeout)

Await.ready(allRunning, timeout)

// trigger checkpoint
val result = Await.result(
jobManagerGateway.ask(CheckpointRequest(jobId, options), timeout), timeout)
Expand All @@ -395,16 +389,9 @@ class TestingCluster(
// failed because tasks were not ready.This would not be required if
// TestingJobManagerMessages.WaitForAllVerticesToBeRunning(...) works
// properly.
if (fail.cause != null) {
val innerCause = fail.cause.getCause
if (innerCause != null
&& innerCause.getMessage.contains("tasks not ready")) {
// retry if the tasks are not ready yet.
Thread.sleep(50)
return requestCheckpoint(jobId, options)
}
}
throw new IOException(fail.cause)
LOG.info("Test checkpoint attempt failed. Retry ...", fail.cause)
Thread.sleep(50)
requestCheckpoint(jobId, options)
}
case _ => throw new IllegalStateException("Trigger checkpoint failed")
}
Expand Down

0 comments on commit 2ba5f87

Please sign in to comment.