DBZ-585 Renaming 'initial_schema_only' snapshot mode for Oracle into 'schema_only'
This commit is contained in:
parent
1d3a7760a3
commit
5e490d4394
@ -14,6 +14,7 @@
|
||||
import io.debezium.config.Configuration;
|
||||
import io.debezium.config.EnumeratedValue;
|
||||
import io.debezium.config.Field;
|
||||
import io.debezium.config.Field.ValidationOutput;
|
||||
import io.debezium.connector.AbstractSourceInfo;
|
||||
import io.debezium.connector.SourceInfoStructMaker;
|
||||
import io.debezium.document.Document;
|
||||
@ -66,12 +67,13 @@ public class OracleConnectorConfig extends HistorizedRelationalDatabaseConnector
|
||||
public static final Field SNAPSHOT_MODE = Field.create("snapshot.mode")
|
||||
.withDisplayName("Snapshot mode")
|
||||
.withEnum(SnapshotMode.class, SnapshotMode.INITIAL)
|
||||
.withValidation(OracleConnectorConfig::validateSnapshotMode)
|
||||
.withWidth(Width.SHORT)
|
||||
.withImportance(Importance.LOW)
|
||||
.withDescription("The criteria for running a snapshot upon startup of the connector. "
|
||||
+ "Options include: "
|
||||
+ "'initial' (the default) to specify the connector should run a snapshot only when no offsets are available for the logical server name; "
|
||||
+ "'initial_schema_only' to specify the connector should run a snapshot of the schema when no offsets are available for the logical server name. ");
|
||||
+ "'schema_only' to specify the connector should run a snapshot of the schema when no offsets are available for the logical server name. ");
|
||||
|
||||
public static final Field TABLENAME_CASE_INSENSITIVE = Field.create("database.tablename.case.insensitive")
|
||||
.withDisplayName("Case insensitive table names")
|
||||
@ -255,8 +257,16 @@ public static enum SnapshotMode implements EnumeratedValue {
|
||||
|
||||
/**
|
||||
* Perform a snapshot of the schema but no data upon initial startup of a connector.
|
||||
*
|
||||
* @deprecated to be removed in 1.1; use {@link #INITIAL_SCHEMA} instead.
|
||||
*/
|
||||
INITIAL_SCHEMA_ONLY("initial_schema_only", false);
|
||||
@Deprecated
|
||||
INITIAL_SCHEMA_ONLY("initial_schema_only", false),
|
||||
|
||||
/**
|
||||
* Perform a snapshot of the schema but no data upon initial startup of a connector.
|
||||
*/
|
||||
SCHEMA_ONLY("schema_only", false);
|
||||
|
||||
private final String value;
|
||||
private final boolean includeData;
|
||||
@ -357,4 +367,25 @@ protected SourceInfoStructMaker<? extends AbstractSourceInfo> getSourceInfoStruc
|
||||
public String getContextName() {
|
||||
return Module.contextName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the time.precision.mode configuration.
|
||||
*
|
||||
* If {@code adaptive} is specified, this option has the potential to cause overflow which is why the
|
||||
* option was deprecated and no longer supported for this connector.
|
||||
*/
|
||||
private static int validateSnapshotMode(Configuration config, Field field, ValidationOutput problems) {
|
||||
if (config.hasKey(SNAPSHOT_MODE.name())) {
|
||||
final String snapshotMode = config.getString(SNAPSHOT_MODE.name());
|
||||
if (SnapshotMode.INITIAL_SCHEMA_ONLY.value.equals(snapshotMode)) {
|
||||
// this will be logged as ERROR, but returning 0 doesn't prevent start-up
|
||||
problems.accept(SNAPSHOT_MODE, snapshotMode,
|
||||
"The 'initial_schema_only' snapshot.mode is no longer supported and will be removed in a future revision. Use 'schema_only' instead.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Everything checks out ok.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ public void shouldStreamAfterRestartAfterSnapshot() throws Exception {
|
||||
public void shouldReadChangeStreamForExistingTable() throws Exception {
|
||||
Configuration config = TestHelper.defaultConfig()
|
||||
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL_SCHEMA_ONLY)
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
|
||||
.build();
|
||||
|
||||
start(OracleConnector.class, config);
|
||||
@ -460,7 +460,7 @@ public void shouldReadChangeStreamForExistingTable() throws Exception {
|
||||
public void deleteWithoutTombstone() throws Exception {
|
||||
Configuration config = TestHelper.defaultConfig()
|
||||
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL_SCHEMA_ONLY)
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
|
||||
.with(OracleConnectorConfig.TOMBSTONES_ON_DELETE, false)
|
||||
.build();
|
||||
|
||||
|
@ -36,7 +36,7 @@ public void before() throws Exception {
|
||||
|
||||
Configuration config = TestHelper.defaultConfig()
|
||||
.with(OracleConnectorConfig.TABLE_WHITELIST, whitelistedTables)
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL_SCHEMA_ONLY)
|
||||
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
|
||||
.build();
|
||||
|
||||
start(OracleConnector.class, config);
|
||||
|
Loading…
Reference in New Issue
Block a user