DBZ-5936 Remove separate config option

This commit is contained in:
Jiri Pechanec 2022-12-20 07:48:47 +01:00
parent 4cada81661
commit fff4719fb1
3 changed files with 11 additions and 30 deletions

View File

@ -473,8 +473,6 @@ public static SchemaRefreshMode parse(String value) {
public static final Field PORT = RelationalDatabaseConnectorConfig.PORT
.withDefault(DEFAULT_PORT);
public static final String DEFAULT_UNAVAILABLE_NUMBER_ARRAY_PLACEHOLDER = "28694827,62948267,94852637,62847362,94837264,73486259,29483726,43827619,84692735,29873462";
public static final Field PLUGIN_NAME = Field.create("plugin.name")
.withDisplayName("Plugin")
.withGroup(Field.createGroupEntry(Field.Group.CONNECTION_ADVANCED_REPLICATION, 0))
@ -835,16 +833,6 @@ public static AutoCreateMode parse(String value, String defaultValue) {
"the original value is a toasted value not provided by the database. " +
"If starts with 'hex:' prefix it is expected that the rest of the string represents hexadecimal encoded octets.");
public static final Field UNAVAILABLE_NUMBER_ARRAY_PLACEHOLDER = Field.create("unavailable.number.array.placeholder")
.withDisplayName("Unavailable number array placeholder")
.withType(Type.STRING)
.withGroup(Field.createGroupEntry(Field.Group.CONNECTOR_ADVANCED, 20))
.withWidth(Width.MEDIUM)
.withDefault(DEFAULT_UNAVAILABLE_NUMBER_ARRAY_PLACEHOLDER)
.withImportance(Importance.MEDIUM)
.withDescription("Specify the numbers separated by comma that will be provided by Debezium to indicate that " +
"the original value is int/bigint array and not provided by the database.");
public static final Field MONEY_FRACTION_DIGITS = Field.create("money.fraction.digits")
.withDisplayName("Money fraction digits")
.withType(Type.SHORT)
@ -988,10 +976,6 @@ public byte[] getUnavailableValuePlaceholder() {
return placeholder.getBytes();
}
public String getUnavailableNumberArrayPlaceholder() {
return getConfig().getString(UNAVAILABLE_NUMBER_ARRAY_PLACEHOLDER);
}
protected int moneyFractionDigits() {
return getConfig().getInteger(MONEY_FRACTION_DIGITS);
}

View File

@ -5,12 +5,12 @@
*/
package io.debezium.connector.postgresql;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class UnchangedToastedPlaceholder {
@ -19,22 +19,19 @@ public class UnchangedToastedPlaceholder {
private final String toastPlaceholderString;
public UnchangedToastedPlaceholder(PostgresConnectorConfig connectorConfig) {
String toastPlaceholderNumberArrayString = connectorConfig.getUnavailableNumberArrayPlaceholder();
toastPlaceholderBinary = connectorConfig.getUnavailableValuePlaceholder();
toastPlaceholderString = new String(toastPlaceholderBinary);
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_TOAST_VALUE, toastPlaceholderString);
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_TEXT_ARRAY_TOAST_VALUE,
Arrays.asList(toastPlaceholderString));
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_INT_ARRAY_TOAST_VALUE,
Stream.of(toastPlaceholderNumberArrayString.split(","))
.map(String::trim)
.map(Integer::parseInt)
.collect(Collectors.toList()));
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_BIGINT_ARRAY_TOAST_VALUE,
Stream.of(toastPlaceholderNumberArrayString.split(","))
.map(String::trim)
.map(Long::parseLong)
.collect(Collectors.toList()));
final List<Integer> toastedIntArrayPlaceholder = new ArrayList<>(toastPlaceholderBinary.length);
final List<Long> toastedLongArrayPlaceholder = new ArrayList<>(toastPlaceholderBinary.length);
for (byte b : toastPlaceholderBinary) {
toastedIntArrayPlaceholder.add((int) b);
toastedLongArrayPlaceholder.add((long) b);
}
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_INT_ARRAY_TOAST_VALUE, toastedIntArrayPlaceholder);
placeholderValues.put(UnchangedToastedReplicationMessageColumn.UNCHANGED_BIGINT_ARRAY_TOAST_VALUE, toastedLongArrayPlaceholder);
}
public Optional<Object> getValue(Object obj) {

View File

@ -18,7 +18,7 @@
*/
public class DecoderDifferences {
static final String TOASTED_VALUE_PLACEHOLDER = "__debezium_unavailable_value";
static final String TOASTED_VALUE_NUMBER_STRING = "28694827,62948267,94852637,62847362,94837264,73486259,29483726,43827619,84692735,29873462";
static final String TOASTED_VALUE_NUMBER_STRING = "95, 95, 100, 101, 98, 101, 122, 105, 117, 109, 95, 117, 110, 97, 118, 97, 105, 108, 97, 98, 108, 101, 95, 118, 97, 108, 117, 101";
private static boolean pgoutput() {
return TestHelper.decoderPlugin() == PostgresConnectorConfig.LogicalDecoder.PGOUTPUT;