[FLINK-40007][postgres] Fix snapshot fetch size conf does not take effect#4453
Open
JNSimba wants to merge 3 commits into
Open
[FLINK-40007][postgres] Fix snapshot fetch size conf does not take effect#4453JNSimba wants to merge 3 commits into
JNSimba wants to merge 3 commits into
Conversation
Contributor
|
@JNSimba Please add ut cover this bug . |
….getFetchSize() instead of debezium getSnapshotFetchSize()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Relate pr: #2766
The Postgres incremental source uses the Debezium connector config's snapshot
fetch size (
connectorConfig.getSnapshotFetchSize(), default10240) for thesnapshot split read, instead of the Flink CDC option
scan.snapshot.fetch.size(default
1024). As a result:scan.snapshot.fetch.sizehas no effect for the Postgres source.<=the fetch size, the JDBCserver-side cursor returns the whole chunk in a single batch, loading every
row of the chunk into memory at once. On wide tables (many columns / large
rows) this can exhaust the heap and OOM.
The MySQL source already reads
sourceConfig.getFetchSize()for its snapshotread. This PR makes the Postgres snapshot read task do the same, so that
scan.snapshot.fetch.sizeis honored consistently across connectors.Brief change log
PostgresSnapshotSplitReadTasknow takes thePostgresSourceConfigand usessourceConfig.getFetchSize()for the snapshot select statement, instead ofconnectorConfig.getSnapshotFetchSize().Verifying this change
This change is covered by existing Postgres source tests; the snapshot fetch
size now follows the
scan.snapshot.fetch.sizeoption.Does this pull request potentially affect one of the following parts:
Documentation