Skip to content

Commit

Permalink
[core] Remove duplicate ConfigOption.withDeprecatedKeys (apache#3785)
Browse files Browse the repository at this point in the history
  • Loading branch information
JingsongLi authored Jul 24, 2024
1 parent 6f4aa51 commit d94392b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 32 deletions.
12 changes: 6 additions & 6 deletions paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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<String> SCAN_TIMESTAMP =
Expand All @@ -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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,6 @@ public ConfigOption<T> 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.
*
* <p>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<T> withDeprecatedKeys(String... deprecatedKeys) {
final Stream<FallbackKey> newDeprecatedKeys =
Arrays.stream(deprecatedKeys).map(FallbackKey::createDeprecatedKey);
final Stream<FallbackKey> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ 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.");

public static final ConfigOption<String> KERBEROS_LOGIN_PRINCIPAL =
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<Boolean> KERBEROS_LOGIN_USETICKETCACHE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d94392b

Please sign in to comment.