-
Notifications
You must be signed in to change notification settings - Fork 637
feat(postgres-cdc): support replicating Postgres schema change #18760
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
Conversation
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.
license-eye has totally checked 5420 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
2306 | 5 | 3109 | 0 |
Click to see the invalid file list
- java/connector-node/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
- java/connector-node/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresSchema.java
- java/connector-node/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresStreamingChangeEventSource.java
- java/connector-node/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/connection/ReplicationStream.java
- java/connector-node/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/connection/pgoutput/PgOutputMessageDecoder.java
...gwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
Show resolved
Hide resolved
...ode/risingwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresSchema.java
Show resolved
Hide resolved
...e-cdc/src/main/java/io/debezium/connector/postgresql/PostgresStreamingChangeEventSource.java
Show resolved
Hide resolved
...-source-cdc/src/main/java/io/debezium/connector/postgresql/connection/ReplicationStream.java
Show resolved
Hide resolved
...c/main/java/io/debezium/connector/postgresql/connection/pgoutput/PgOutputMessageDecoder.java
Show resolved
Hide resolved
@@ -88,6 +88,18 @@ impl JavaVmWrapper { | |||
} | |||
} | |||
|
|||
// move risingwave-source-cdc to the head of classpath, because we have some patched Debezium classes |
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.
It's somehow hacky to do it in this way, because this depends on the behavior of the default class loader of specific jvm implementation. Not sure whether or not all class loaders always take the first seen class in the jar list.
Maybe we can try using the maven shade plugin to include all classes in the original jar and exclude the specific classes patched in this PR, and then we can explicitly exclude the some dbz artifacts in the pom file. The way to use shade plugin can be found in this example
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.
It's somehow hacky to do it in this way, because this depends on the behavior of the default class loader of specific jvm implementation. Not sure whether or not all class loaders always take the first seen class in the jar list.
This concern can be eliminated by testing. Since we use same docker image in our ci pipeline and the cloud deployment, the behavior of jvm should be deterministic across our ci and cloud.
Maybe we can try using the maven shade plugin to include all classes in the original jar and exclude the specific classes patched in this PR, and then we can explicitly exclude the some dbz artifacts in the pom file. The way to use shade plugin can be found in this example
I think it is possible shadow original classes with the shade plugin, but we can do it in future pr if it is really needed.
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.
Generally LGTM
...gwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
Outdated
Show resolved
Hide resolved
...gwave-source-cdc/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
Show resolved
Hide resolved
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
9425213 | Triggered | Generic Password | e3e14f3 | ci/scripts/e2e-source-test.sh | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
… (#18969) Co-authored-by: StrikeW <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Copy and patched the Debezium postgres conenctor (v2.6.2) to our project (patched code enclosing with
/* patched */
)PgOutputMessageDecoder
: dispatch schema change event when handlingR
messagePostgresSchema
act asHistorizedDatabaseSchema
which is a prerequisite to emit schema change eventReplicationStream.ReplicationMessageProcessor
to provide interfaces to emit schema change eventModify the jar loading order to ensure
risingwave-source-cdc
to be the first jar in the classpath so that the jvm can load those patched .class instead of the original classesThe schema change event will not be emitted until new data events come in, so if DDL has been executed on upstream but there is no IUD on upstream, the schema change event will not be emitted
Add
auto.schema.change
option to postgres sourceTest Coverage:
auto_schema_change_pg.slt
to verify the handling of automatic schema changes in PostgreSQL CDC sources. (e2e_test/source/cdc_inline/auto_schema_change_pg.slt
)Logging Enhancements:
DbzChangeEventConsumer
to include schema and data context in log messages. (java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/core/DbzChangeEventConsumer.java
) [1] [2]Configuration Updates:
include.schema.changes
topostgres.properties
to control whether schema changes are included. (java/connector-node/risingwave-connector-service/src/main/resources/postgres.properties
)Miscellaneous:
.typos.toml
to exclude certain Java files from typo checks. (.typos.toml
)Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
auto.schema.change
option to allow replicating Postgres table schema change