-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-8501 Support for JDBC offset and schema history stores
- Loading branch information
Showing
10 changed files
with
692 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
84 changes: 84 additions & 0 deletions
84
...m-operator-api/src/main/java/io/debezium/operator/api/model/source/storage/JdbcStore.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.api.model.source.storage; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
|
||
import io.debezium.operator.api.config.ConfigMapping; | ||
import io.debezium.operator.api.model.DebeziumServer; | ||
|
||
public class JdbcStore extends AbstractStore { | ||
public static final String CONFIG_PREFIX = "jdbc"; | ||
|
||
@JsonPropertyDescription("JDBC connection URL") | ||
private String url; | ||
|
||
@JsonPropertyDescription("Username used to connect to the storage database") | ||
private String user; | ||
|
||
@JsonPropertyDescription("Password used to connect to the storage database") | ||
private String password; | ||
|
||
@JsonPropertyDescription("Retry delay on connection failure (in milliseconds)") | ||
private long retryDelay; | ||
|
||
@JsonPropertyDescription("Maximum number of retries on connection failure") | ||
private int maxRetries; | ||
|
||
public JdbcStore(String type) { | ||
super(CONFIG_PREFIX, type); | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(String user) { | ||
this.user = user; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public long getRetryDelay() { | ||
return retryDelay; | ||
} | ||
|
||
public void setRetryDelay(long retryDelay) { | ||
this.retryDelay = retryDelay; | ||
} | ||
|
||
public int getMaxRetries() { | ||
return maxRetries; | ||
} | ||
|
||
public void setMaxRetries(int maxRetries) { | ||
this.maxRetries = maxRetries; | ||
} | ||
|
||
@Override | ||
protected ConfigMapping<DebeziumServer> typeConfiguration(DebeziumServer primary) { | ||
return super.typeConfiguration(primary) | ||
.put("url", url) | ||
.put("user", user) | ||
.put("password", password) | ||
.put("wait.retry.delay.ms", retryDelay) | ||
.put("retry.max.attempts", maxRetries); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...i/src/main/java/io/debezium/operator/api/model/source/storage/offset/JdbcOffsetStore.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.api.model.source.storage.offset; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
|
||
import io.debezium.operator.api.config.ConfigMapping; | ||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.api.model.source.storage.JdbcStore; | ||
import io.debezium.operator.docs.annotations.Documented; | ||
import io.sundr.builder.annotations.Buildable; | ||
|
||
@Documented | ||
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", lazyCollectionInitEnabled = false) | ||
public class JdbcOffsetStore extends JdbcStore { | ||
|
||
public static final String TYPE = "io.debezium.storage.jdbc.offset.JdbcOffsetBackingStore"; | ||
|
||
@JsonPropertyDescription("The configuration of the offset table") | ||
private JdbcOffsetTableConfig table = new JdbcOffsetTableConfig(); | ||
|
||
public JdbcOffsetStore() { | ||
super(TYPE); | ||
} | ||
|
||
public JdbcOffsetTableConfig getTable() { | ||
return table; | ||
} | ||
|
||
public void setTable(JdbcOffsetTableConfig table) { | ||
this.table = table; | ||
} | ||
|
||
@Override | ||
protected ConfigMapping<DebeziumServer> typeConfiguration(DebeziumServer primary) { | ||
return super.typeConfiguration(primary) | ||
.putAll("table", table); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...main/java/io/debezium/operator/api/model/source/storage/offset/JdbcOffsetTableConfig.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.api.model.source.storage.offset; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
|
||
import io.debezium.operator.api.config.ConfigMappable; | ||
import io.debezium.operator.api.config.ConfigMapping; | ||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.docs.annotations.Documented; | ||
import io.sundr.builder.annotations.Buildable; | ||
|
||
@Documented | ||
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", lazyCollectionInitEnabled = false) | ||
public class JdbcOffsetTableConfig implements ConfigMappable<DebeziumServer> { | ||
|
||
@JsonPropertyDescription("The name of the offset table") | ||
@JsonProperty(required = false) | ||
private String name; | ||
|
||
@JsonPropertyDescription("DDL statement to create the offset table") | ||
@JsonProperty(required = false) | ||
private String ddl; | ||
|
||
@JsonPropertyDescription("Statement used to select from the offset table") | ||
@JsonProperty(required = false) | ||
private String select; | ||
|
||
@JsonPropertyDescription("Statement used to insert into the offset table") | ||
@JsonProperty(required = false) | ||
private String insert; | ||
|
||
@JsonPropertyDescription("Statement used to update the offset table") | ||
@JsonProperty(required = false) | ||
private String delete; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDdl() { | ||
return ddl; | ||
} | ||
|
||
public void setDdl(String ddl) { | ||
this.ddl = ddl; | ||
} | ||
|
||
public String getSelect() { | ||
return select; | ||
} | ||
|
||
public void setSelect(String select) { | ||
this.select = select; | ||
} | ||
|
||
public String getInsert() { | ||
return insert; | ||
} | ||
|
||
public void setInsert(String insert) { | ||
this.insert = insert; | ||
} | ||
|
||
public String getDelete() { | ||
return delete; | ||
} | ||
|
||
public void setDelete(String delete) { | ||
this.delete = delete; | ||
} | ||
|
||
@Override | ||
public ConfigMapping<DebeziumServer> asConfiguration(DebeziumServer primary) { | ||
return ConfigMapping.empty(primary) | ||
.put("name", name) | ||
.put("ddl", ddl) | ||
.put("select", select) | ||
.put("insert", insert) | ||
.put("delete", delete); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...ain/java/io/debezium/operator/api/model/source/storage/schema/JdbcSchemaHistoryStore.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.api.model.source.storage.schema; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
|
||
import io.debezium.operator.api.config.ConfigMapping; | ||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.api.model.source.storage.JdbcStore; | ||
import io.debezium.operator.docs.annotations.Documented; | ||
import io.sundr.builder.annotations.Buildable; | ||
|
||
@Documented | ||
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", lazyCollectionInitEnabled = false) | ||
public class JdbcSchemaHistoryStore extends JdbcStore { | ||
|
||
public static final String TYPE = "io.debezium.storage.jdbc.history.JdbcSchemaHistory"; | ||
|
||
@JsonPropertyDescription("The configuration of the offset table") | ||
private JdbcSchemaHistoryTableConfig table = new JdbcSchemaHistoryTableConfig(); | ||
|
||
public JdbcSchemaHistoryStore() { | ||
super(TYPE); | ||
} | ||
|
||
public JdbcSchemaHistoryTableConfig getTable() { | ||
return table; | ||
} | ||
|
||
public void setTable(JdbcSchemaHistoryTableConfig table) { | ||
this.table = table; | ||
} | ||
|
||
@Override | ||
protected ConfigMapping<DebeziumServer> typeConfiguration(DebeziumServer primary) { | ||
return super.typeConfiguration(primary) | ||
.putAll("table", table); | ||
} | ||
} |
Oops, something went wrong.