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-32974][client] Avoid creating a new temporary directory every time for RestClusterClient #23363

Closed
wants to merge 1 commit into from

Conversation

wanglijie95
Copy link
Contributor

@wanglijie95 wanglijie95 commented Sep 6, 2023

What is the purpose of the change

Fix FLINK-32974

After FLINK-32226, when creating a new RestClusterClient, a temporary directory (named flink-rest-client-jobgraphsxxx) is created, but the directory is never cleaned up, which may cause the inode to be used up.

In this PR, we try to solve this problem by using fixed directoryflink-rest-client-jobgraphs instead of creating a temporary directory flink-rest-client-jobgraphsxxx every time

Verifying this change

Add test RestClusterClientTest#testTempDirCleanedUpOnClose

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)

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 6, 2023

CI report:

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

@wanglijie95
Copy link
Contributor Author

Hi @zentol , could you help to review this PR?

@wanglijie95 wanglijie95 changed the title [FLINK-32974][client] Clean up the temp dir on RestClusterClient#close if the temp dir is created by the client [FLINK-32974][client] Avoid creating a new temporary directory every time for RestClusterClient Sep 19, 2023
Files.createDirectories(
Paths.get(
ConfigurationUtils.parseTempDirectories(config)[0],
"flink-rest-client-jobgraphs")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks to me there's no need to create an additional folder here.
If the submission succeeds, job graph files will be cleaned up, while leaving this folder remained in the tmp dir.

@@ -359,7 +333,8 @@ public CompletableFuture<JobID> submitJob(@Nonnull JobGraph jobGraph) {
() -> {
try {
final java.nio.file.Path jobGraphFile =
Files.createTempFile(tempDir, "flink-jobgraph", ".bin");
Files.createTempFile(
"flink-jobgraph-" + jobGraph.getJobID(), ".bin");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to add the jobid into the job graph file name, in order to check whether the job graph file has been deleted in testJobGraphFileCleanedUpOnJobSubmissionFailure. cc @zhuzhurk

Copy link
Contributor

@zhuzhurk zhuzhurk left a comment

Choose a reason for hiding this comment

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

LGTM.

@wanglijie95 wanglijie95 deleted the FLINK-32974 branch September 20, 2023 11:11
wanglijie95 added a commit that referenced this pull request Sep 21, 2023
wanglijie95 added a commit that referenced this pull request Sep 21, 2023
RocMarshal pushed a commit to RocMarshal/flink that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants