Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-23228][docs-zh] Translate "Stateful Stream Processing" page into Chinese #16478

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

RollsBean
Copy link
Contributor

What is the purpose of the change

(This pull request is to translate "Stateful Stream Processing" page into Chinese.)

Brief change log

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no )
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 13, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit fead4ce (Thu Sep 23 18:53:24 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@RollsBean
Copy link
Contributor Author

English to Chinese key word in this translation:

English 中文
overtaken 超过
barrier 屏障
in-flight 运行中的
Keyed State 键控状态
Key Group 键组

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 13, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

state holds the current version of the model parameters.
- When historic data needs to be managed, the state allows efficient access
to events that occurred in the past.
- 当应用程序搜索某些事件模式时,状态将存储到目前为止遇到的事件序列。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有点不好理解,
"当程序搜索指定event时,state会按顺序存储截止到目前为止的所有event"
很多关键之要完全翻译过来吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢指正,这个地方翻译地确实拗口,里面有些信息不知道是否可以舍弃不翻,怕和原意不符。

下面还有一些翻译不太确定的地方,比如:

  • 40行:stream of data points 翻译成了 “状态点的流”
  • data flowdata streamstream of data data stream and flow 都翻译成了 “数据流”

如你所说,很多关键词我也都翻译了,比如文档中场景的 event、 state、 checkpointing、 savepoint、Keyed等词语,不过一部分词语翻译后也在后面的括号里提供了英文对照。

你看还有哪些有问题,我最后再整体改一遍,再次感谢!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我英语不行,也只是看看有部分读着比较生硬的地方,看看能不能翻译成让国人更好的理解,多向你学习

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我还是没想好怎么改,如果你有更好的可以回复一下,作为初学者,我还需要再理解下这句话的意思

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event 事件
the sequence of events encountered so far : 截止到当前事件序列
个人感觉就是:state记录了截止到当前所发生的事件.
sequence 这里不知道是翻译成按顺序记录,还是序列好理解。
可以群里问问他们大家一起聊聊,怎么理解才是对的

affected the previously checkpointed state.
## 键控状态(Keyed State)

键控状态被维护在一个可以认为是键/值存储的地方。状态和有状态算子读取的流一起被严格地分区和分布。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyed 翻译成“键控” 感觉也有点生硬,翻译成 “键值” (键值对kv) 会不会更好?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyed 翻译成 “有键的” 是不是更容易理解,表示这个状态是有键的

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyed state 感觉可以不翻译,我看其他翻译里面都保留这个关键字了。
keyed 是对state 的一种定语,就是以key 存储,查找的一种state 类型

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,我也觉得 keyed state 可以不翻译,这个我改一下

snapshots, we use the words *snapshot* and *checkpoint* interchangeably. Often
we also use the term *snapshot* to mean either *checkpoint* or *savepoint*.
由于 Flink 的检查点是通过分布式快照实现的,所以我们交替使用*快照*(snapshot)和*检查点*(checkpoint)两个词。
通常我们也使用术语*快照*来表示*检查点*或*保存点*(savepoint)。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉英文这里用* 就不太合理,翻译连接起来看着怪怪的,可以用中文的 “” 来表示

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里原文只是使用了斜体,所以用了 * 号,不过按照中文的习惯,倒是可以写成 “快照” 来表示它是一个名词。

它受到标准 [Chandy-Lamport 算法](http://research.microsoft.com/en-us/um/people/lamport/pubs/chandy.pdf)的启发,
专门针对 Flink 的执行模型量身定制。

请记住,与检查点有关的一切都可以异步完成。检查点屏障(checkpoint barrier)不会在锁定步骤中移动,操作可以异步快照它们的状态。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"不会在锁定步骤中移动" 这个感觉也有点生硬
是要描述: checkpoint barrier 不会(加锁)阻塞数据流,所有操作可以异步快照他们的状态吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方我再理解理解, 我又查了一下,原文中描述是 The checkpoint barriers don't travel in lock step,其中 lock step 两个单词组合在一起是一个新的单词 lockstep,它有同步的意思,这里如果改成 lockstep,那么就比较好理解了,意思就是”检查点屏障不会同步移动“。

按上面这个理解,感觉句子就比较通顺了,不知道是不是原文写错了。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩,这样理解好很多。 原文也是人写的,他们的表达方式和国人有些区别,觉得吧,核心还是在理解正确的情况下,让国人更好理解就行

- The DataSet API introduces special synchronized (superstep-based)
iterations, which are only possible on bounded streams. For details, check
out the [iteration docs]({{< ref "docs/dev/dataset/iterations" >}}).
- DataSet API 引入了特殊的同步(基于超级步)迭代,这只能在有界流上使用。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

基于超级步 这个也有些生硬
要不就原文~.~ 或者翻译成能理解的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

翻译成”超级步“确实有点不好理解,这里 superstep 还是不翻译了吧,改成 “基于 superstep”

@RollsBean
Copy link
Contributor Author

@ranqiqiang 重新更新了一下

Copy link
Contributor

@hackergin hackergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @RollsBean , I left some comments.

state holds the current version of the model parameters.
- When historic data needs to be managed, the state allows efficient access
to events that occurred in the past.
- 当应用程序搜索某些事件模式时,状态将存储到目前为止遇到的一系列事件。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 当应用程序搜索某些事件模式时,状态将存储到目前为止遇到的一系列事件
- 当应用程序搜索某些事件模式时,状态将保存目前为止遇到事件的顺序

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hackergin , I will update it today

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

”状态将按顺序保存目前为止遇到的事件“ 是不是合理点?

还是我理解错了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原文 “the state will store the sequence of events encountered so far”,宾语是 “事件的顺序”

- When historic data needs to be managed, the state allows efficient access
to events that occurred in the past.
- 当应用程序搜索某些事件模式时,状态将存储到目前为止遇到的一系列事件。
- 当每分钟/每小时/每天聚合事件时,状态会持有待处理的聚合。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 当每分钟/每小时/每天聚合事件时,状态会持有待处理的聚合。
- 当聚合每分钟/每小时/每天事件时,状态会持有待处理的聚合。

to events that occurred in the past.
- 当应用程序搜索某些事件模式时,状态将存储到目前为止遇到的一系列事件。
- 当每分钟/每小时/每天聚合事件时,状态会持有待处理的聚合。
- 当在数据点的流上训练一个机器学习模型时,状态会保存模型参数的当前版本。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 当在数据点的流上训练一个机器学习模型时,状态会保存模型参数的当前版本
- 当在数据点的流上训练一个机器学习模型时,状态会保存当前模型参数的版本


Flink needs to be aware of the state in order to make it fault tolerant using
Flink 需要知道状态以便使用
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Flink 需要知道状态以便使用
Flink 需要使用 savepoint 和 checkpoint 来感知状态并进行容错.


Knowledge about the state also allows for rescaling Flink applications, meaning
that Flink takes care of redistributing state across parallel instances.
关于状态的知识也允许我们重新调节 Flink 应用程序,这意味着 Flink 负责跨并行实例重新分布状态。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
关于状态的知识也允许我们重新调节 Flink 应用程序,这意味着 Flink 负责跨并行实例重新分布状态。
我们知道状态是支持 Flink 程序的动态伸缩的,这意味着 Flink 会在多个并发中重新分配状态.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hackergin , “Flink takes care of redistributing state across parallel instances.” 是不是翻译成 “这意味着 Flink 会跨多个并行实例重新分配状态” 更符合原意,前面说“状态”支持 Flink 扩缩容,那 Flink 就需要能在并行实例中分配状态


[Queryable state]({{< ref "docs/dev/datastream/fault-tolerance/queryable_state" >}}) allows you to access state from outside of Flink during runtime.
[可查询的状态]({{< ref "docs/dev/datastream/fault-tolerance/queryable_state" >}})允许你在运行时从 Flink 外部访问状态。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[可查询的状态]({{< ref "docs/dev/datastream/fault-tolerance/queryable_state" >}})允许你在运行时从 Flink 外部访问状态
[可查询的状态]({{< ref "docs/dev/datastream/fault-tolerance/queryable_state" >}})允许你在 Flink 运行时从外部访问状态

When working with state, it might also be useful to read about [Flink's state
backends]({{< ref "docs/ops/state/state_backends" >}}). Flink
provides different state backends that specify how and where state is stored.
在使用状态时,阅读 [Flink 的状态后端]({{< ref "docs/ops/state/state_backends" >}})可能也很有用。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
在使用状态时,阅读 [Flink 的状态后端]({{< ref "docs/ops/state/state_backends" >}})可能也很有用
在使用状态时,参考 [Flink 的状态后端]({{< ref "docs/ops/state/state_backends" >}})也会有一些帮助

Flink 分布式快照的一个核心元素是*流屏障*(stream barriers)。
这些屏障被注入到数据流中,并作为数据流的一部分与记录一起流动。屏障永远不会超过记录,它们严格按照顺序流动。
屏障将数据流中的记录分为进入当前快照的记录集和进入下一个快照的记录。每个屏障都带有它推送到它前面的记录的快照的 ID。
屏障不会被流中断因此非常轻量。来自不同快照的多个屏障可以在同时在流中,这意味着各种快照可能会同时发生。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
屏障不会被流中断因此非常轻量。来自不同快照的多个屏障可以在同时在流中,这意味着各种快照可能会同时发生。
屏障不会中断数据流因此非常轻量。来自不同快照的多个屏障可以在同时在流中,这意味着各种快照可能会同时发生。

parallel streaming operations (`map()`, `flatMap()`, `filter()`, ...) actually
give *exactly once* guarantees even in *at least once* mode.
对齐只发生在有多个前驱(连接)的算子和有多个发送者(在流重新分区/shuffle 之后)的算子。
因此,即使在*至少一次*(at least once)模式下,实际上只有令人尴尬的并行流操作(`map()`、`flatMap()`、`filter()` 等)的数据流提供*精确一次*(exactly once)保证。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
因此,即使在*至少一次*(at least once)模式下,实际上只有令人尴尬的并行流操作`map()``flatMap()``filter()` 等)的数据流提供*精确一次*(exactly once)保证。
因此,即使在*至少一次*(at least once)模式下,只包含高度并行流操作`map()``flatMap()``filter()` 等)的数据流也可以提供*精确一次*(exactly once)保证。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢,才注意到 embarrassingly parallel 这个短语有“高度并行” 的意思

