我正在使用 Apache Flink 1.2.0。根据生产准备 list ( https://ci.apache.org/projects/flink/flink-docs-release-1.2/ops/production_ready.html ),建议为运算符(operator)设置 Uid 以确保保存点的兼容性。
我找不到 flatMap 的 setUid() 方法,但我找到了 uid() 和 setUidHash() 根据文档。说
用户界面
"Sets an ID for this operator.
The specified ID is used to assign the same operator ID across job submissions (for example when starting a job from a savepoint)."
uidHash
"Sets an user provided hash for this operator. This will be used AS IS the create the JobVertexID.
The user provided hash is an alternative to the generated hashes, that is considered when identifying an operator through the default hash mechanics fails (e.g. because of changes between Flink versions)."
哪一个实际上应该在 flatMap 上设置,例如 uid() 或 setUidHash()?或两者?
最佳答案
uid()
建议在这种情况下使用方法。setUidHash()
应该使用 只有作为修复使用默认 uid 创建的作业而不是用户定义的作业的解决方法。它在 javadoc 中有说明:
this should be used as a workaround or for trouble shooting. The provided hash needs to be unique per transformation and job. Otherwise, job submission will fail. Furthermore, you cannot assign user-specified hash to intermediate nodes in an operator chain and trying so will let your job fail.
关于apache-flink - Apache Flink 设置运算符 Uid 与 UidHash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46112142/