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-35047][state] Shutdown StateExecutors when ForStKeyedStateBackend is closed #24768

Closed
wants to merge 1 commit into from

Conversation

ljz2051
Copy link
Contributor

@ljz2051 ljz2051 commented May 10, 2024

What is the purpose of the change

This pull request shuts down the ForStStateExecutors when ForStKeyedStateBackend is disposed.

Brief change log

  • Shutdown the StateExecutors in ForStKeyedStateBackend.

Verifying this change

This change is already covered by existing tests, such as ForStStateBackendConfigTest and AsyncExecutionControllerTest.

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

@flinkbot
Copy link
Collaborator

flinkbot commented May 10, 2024

CI report:

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

Copy link

@jectpro7 jectpro7 left a comment

Choose a reason for hiding this comment

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

LGTM

return;
}
disposed = true;
for (StateExecutor executor : managedStateExecutors) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this for-loop be placed outside the lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the current implementation, it is indeed doable. However, I think that enclosing both disposed and managedStateExecutors within the protective scope of the lock constitutes a more safe practice. Additionally, the chance of a lock conflict between createStateExecutor() and dispose() is very minimal, so the impact in this place is virtually imperceptible.

So I prefer to put this for-loop of managedStateExecutors inside the lock scope.

WDYT?

Copy link
Contributor

@masteryhx masteryhx left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, PTAL my comment.

Copy link
Contributor

@Zakelly Zakelly left a comment

Choose a reason for hiding this comment

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

I think we'd better note the shutdown contract down into the description/Javadoc of StateExecutor. The StateExecutor is managed by KeyedStateBackend and the AEC or operators won't take care of the lifecycle of it.

@ljz2051 ljz2051 force-pushed the fix-35047 branch 2 times, most recently from 13f8dde to e88c4bd Compare May 17, 2024 06:22
@ljz2051 ljz2051 changed the title [FLINK-35047][state] Shutdown StateExecutors when ForStKeyedStateBackend is disposed [FLINK-35047][state] Shutdown StateExecutors when ForStKeyedStateBackend is closed May 17, 2024
@ljz2051
Copy link
Contributor Author

ljz2051 commented May 17, 2024

I think we'd better note the shutdown contract down into the description/Javadoc of StateExecutor. The StateExecutor is managed by KeyedStateBackend and the AEC or operators won't take care of the lifecycle of it.

@Zakelly Thanks for your suggestion. I have refined the JavaDoc in AsyncKeyedStateBackend#createStateExecutor and StateExecutor.

Copy link
Contributor

@Zakelly Zakelly left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@masteryhx masteryhx left a comment

Choose a reason for hiding this comment

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

Thanks for the update.
LGTM.

masteryhx pushed a commit that referenced this pull request May 23, 2024
@masteryhx masteryhx closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants