Skip to content

[FLINK-40237][cep] Clean up expired NFA state in processing-time timers#28822

Open
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_40237
Open

[FLINK-40237][cep] Clean up expired NFA state in processing-time timers#28822
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_40237

Conversation

@Dream95

@Dream95 Dream95 commented Jul 26, 2026

Copy link
Copy Markdown

What is the purpose of the change

(For example: This pull request makes task deployment go through the blob server, rather than through RPC. That way we avoid re-transferring them on each deployment (during recovery).)

This is a follow-up to FLINK-32701. CepOperator already cleans up dangling NFA state in onEventTime(), but the equivalent cleanup was missing from onProcessingTime(). As a result, after patterns expire under processing time, computationStates could retain only the initial partial match and never be cleared. This PR applies the same cleanup logic in the processing-time timer path.

Brief change log

  • Clear computationStates in onProcessingTime() when only the initial partial match remains and there are no completed matches
  • Add @VisibleForTesting helper hasNonEmptyNFAState(KEY) to inspect per-key NFA state
  • Add testCEPOperatorClearsExpiredNFAStateInProcessingTime to verify expired NFA state is removed after the processing-time timer fires

Verifying this change

  • Added CEPOperatorTest#testCEPOperatorClearsExpiredNFAStateInProcessingTime, which processes a start event under processing time, asserts NFA state is present, advances processing time past the pattern timeout, and asserts NFA state is cleared

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? ( no)
  • If yes, how is the feature documented? (not applicable)

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

@flinkbot

flinkbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants