-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[FLINK-38959][pipeline-connector][postgres]Added support for schema change in the postgres pipeline connector #4233
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
| import org.apache.flink.cdc.common.annotation.Internal; | ||
| import org.apache.flink.cdc.common.annotation.VisibleForTesting; | ||
| import org.apache.flink.cdc.common.event.Event; | ||
| import org.apache.flink.cdc.common.event.TableId; | ||
| import org.apache.flink.cdc.common.source.DataSource; | ||
| import org.apache.flink.cdc.common.source.EventSourceProvider; | ||
| import org.apache.flink.cdc.common.source.FlinkSourceProvider; | ||
|
|
@@ -34,13 +35,16 @@ | |
| import org.apache.flink.cdc.connectors.postgres.source.offset.PostgresOffsetFactory; | ||
| import org.apache.flink.cdc.connectors.postgres.source.reader.PostgresPipelineRecordEmitter; | ||
| import org.apache.flink.cdc.connectors.postgres.table.PostgreSQLReadableMetadata; | ||
| import org.apache.flink.cdc.connectors.postgres.utils.PostgresSchemaUtils; | ||
| import org.apache.flink.cdc.debezium.DebeziumDeserializationSchema; | ||
| import org.apache.flink.cdc.debezium.event.DebeziumEventDeserializationSchema; | ||
| import org.apache.flink.cdc.debezium.table.DebeziumChangelogMode; | ||
| import org.apache.flink.connector.base.source.reader.RecordEmitter; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** A {@link DataSource} for Postgres cdc connector. */ | ||
| @Internal | ||
|
|
@@ -50,6 +54,7 @@ public class PostgresDataSource implements DataSource { | |
| private final PostgresSourceConfig postgresSourceConfig; | ||
|
|
||
| private final List<PostgreSQLReadableMetadata> readableMetadataList; | ||
| Map<TableId, Map<String, Integer>> beforeTableColumnsOidMaps = new HashMap<>(); | ||
|
|
||
| public PostgresDataSource(PostgresSourceConfigFactory configFactory) { | ||
| this(configFactory, new ArrayList<>()); | ||
|
|
@@ -67,12 +72,17 @@ public PostgresDataSource( | |
| public EventSourceProvider getEventSourceProvider() { | ||
| String databaseName = postgresSourceConfig.getDatabaseList().get(0); | ||
| boolean includeDatabaseInTableId = postgresSourceConfig.isIncludeDatabaseInTableId(); | ||
| beforeTableColumnsOidMaps = | ||
| PostgresSchemaUtils.getAllTablesColumnOids( | ||
| postgresSourceConfig, postgresSourceConfig.getTableList()); | ||
|
Comment on lines
+75
to
+77
|
||
| DebeziumEventDeserializationSchema deserializer = | ||
| new PostgresEventDeserializer( | ||
| DebeziumChangelogMode.ALL, | ||
| readableMetadataList, | ||
| includeDatabaseInTableId, | ||
| databaseName); | ||
| databaseName, | ||
| postgresSourceConfig, | ||
| beforeTableColumnsOidMaps); | ||
|
|
||
| PostgresOffsetFactory postgresOffsetFactory = new PostgresOffsetFactory(); | ||
| PostgresDialect postgresDialect = new PostgresDialect(postgresSourceConfig); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: private final