我们已经部署了一个新的 Flink 实例,版本为 1.4。在尝试从旧的 1.2.1 部署中恢复保存点时,我们尝试恢复的所有作业都遇到相同的错误:
org.apache.flink.runtime.execution.SuppressRestartsException: Unrecoverable failure. This suppresses job restarts. Please check the stack trace for the root cause.
at org.apache.flink.runtime.jobmanager.JobManager$$anonfun$org$apache$flink$runtime$jobmanager$JobManager$$submitJob$1.apply$mcV$sp(JobManager.scala:1360)
at org.apache.flink.runtime.jobmanager.JobManager$$anonfun$org$apache$flink$runtime$jobmanager$JobManager$$submitJob$1.apply(JobManager.scala:1336)
at org.apache.flink.runtime.jobmanager.JobManager$$anonfun$org$apache$flink$runtime$jobmanager$JobManager$$submitJob$1.apply(JobManager.scala:1336)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:415)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.IllegalStateException: Legacy state (from Flink <= 1.1, created through the 'Checkpointed' interface) is no longer supported starting from Flink 1.4. Please rewrite your job to use 'CheckpointedFunction' instead!
at org.apache.flink.util.Preconditions.checkState(Preconditions.java:195)
at org.apache.flink.runtime.checkpoint.savepoint.SavepointV1Serializer.deserializeSubtaskState(SavepointV1Serializer.java:171)
at org.apache.flink.runtime.checkpoint.savepoint.SavepointV1Serializer.deserialize(SavepointV1Serializer.java:96)
at org.apache.flink.runtime.checkpoint.savepoint.SavepointV1Serializer.deserialize(SavepointV1Serializer.java:54)
at org.apache.flink.runtime.checkpoint.savepoint.SavepointStore.loadSavepointWithHandle(SavepointStore.java:278)
at org.apache.flink.runtime.checkpoint.savepoint.SavepointLoader.loadAndValidateSavepoint(SavepointLoader.java:70)
at org.apache.flink.runtime.checkpoint.CheckpointCoordinator.restoreSavepoint(CheckpointCoordinator.java:1141)
at org.apache.flink.runtime.jobmanager.JobManager$$anonfun$org$apache$flink$runtime$jobmanager$JobManager$$submitJob$1.apply$mcV$sp(JobManager.scala:1350)
... 10 more
错误消息:
从 Flink 1.4 开始,不再支持遗留状态(来自 Flink <= 1.1,通过 'Checkpointed' 接口创建(。请重写您的作业以改用"CheckpointedFunction"!
不过,这似乎是错误的,因为我们的其他部署运行的是 1.2.1。
文档页面仍未针对 1.4: https://ci.apache.org/projects/flink/flink-docs-release-1.4/ops/upgrading.html 进行更新,但似乎并行性在过去一直是一个问题。我尝试使用与保存点即将到来的工作相同的方法,但仍然是相同的问题。
关于可能导致此问题的原因以及如何解决它的任何提示?
谢谢!
在 1.4.0 版本中,Flink 不再支持从 Checkpointed
接口的状态恢复。要执行有状态升级,必须执行以下操作:
- 保存您在 Flink 1.2.1 上运行的作业
- 在所有有状态函数中将
Checkpointed
替换为CheckpointedFunction
- 实现
CheckpointedRestoring
接口以从Checkpointed
保存点还原 - 在 Flink 1.2.1 上执行修改后的作业并获取第二个保存点
- 从所有有状态函数中删除
CheckpointedRestoring
接口 - 在 Flink 1.4.0 上使用第二个保存点运行修改后的作业
如果迁移作业时仍有其他问题,请告诉我。
所以,终于想通了问题所在。
我们开始在 Flink 1.1 中运行我们的任务,然后将它们的保存点迁移到 1.2.1。
似乎 Flink 1.2.1 没有对保存点进行任何升级,因此它们仍将具有旧格式,即 Flink 1.4 不支持的格式。
解决方案是在 Flink 1.3 中运行我们的任务 + 保存点,并在那里创建一个新的保存点,该保存点将以新格式保存。这个终于与 Flink 1.4 兼容了:)