[
https://issues.apache.org/jira/browse/BEAM-7112?focusedWorklogId=233385&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-233385
]
ASF GitHub Bot logged work on BEAM-7112:
----------------------------------------
Author: ASF GitHub Bot
Created on: 26/Apr/19 09:19
Start Date: 26/Apr/19 09:19
Worklog Time Spent: 10m
Work Description: mxm commented on pull request #8399: [BEAM-7112] Timer
race with state cleanup - take two
URL: https://github.com/apache/beam/pull/8399#discussion_r278864096
##########
File path:
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/ExecutableStageDoFnOperator.java
##########
@@ -812,21 +796,35 @@ public boolean isForWindow(
private final List<String> userStateNames;
private final Coder windowCoder;
- private final StateInternals stateInternals;
+ private final ArrayDeque<KV<ByteBuffer, BoundedWindow>> cleanupQueue;
+ private final Supplier<ByteBuffer> keyedStateBackend;
- StateCleaner(List<String> userStateNames, Coder windowCoder,
StateInternals stateInternals) {
+ StateCleaner(
+ List<String> userStateNames, Coder windowCoder, Supplier<ByteBuffer>
keyedStateBackend) {
this.userStateNames = userStateNames;
this.windowCoder = windowCoder;
- this.stateInternals = stateInternals;
+ this.keyedStateBackend = keyedStateBackend;
+ this.cleanupQueue = new ArrayDeque<>();
}
@Override
public void clearForWindow(BoundedWindow window) {
- // Executed in the context of onTimer(..) where the correct key will be
set
- for (String userState : userStateNames) {
- StateNamespace namespace = StateNamespaces.window(windowCoder, window);
- BagState<?> state = stateInternals.state(namespace,
StateTags.bag(userState, null));
- state.clear();
+ cleanupQueue.add(KV.of(keyedStateBackend.get(), window));
Review comment:
```suggestion
// Executed in the context of onTimer(..) where the correct key will
be set
ByteBuffer key = keyedStateBackend.get();
cleanupQueue.add(KV.of(key, window));
```
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 233385)
Time Spent: 7h (was: 6h 50m)
> State cleanup interferes with user timer callback
> -------------------------------------------------
>
> Key: BEAM-7112
> URL: https://issues.apache.org/jira/browse/BEAM-7112
> Project: Beam
> Issue Type: Bug
> Components: runner-flink
> Affects Versions: 2.12.0
> Reporter: Thomas Weise
> Assignee: Thomas Weise
> Priority: Major
> Labels: portability-flink
> Fix For: 2.13.0
>
> Time Spent: 7h
> Remaining Estimate: 0h
>
> Cleanup timers and user timers are fired at the watermark. Processing of
> timers in the SDK worker is asynchronous, so it is possible that the state is
> already removed when the user timer callback executes.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)