because it avoids checkpoints.
- [批处理程序的容错]({{< ref "docs/ops/state/task_failure_recovery" >}})
并不使用检查点。恢复是通过完全重放流来实现的。这是可能的,因为输入是有界的。
这将成本更多地推向了恢复,但是使得定期的处理程序更便宜,因为它避免了检查点。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
这将成本更多地推向了恢复,但是使得定期的处理程序更便宜,因为它避免了检查点。
这将导致恢复成本更高,但是使得定期的处理程序开销更小,因为它避免了检查点。

@RollsBean
Copy link
Contributor Author

Hi @hackergin , @ranqiqiang , updated

@RollsBean
Copy link
Contributor Author

@ranqiqiang @hackergin ,I submitted some changes, please have a review if you are free, thanks!

Copy link
Contributor

@hackergin hackergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RollsBean thanks for the update , sorry for the late reply, I left some other comments.


{{< img src="/fig/state_partitioning.svg" alt="状态和分区" class="offset" width="50%" >}}

Keyed State 被进一步组织成*键组*(Key Groups)。键组是 Flink 可以重新分布 Keyed State 的原子单元;有与定义的最大并行度一样多的键组。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Keyed State 被进一步组织成*键组*(Key Groups)。键组是 Flink 可以重新分布 Keyed State 的原子单元;有与定义的最大并行度一样多的键组
Keyed State 被进一步组织成*键组*(Key Groups)。键组是 Flink 可以重新分布 Keyed State 的原子单元,键组的个数和定义的最大并发度保持一致

