From d94392b82b9136fba2ac70e8f3027353b85143b2 Mon Sep 17 00:00:00 2001 From: Jingsong Lee Date: Wed, 24 Jul 2024 18:17:59 +0800 Subject: [PATCH] [core] Remove duplicate ConfigOption.withDeprecatedKeys (#3785) --- .../java/org/apache/paimon/CoreOptions.java | 12 +++++----- .../apache/paimon/options/ConfigOption.java | 23 ------------------- .../security/SecurityConfiguration.java | 4 ++-- .../paimon/flink/FlinkConnectorOptions.java | 2 +- 4 files changed, 9 insertions(+), 32 deletions(-) diff --git a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java index b368b483a47f..ade36f2959c8 100644 --- a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java +++ b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java @@ -286,7 +286,7 @@ public class CoreOptions implements Serializable { key("snapshot.clean-empty-directories") .booleanType() .defaultValue(false) - .withDeprecatedKeys("snapshot.expire.clean-empty-directories") + .withFallbackKeys("snapshot.expire.clean-empty-directories") .withDescription( Description.builder() .text( @@ -322,7 +322,7 @@ public class CoreOptions implements Serializable { key("ignore-delete") .booleanType() .defaultValue(false) - .withDeprecatedKeys( + .withFallbackKeys( "first-row.ignore-delete", "deduplicate.ignore-delete", "partial-update.ignore-delete") @@ -359,7 +359,7 @@ public class CoreOptions implements Serializable { key("write-only") .booleanType() .defaultValue(false) - .withDeprecatedKeys("write.compaction-skip") + .withFallbackKeys("write.compaction-skip") .withDescription( "If set to true, compactions and snapshot expiration will be skipped. " + "This option is used along with dedicated compact jobs."); @@ -522,7 +522,7 @@ public class CoreOptions implements Serializable { key("compaction.max.file-num") .intType() .defaultValue(50) - .withDeprecatedKeys("compaction.early-max.file-num") + .withFallbackKeys("compaction.early-max.file-num") .withDescription( "For file set [f_0,...,f_N], the maximum file number to trigger a compaction " + "for append-only table, even if sum(size(f_i)) < targetFileSize. This value " @@ -574,7 +574,7 @@ public class CoreOptions implements Serializable { key("scan.mode") .enumType(StartupMode.class) .defaultValue(StartupMode.DEFAULT) - .withDeprecatedKeys("log.scan") + .withFallbackKeys("log.scan") .withDescription("Specify the scanning behavior of the source."); public static final ConfigOption SCAN_TIMESTAMP = @@ -588,7 +588,7 @@ public class CoreOptions implements Serializable { key("scan.timestamp-millis") .longType() .noDefaultValue() - .withDeprecatedKeys("log.scan.timestamp-millis") + .withFallbackKeys("log.scan.timestamp-millis") .withDescription( "Optional timestamp used in case of \"from-timestamp\" scan mode. " + "If there is no snapshot earlier than this time, the earliest snapshot will be chosen."); diff --git a/paimon-common/src/main/java/org/apache/paimon/options/ConfigOption.java b/paimon-common/src/main/java/org/apache/paimon/options/ConfigOption.java index fd7259bcec65..fb7fce153575 100644 --- a/paimon-common/src/main/java/org/apache/paimon/options/ConfigOption.java +++ b/paimon-common/src/main/java/org/apache/paimon/options/ConfigOption.java @@ -126,29 +126,6 @@ public ConfigOption withFallbackKeys(String... fallbackKeys) { return new ConfigOption<>(key, clazz, description, defaultValue, mergedAlternativeKeys); } - /** - * Creates a new config option, using this option's key and default value, and adding the given - * deprecated keys. - * - *

When obtaining a value from the configuration via {@link Options#get(ConfigOption)}, the - * deprecated keys will be checked in the order provided to this method. The first key for which - * a value is found will be used - that value will be returned. - * - * @param deprecatedKeys The deprecated keys, in the order in which they should be checked. - * @return A new config options, with the given deprecated keys. - */ - public ConfigOption withDeprecatedKeys(String... deprecatedKeys) { - final Stream newDeprecatedKeys = - Arrays.stream(deprecatedKeys).map(FallbackKey::createDeprecatedKey); - final Stream currentAlternativeKeys = Arrays.stream(this.fallbackKeys); - - // put deprecated keys last so that they are de-prioritized - final FallbackKey[] mergedAlternativeKeys = - Stream.concat(currentAlternativeKeys, newDeprecatedKeys) - .toArray(FallbackKey[]::new); - return new ConfigOption<>(key, clazz, description, defaultValue, mergedAlternativeKeys); - } - /** * Creates a new config option, using this option's key and default value, and adding the given * description. The given description is used when generation the configuration documentation. diff --git a/paimon-common/src/main/java/org/apache/paimon/security/SecurityConfiguration.java b/paimon-common/src/main/java/org/apache/paimon/security/SecurityConfiguration.java index aa1b4978ce09..13f9a841ffab 100644 --- a/paimon-common/src/main/java/org/apache/paimon/security/SecurityConfiguration.java +++ b/paimon-common/src/main/java/org/apache/paimon/security/SecurityConfiguration.java @@ -34,7 +34,7 @@ public class SecurityConfiguration { key("security.kerberos.login.keytab") .stringType() .noDefaultValue() - .withDeprecatedKeys("security.keytab") + .withFallbackKeys("security.keytab") .withDescription( "Absolute path to a Kerberos keytab file that contains the user credentials."); @@ -42,7 +42,7 @@ public class SecurityConfiguration { key("security.kerberos.login.principal") .stringType() .noDefaultValue() - .withDeprecatedKeys("security.principal") + .withFallbackKeys("security.principal") .withDescription("Kerberos principal name associated with the keytab."); public static final ConfigOption KERBEROS_LOGIN_USETICKETCACHE = diff --git a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkConnectorOptions.java b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkConnectorOptions.java index b42de765eef3..57f33773995a 100644 --- a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkConnectorOptions.java +++ b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/FlinkConnectorOptions.java @@ -211,7 +211,7 @@ public class FlinkConnectorOptions { key("scan.remove-normalize") .booleanType() .defaultValue(false) - .withDeprecatedKeys("log.scan.remove-normalize") + .withFallbackKeys("log.scan.remove-normalize") .withDescription( "Whether to force the removal of the normalize node when streaming read." + " Note: This is dangerous and is likely to cause data errors if downstream"