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

[source][flink] Add some annotated information for the benefit of interested readers #5617

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

zhilinli123
Copy link
Contributor

@zhilinli123 zhilinli123 commented Oct 12, 2023

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@zhilinli123 zhilinli123 reopened this Oct 12, 2023
coordinatedSource.addSplits(subtaskId, splits);
}

@Override
public void signalNoMoreSplits(int subtaskId) {
/* Notifies the current Task that the reader has not split to close the currently running Task */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* Notifies the current Task that the reader has not split to close the currently running Task */
/* Notify the reader that there are no unassigned splits left */

@zhilinli123 zhilinli123 reopened this Oct 20, 2023
@@ -231,6 +244,7 @@ public Map<Integer, List<byte[]>> snapshotState(long checkpointId) throws Except
StateT enumeratorState = splitEnumerator.snapshotState(checkpointId);
if (enumeratorState != null) {
byte[] enumeratorStateBytes = enumeratorStateSerializer.serialize(enumeratorState);
// -1 identification that the last status information is read
Copy link
Member

Choose a reason for hiding this comment

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

Would that be a better way to describe it ?"-1 represents the state of an pending split in SourceSplitEnumerator."

entry.getValue().open();
// Allocates split whose status is pending
Copy link
Member

Choose a reason for hiding this comment

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

Would that be a better way to describe it ?"the corresponding status is assigned to the reader"

protected final Map<Integer, List<SplitT>> restoredSplitStateMap = new HashMap<>();

protected transient volatile SourceSplitEnumerator<SplitT, StateT> splitEnumerator;
// task and Reader Map Info
Copy link
Member

Choose a reason for hiding this comment

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

the mapping is from subtask id to the reader info

@@ -109,9 +117,11 @@ private void createSplitEnumerator() throws Exception {
throw new RuntimeException(e);
}
}
// The information read in the status is added to the Map
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to describe this process?
restoredState.forEach(
(subtaskId, splitBytes) -> {
if (subtaskId == -1) {
return;
}
List restoredSplitState = new ArrayList<>(splitBytes.size());
for (byte[] splitByte : splitBytes) {
try {
restoredSplitState.add(splitSerializer.deserialize(splitByte));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// The information read in the status is added to the Map
restoredSplitStateMap.put(subtaskId, restoredSplitState);
});

coordinatedSource.addSplits(subtaskId, splits);
}

@Override
public void signalNoMoreSplits(int subtaskId) {
/* Notify the reader that there are no unassigned splits left */
Copy link
Member

Choose a reason for hiding this comment

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

We can unify the style of interline comments and use "//" uniformly.

protected final Map<Integer, List<SplitT>> restoredSplitStateMap = new HashMap<>();

protected transient volatile SourceSplitEnumerator<SplitT, StateT> splitEnumerator;
// the mapping is from subtask id to the reader info
Copy link
Member

Choose a reason for hiding this comment

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

// The mapping is from subtask id to the reader info

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

Successfully merging this pull request may close these issues.

4 participants