this ability and Flink's connector to Kafka exploits this. See [Fault
Tolerance Guarantees of Data Sources and Sinks]({{< ref "docs/connectors/datastream/guarantees" >}}) for more information about the guarantees
provided by Flink's connectors.
为了让该机制实现其完全保证,数据流的源(例如消息队列或 broker)需要能够将流回滚到定义的最近点。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
为了让该机制实现其完全保证,数据流的源(例如消息队列或 broker)需要能够将流回滚到定义的最近点。
为了让该机制完整实现一致性保证,数据流的源(例如消息队列或 broker)需要能够将流回滚到定义的最近点。

(and their descendant records) will have passed through the entire data flow
topology.
流屏障被注入到数据源的并行数据流中。快照 *n* 的屏障被注入到的位置(我们称之为 <i>S<sub>n</sub></i>
)是数据源中快照覆盖数据的位置。例如,在 Apache Kafka 中,这个位置就是分区最后一条记录的偏移量。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)是数据源中快照覆盖数据的位置。例如,在 Apache Kafka 中,这个位置就是分区最后一条记录的偏移量
)是数据源中快照覆盖数据的位置。例如,在 Apache Kafka 中,这个位置就是分区最后一条记录的 offset

checkpoint *n*, and will be replayed as part of the data after checkpoint *n*.
如果跳过对齐,算子继续处理所有输入,即使在检查点 *n* 的一些检查点屏障到达之后也是如此。
这样,算子还会在获取检查点 *n* 的状态快照之前处理属于检查点 *n+1* 的元素。
在恢复时,这些记录将作为副本出现,因为它们都包含在检查点 *n* 的状态快照中,并且将在检查点 *n* 之后作为数据的一部分重放。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
在恢复时,这些记录将作为副本出现,因为它们都包含在检查点 *n* 的状态快照中,并且将在检查点 *n* 之后作为数据的一部分重放
在恢复时,这些记录将会重复,因为它们都包含在检查点 *n* 的状态快照中,并且将在检查点 *n* 之后重放

