Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public DataflowSideInputReadCounter(
this.declaringOperationContext = operationContext;
byteCounters = new HashMap<>();
executionStates = new HashMap<>();
checkState();
updateCurrentStateIfOutdated();
}

private void checkState() {
private void updateCurrentStateIfOutdated() {
DataflowExecutionState currentState =
(DataflowExecutionState) executionContext.getExecutionStateTracker().getCurrentState();
if (currentState == null
Expand Down Expand Up @@ -160,11 +160,11 @@ public void addBytesRead(long n) {

@Override
public Closeable enter() {
checkState();
// Only update status from tracked thread to avoid race condition and inconsistent state updates
if (executionContext.getExecutionStateTracker().getTrackedThread() != Thread.currentThread()) {
return () -> {};
}
updateCurrentStateIfOutdated();
return executionContext.getExecutionStateTracker().enterState(currentExecutionState);
}

Expand Down