Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-35700][cli] Loosen CDC pipeline options validation #3435

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@
package org.apache.flink.cdc.composer.definition;

import org.apache.flink.cdc.common.annotation.VisibleForTesting;
import org.apache.flink.cdc.common.configuration.ConfigOption;
import org.apache.flink.cdc.common.configuration.Configuration;
import org.apache.flink.cdc.common.pipeline.PipelineOptions;
import org.apache.flink.cdc.common.types.LocalZonedTimestampType;
import org.apache.flink.cdc.composer.PipelineComposer;
import org.apache.flink.cdc.composer.PipelineExecution;
import org.apache.flink.table.api.ValidationException;

import java.time.ZoneId;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.stream.Collectors;

import static org.apache.flink.cdc.common.pipeline.PipelineOptions.PIPELINE_LOCAL_TIME_ZONE;

Expand Down Expand Up @@ -73,8 +67,6 @@ public PipelineDef(
this.routes = routes;
this.transforms = transforms;
this.config = evaluatePipelineTimeZone(config);

validatePipelineDefinition(this.config);
}

public SourceDef getSource() {
Expand Down Expand Up @@ -138,43 +130,6 @@ public int hashCode() {
// Utilities
// ------------------------------------------------------------------------

@VisibleForTesting
public static void validatePipelineDefinition(Configuration configuration)
throws ValidationException {
List<ConfigOption<?>> options =
Arrays.asList(
PipelineOptions.PIPELINE_NAME,
PipelineOptions.PIPELINE_PARALLELISM,
PipelineOptions.PIPELINE_SCHEMA_CHANGE_BEHAVIOR,
PipelineOptions.PIPELINE_LOCAL_TIME_ZONE,
PipelineOptions.PIPELINE_SCHEMA_OPERATOR_UID,
PipelineOptions.PIPELINE_SCHEMA_OPERATOR_RPC_TIMEOUT);

Set<String> optionKeys =
options.stream().map(ConfigOption::key).collect(Collectors.toSet());

configuration
.getKeys()
.forEach(
key -> {
if (!optionKeys.contains(key)) {
throw new ValidationException(
String.format("Unknown configuration key `%s`", key));
}
});

options.forEach(
option -> {
if (!configuration.getOptional(option).isPresent()
&& !option.hasDefaultValue()) {
throw new ValidationException(
String.format(
"Configuration key `%s` is not specified, and no default value available.",
option.key()));
}
});
}

/**
* Returns the current session time zone id. It is used when converting to/from {@code TIMESTAMP
* WITH LOCAL TIME ZONE}.
Expand Down

This file was deleted.

Loading