barrier from each input.
对齐的步骤可能会给流处理程序增加延迟。 通常,这额外的延迟大约是几毫秒,但是我们已经看到一些异常值的延迟显著增加的情况。
对于要求所有记录始终保持超低延迟(几毫秒)的应用程序,Flink 有一个开关可以在检查点期间跳过流对齐。
一旦算子看到每个输入的检查点屏障,检查点快照就仍然会被绘制。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
一旦算子看到每个输入的检查点屏障,检查点快照就仍然会被绘制。
一旦算子接收到任何一个输入的检查点屏障,检查点快照就仍然会被绘制。

@RollsBean
Copy link
Contributor Author

RollsBean commented Jul 23, 2021

Hi @hackergin , thanks for your review and following up my PR, I made some changes as you suggested, aslo I reviewed my whole translation and did some updates.

My updates as below(exclude you suggested):

  1. 有状态操作的一些示例: change to 一些有状态操作的示例:
  2. Keyed state 被维护在一个可以认为是键/值存储的地方。 change to Keyed state 被维护在一个键/值存储的地方。
  3. 在执行期间,每个有键算子的并行实例和一个或多个键组的键一起使用。 change to 在执行期间,每个 keyed operator 的并行实例和一个或多个键组的键一起使用。
  4. 例如在 Apache Kafka 中,这意味着告诉消费者(consumer)从 offset <i>S<sub>k</sub></i> 开始获取。 change to 例如在 Apache Kafka 中,这意味着告诉消费者(consumer)从 offset <i>S<sub>k</sub></i> 开始获取。

@hackergin
Copy link
Contributor

Thanks @RollsBean for the great job. LGTM.

@RollsBean
Copy link
Contributor Author

Hi @hackergin , if nothing need to be modified, can you merge this PR? Thanks

@hackergin
Copy link
Contributor

@RollsBean sorry , I don't the the merge permission, @wuchong please have a look at this pr.

@RollsBean
Copy link
Contributor Author

Hi @wuchong can you have a look at this PR

@RollsBean
Copy link
Contributor Author

Hi @xccui @klion26 , can you have a look at this PR? I have finished translation and hackergin reviewed this PR but no one merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants