-
Notifications
You must be signed in to change notification settings - Fork 4
CDAP-17583 Use instance id for app name and store in-memory offset un… #154
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
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 |
|---|---|---|
|
|
@@ -49,7 +49,6 @@ | |
| import java.time.temporal.Temporal; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.Executors; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
@@ -99,6 +98,7 @@ public void start(Offset offset) { | |
| Collectors.toMap(t -> config.getDatabase() + "." + t.getTable(), t -> t)); | ||
| Map<String, String> state = offset.get(); // state map is always not null | ||
| String isSnapshot = state.getOrDefault(MySqlConstantOffsetBackingStore.SNAPSHOT, ""); | ||
| String replicationConnectorName = "delta" + context.getInstanceId(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit : "delta-" ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since its internal name it is ok to keep it like the way we have. Also some properties from debezium don't accept special chars like |
||
| Configuration.Builder configBuilder = Configuration.create() | ||
| .with("connector.class", MySqlConnector.class.getName()) | ||
| .with("offset.storage", MySqlConstantOffsetBackingStore.class.getName()) | ||
|
|
@@ -111,7 +111,7 @@ public void start(Offset offset) { | |
| .with("event", state.getOrDefault(MySqlConstantOffsetBackingStore.EVENT, "")) | ||
| .with("gtids", state.getOrDefault(MySqlConstantOffsetBackingStore.GTID_SET, "")) | ||
| /* begin connector properties */ | ||
| .with("name", "delta" + UUID.randomUUID().toString().replace("-", "")) | ||
| .with("name", replicationConnectorName) | ||
| .with("database.hostname", config.getHost()) | ||
| .with("database.port", config.getPort()) | ||
| .with("database.user", config.getUser()) | ||
|
|
@@ -121,7 +121,8 @@ public void start(Offset offset) { | |
| .with("database.server.name", "dummy") // this is the kafka topic for hosted debezium - it doesn't matter | ||
| .with("database.serverTimezone", config.getServerTimezone()) | ||
| .with("table.whitelist", String.join(",", sourceTableMap.keySet())) | ||
| .with("snapshot.mode", config.getReplicateExistingData() ? "initial" : "schema_only"); | ||
| .with("snapshot.mode", config.getReplicateExistingData() ? "initial" : "schema_only") | ||
| .with(MySqlConstantOffsetBackingStore.REPLICATION_CONNECTOR_NAME, replicationConnectorName);; | ||
|
|
||
| if (config.getConsumerID() != null) { | ||
| // If not provided debezium will randomly pick integer between 5400 and 6400. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ | |
| import java.util.HashSet; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.Executors; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
@@ -107,6 +106,7 @@ public void start(Offset offset) { | |
| Map<String, String> state = offset.get(); // this will never be null | ||
| // offset config | ||
| String isSnapshotCompleted = state.getOrDefault(SqlServerConstantOffsetBackingStore.SNAPSHOT_COMPLETED, ""); | ||
| String replicationConnectorName = "delta" + context.getInstanceId(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: "delta-" ? |
||
| Configuration.Builder configBuilder = Configuration.create() | ||
| .with("connector.class", SqlServerConnector.class.getName()) | ||
| .with("offset.storage", SqlServerConstantOffsetBackingStore.class.getName()) | ||
|
|
@@ -117,7 +117,7 @@ public void start(Offset offset) { | |
| .with("snapshot", state.getOrDefault(SourceInfo.SNAPSHOT_KEY, "")) | ||
| .with("snapshot_completed", isSnapshotCompleted) | ||
| /* begin connector properties */ | ||
| .with("name", "delta" + UUID.randomUUID().toString().replace("-", "")) | ||
| .with("name", replicationConnectorName) | ||
| .with("database.hostname", config.getHost()) | ||
| .with("database.port", config.getPort()) | ||
| .with("database.user", config.getUser()) | ||
|
|
@@ -127,7 +127,8 @@ public void start(Offset offset) { | |
| .with("table.whitelist", String.join(",", sourceTableMap.keySet())) | ||
| .with("database.server.name", "dummy") // this is the kafka topic for hosted debezium - it doesn't matter | ||
| .with("database.serverTimezone", config.getServerTimezone()) | ||
| .with("snapshot.mode", config.getReplicateExistingData() ? "initial" : "schema_only"); | ||
| .with("snapshot.mode", config.getReplicateExistingData() ? "initial" : "schema_only") | ||
| .with(SqlServerConstantOffsetBackingStore.REPLICATION_CONNECTOR_NAME, replicationConnectorName); | ||
|
|
||
| LOG.info("Overriding sql server connector configs with arguments {}", debeziumConnectorConfigs); | ||
| for (Map.Entry<String, String> entry: debeziumConnectorConfigs.entrySet()) { | ||
|
|
||
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.
good catch