Skip to content

[FLINK-40552][runtime] Support asynchronous transform execution - #4526

Open
haruki-830 wants to merge 1 commit into
apache:masterfrom
haruki-830:FLINK-40552
Open

[FLINK-40552][runtime] Support asynchronous transform execution#4526
haruki-830 wants to merge 1 commit into
apache:masterfrom
haruki-830:FLINK-40552

Conversation

@haruki-830

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

JIRA: https://issues.apache.org/jira/browse/FLINK-40552

This PR introduces opt-in ordered asynchronous execution for post-transform processing. It improves the throughput of I/O-bound transform expressions, such as AI model calls, while preserving CDC event ordering and schema consistency.

Brief change log

  • Extract the common post-transform logic into PostTransformProcessor for both synchronous and asynchronous execution.
  • Add asynchronous execution options for enablement, timeout, capacity, and worker threads.
  • Use ordered asynchronous waiting so that DataChangeEvents can execute concurrently while outputs remain ordered.
  • Treat SchemaChangeEvents as barriers to preserve schema/data ordering.
  • Preserve schema state across checkpoints and same-parallelism savepoints.
  • Emit the restored CreateTableEvent only once before subsequent data events.
  • Add compatibility adapters for both Flink 1.x and Flink 2.x.
  • Document asynchronous execution options and thread-safety requirements.

Verifying this change

This change added unit tests covering:

  • Concurrent execution and ordered output of data change events.
  • Schema change barriers and schema/data ordering.
  • Timeout and transform exception propagation.
  • Checkpoint restoration.
  • Same-parallelism savepoint restoration.
  • Exactly-once emission of the restored CreateTableEvent.
  • Selection of the asynchronous post-transform operator by the composer.

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? docs and JavaDocs

Was generative AI tooling used to co-author this PR?
  • Yes — OpenAI Codex (GPT-5)

Generated-by: OpenAI Codex (GPT-5)

@github-actions github-actions Bot added docs Improvements or additions to documentation composer common runtime labels Sep 7, 2026
@haruki-830
haruki-830 marked this pull request as ready for review September 8, 2026 02:16
@leonardBang
leonardBang requested a review from yuxiqian September 9, 2026 02:39

@yuxiqian yuxiqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Haruki for the contribution!

Could you please add IT / E2e cases to cover this feature? Currently there are merely 2 unit tests. For simplicity we may make current transform e2e cases parameterized.

Comment on lines +459 to +468
private static void drainMailbox(OneInputStreamOperatorTestHarness<Event, Event> harness)
throws Exception {
while (true) {
Mail mail = harness.getTaskMailbox().tryTake(TaskMailbox.MIN_PRIORITY).orElse(null);
if (mail == null) {
return;
}
mail.run();
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case seems too low-level and artificial. Replacing it with some IT cases might work better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common composer docs Improvements or additions to documentation runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants