wuchong commented on a change in pull request #8341: [FLINK-11633][docs-zh] 
Translate "Working with state" into Chinese
URL: https://github.com/apache/flink/pull/8341#discussion_r281009648
 
 

 ##########
 File path: docs/dev/stream/state/state.zh.md
 ##########
 @@ -314,59 +272,45 @@ stateDescriptor.enableTimeToLive(ttlConfig)
 </div>
 </div>
 
-The configuration has several options to consider:
-
-The first parameter of the `newBuilder` method is mandatory, it is the 
time-to-live value.
+TTL 配置有以下几个选项:
+`newBuilder` 的第一个参数表示数据的有效期,是必选项。
 
-The update type configures when the state TTL is refreshed (by default 
`OnCreateAndWrite`):
+TTL 的更新策略(默认是 `OnCreateAndWrite`):
 
- - `StateTtlConfig.UpdateType.OnCreateAndWrite` - only on creation and write 
access
- - `StateTtlConfig.UpdateType.OnReadAndWrite` - also on read access
+ - `StateTtlConfig.UpdateType.OnCreateAndWrite` - 仅在创建和写入时更新
+ - `StateTtlConfig.UpdateType.OnReadAndWrite` - 读取时也更新
  
-The state visibility configures whether the expired value is returned on read 
access 
-if it is not cleaned up yet (by default `NeverReturnExpired`):
+数据在过期但还未被清理时的可见性配置如下(默认为 `NeverReturnExpired`):
 
- - `StateTtlConfig.StateVisibility.NeverReturnExpired` - expired value is 
never returned
- - `StateTtlConfig.StateVisibility.ReturnExpiredIfNotCleanedUp` - returned if 
still available
+ - `StateTtlConfig.StateVisibility.NeverReturnExpired` - 不返回过期数据
+ - `StateTtlConfig.StateVisibility.ReturnExpiredIfNotCleanedUp` - 会返回过期但未清理的数据
  
-In case of `NeverReturnExpired`, the expired state behaves as if it does not 
exist anymore, 
-even if it still has to be removed. The option can be useful for use cases 
-where data has to become unavailable for read access strictly after TTL, 
-e.g. application working with privacy sensitive data.
- 
-Another option `ReturnExpiredIfNotCleanedUp` allows to return the expired 
state before its cleanup.
+`NeverReturnExpired` 情况下,过期数据就像不存在一样,不管是否被物理删除。这对于不能访问过期数据的场景下非常有用,比如敏感数据。
+`ReturnExpiredIfNotCleanedUp` 在数据被物理删除前都会返回。
 
-**Notes:** 
+**注意:** 
 
-- The state backends store the timestamp of the last modification along with 
the user value, 
-which means that enabling this feature increases consumption of state storage. 
-Heap state backend stores an additional Java object with a reference to the 
user state object 
-and a primitive long value in memory. The RocksDB state backend adds 8 bytes 
per stored value, list entry or map entry.
+- 状态上次的修改时间会和数据一起保存在 state backend 中,因此开启该特性会增加状态数据的存储。
+Heap state backend 会额外存储一个包括用户状态以及时间戳的 Java 对象,RocksDB state backend 
会在每个状态值(list 或者 map 的每个元素)序列化后增加 8 个字节。 
 
-- Only TTLs in reference to *processing time* are currently supported.
+- 暂时只支持基于 *processing time* 的 TTL。
 
-- Trying to restore state, which was previously configured without TTL, using 
TTL enabled descriptor or vice versa
-will lead to compatibility failure and `StateMigrationException`.
+- 尝试从 checkpoint/savepoint 进行恢复时,TTL 的状态(是否开启)必须和之前保持一致,否则会遇到 
"StateMigrationException"。
 
-- The TTL configuration is not part of check- or savepoints but rather a way 
of how Flink treats it in the currently running job.
+- TTL 的配置并不会保存在 checkpoint/savepoint 中,仅对当前 Job 有效。
 
-- The map state with TTL currently supports null user values only if the user 
value serializer can handle null values. 
-If the serializer does not support null values, it can be wrapped with 
`NullableSerializer` at the cost of an extra byte in the serialized form.
+- 当前开启 TTL 的情况下,仅在用户值序列化器支持 null 的情况下,map state 才支持用户值为 null。如果用户值序列化器不支持 null,
 
 Review comment:
   ```suggestion
   - 当前开启 TTL 的 map state 仅在用户值序列化器支持 null 的情况下,才支持用户值为 null。如果用户值序列化器不支持 null,
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to