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-35257][cdc-runtime]when schema.change.behavior is exception,… #3795

Closed
wants to merge 1 commit into from
Closed
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 @@ -31,7 +31,6 @@
import org.apache.flink.cdc.common.event.Event;
import org.apache.flink.cdc.common.event.FlushEvent;
import org.apache.flink.cdc.common.event.SchemaChangeEvent;
import org.apache.flink.cdc.common.event.SchemaChangeEventType;
import org.apache.flink.cdc.common.event.TableId;
import org.apache.flink.cdc.common.pipeline.SchemaChangeBehavior;
import org.apache.flink.cdc.common.route.RouteRule;
Expand Down Expand Up @@ -433,15 +432,6 @@ private TableId resolveReplacement(
private void handleSchemaChangeEvent(TableId tableId, SchemaChangeEvent schemaChangeEvent)
throws InterruptedException, TimeoutException {

if (schemaChangeBehavior == SchemaChangeBehavior.EXCEPTION
&& schemaChangeEvent.getType() != SchemaChangeEventType.CREATE_TABLE) {
// CreateTableEvent should be applied even in EXCEPTION mode
throw new RuntimeException(
String.format(
"Refused to apply schema change event %s in EXCEPTION mode.",
schemaChangeEvent));
}

// The request will block if another schema change event is being handled
SchemaChangeResponse response = requestSchemaChange(tableId, schemaChangeEvent);
if (response.isAccepted()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ private void applySchemaChange(
TableId tableId, List<SchemaChangeEvent> derivedSchemaChangeEvents) {
for (SchemaChangeEvent changeEvent : derivedSchemaChangeEvents) {
if (changeEvent.getType() != SchemaChangeEventType.CREATE_TABLE) {
if (schemaChangeBehavior == SchemaChangeBehavior.EXCEPTION) {
// throw exception after all sink flush success
throw new RuntimeException(
String.format(
"Refused to apply schema change event %s in EXCEPTION mode.",
changeEvent));
}
if (schemaChangeBehavior == SchemaChangeBehavior.IGNORE) {
currentIgnoredSchemaChanges.add(changeEvent);
continue;
Expand Down
Loading