-
Notifications
You must be signed in to change notification settings - Fork 2
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
[DBZ-PGYB] Use YugabyteDB smart driver instead of vanilla Postgres JDBC driver #107
Conversation
debezium-connector-postgres/src/test/java/io/debezium/connector/postgresql/TestHelper.java
Outdated
Show resolved
Hide resolved
debezium-core/src/main/java/io/debezium/relational/RelationalDatabaseConnectorConfig.java
Outdated
Show resolved
Hide resolved
...nnector-postgres/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
Outdated
Show resolved
Hide resolved
...nnector-postgres/src/main/java/io/debezium/connector/postgresql/PostgresConnectorConfig.java
Outdated
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Show resolved
Hide resolved
...r-postgres/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java
Outdated
Show resolved
Hide resolved
...m-connector-postgres/src/test/java/io/debezium/connector/postgresql/PostgresConnectorIT.java
Show resolved
Hide resolved
@@ -1140,6 +1140,15 @@ private static int validateFlushLsnSource(Configuration config, Field field, Fie | |||
return 0; | |||
} | |||
|
|||
public JdbcConnection.ConnectionFactory getConnectionFactory() { |
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.
Can this be a static method. This can then be called from PostgresConnection as well (instead of duplicating the code there)
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 cannot be a static method since the methods/attributes this is accessing are non-static.
@@ -85,6 +86,7 @@ public class PostgresConnection extends JdbcConnection { | |||
|
|||
private final TypeRegistry typeRegistry; | |||
private final PostgresDefaultValueConverter defaultValueConverter; | |||
private final JdbcConfiguration jdbcConfig; |
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.
why is this new instance variable required ?
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.
This is required as we access the hostname using jdbcConfig.hostname()
in the helper methods of this class.
@@ -2860,6 +2860,39 @@ public void shouldOutputRecordsInCloudEventsFormat() throws Exception { | |||
} | |||
} | |||
|
|||
// YB Note: Running this test also requires a change of values in the method TestHelper#defaultJdbcConfig |
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.
Could add a comment here that this test is for manual testing.
Also instructions on what to do and when
Problem
The Debezium connector for Postgres uses a single host model where the JDBC driver connects to a PG instance and continues execution. However, when we move to YugabyteDB where we have a multi node deployment, the current model can fail in case the node it has connected to goes down.
Solution
To address that, we have made changes in this PR and replaced the Postgres JDBC driver with YugabyteDB smart driver which allows us to specify multiple hosts in the JDBC url so that the connector does not fail or run into any fatal error while maintaining the High Availability aspect of YugabyteDB.
Changes in this PR include:
pom.xml
from2.5.2.Final
to2.5.2.ybpg.20241-SNAPSHOT
a. This is done to ensure that upon image compilation, the changed code from Debezium Code is picked up.
org.postgresql.*
tocom.yugabyte.*
to comply with the new JDBC driver.: (colon)
in the configuration propertydatabase.hostname