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

[Hotfix][CDC] Fix thread-unsafe collection container in cdc enumerator #5614

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

hailin0
Copy link
Member

@hailin0 hailin0 commented Oct 12, 2023

Purpose of this pull request

Fix thread-unsafe collection container in cdc enumerator

Does this PR introduce any user-facing change?

No

How was this patch tested?

The enumerator will receive concurrent access from multiple readers, including when restoring, so any connector-enumerator should use a thread-safe container.

Check list

@hailin0 hailin0 marked this pull request as ready for review October 12, 2023 13:18
@hailin0
Copy link
Member Author

hailin0 commented Oct 16, 2023

@EricJoy2048 @Hisoka-X @ic4y

this.remainingSplits = remainingSplits;
this.assignedSplits = assignedSplits;
this.splitCompletedOffsets = splitCompletedOffsets;
this.alreadyProcessedTables = Collections.synchronizedList(alreadyProcessedTables);
Copy link
Member

Choose a reason for hiding this comment

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

Why not use concurrent list like CopyOnWriteArrayList? Should be faster.

Copy link
Member Author

Choose a reason for hiding this comment

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

CopyOnWriteArrayList is suitable for scenarios where there are very few writes, because the copy action is expensive

@EricJoy2048 EricJoy2048 merged commit b2f70fd into apache:dev Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants