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-24864][metrics] Release TaskManagerJobMetricGroup with the last slot rather than task #17387

Merged
merged 1 commit into from Nov 16, 2021

Conversation

rkhachatryan
Copy link
Contributor

@rkhachatryan rkhachatryan commented Sep 29, 2021

What is the purpose of the change

Release TaskManagerJobMetricGroup on last job slot release to avoid issues when using it with StateChangelogStorage, which is released on last slot release (please see ticket description for more details).

Verifying this change

  • added TaskExecutorTest.testReleasingJobResources
  • added TaskManagerMetricGroupTest

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/Mesos, 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? no

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 3825d66 (Wed Sep 29 13:46:18 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 29, 2021

CI report:

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

@rkhachatryan rkhachatryan changed the title [WIP][FLINK-23486][state] Changelog Backend metrics [WIP][FLINK-23486][state] ChangelogUploader metrics Nov 2, 2021
@rkhachatryan rkhachatryan changed the title [WIP][FLINK-23486][state] ChangelogUploader metrics [FLINK-23486][state] ChangelogUploader metrics Nov 5, 2021
@rkhachatryan rkhachatryan marked this pull request as ready for review November 5, 2021 22:29
@rkhachatryan
Copy link
Contributor Author

Build failure unrelated (FLINK-24806).

Copy link
Contributor

@zentol zentol left a comment

Choose a reason for hiding this comment

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

I'd say the change to the TMJMG lifecycle exceeds the scope of a hotfix by quite a bit.

public void removeJobMetricsGroup(JobID jobId, TaskManagerJobMetricGroup group) {
if (jobId == null || group == null || !group.isClosed()) {
return;
if (jobGroup == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why are you no longer checking whether the jobGroup is closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The check is already done in close() method itself (and it cannot be removed from there because of concurrency).
And IIUC, this method removeJobMetricsGroup can not be called after close because they are called from
TaskExecutor.releaseJobResources and stopTaskExecutorServices respectively.

@rkhachatryan
Copy link
Contributor Author

Thanks for the feedback @zentol !

I'd say the change to the TMJMG lifecycle exceeds the scope of a hotfix by quite a bit.

Would you prefer this change to be in a separate ticket and PR?

@zentol
Copy link
Contributor

zentol commented Nov 9, 2021

Would you prefer this change to be in a separate ticket and PR?

A separate ticket for sure; whether we need a separate PR is up to you (as you'll need to manage the discussions/commits, so pick whatever works best for you).

@rkhachatryan rkhachatryan changed the title [FLINK-23486][state] ChangelogUploader metrics [FLINK-24864][metrics] Release TaskManagerJobMetricGroup with the last slot rather than task Nov 10, 2021
@rkhachatryan
Copy link
Contributor Author

I've created a separate ticket (FLINK-24864) and PR (#17757) for changelog-related changes.
This PR and ticket now only contains TMJMG lifecycle changes.

I've also rebased it onto latest master and addressed your feedback, PTAL.

@zentol zentol self-assigned this Nov 11, 2021
Copy link
Contributor

@zentol zentol left a comment

Choose a reason for hiding this comment

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

+1

…t slot rather than task

Motivation:
TaskManagerJobMetricGroup might be used by components shared across tasks of a job
(e.g. ChangelogStorage). The lifecycle of those is bound to slots rather than tasks
(for various reasons including performance).
Releasing them differently causes those metrics to be not reported.

Besides that, this simplifies release code in TaskManagerJobMetricGroup
and makes its lifecycle more consistent (creation and deletion in the
same place).
@rkhachatryan rkhachatryan deleted the f23486 branch November 16, 2021 08:20
@rkhachatryan
Copy link
Contributor Author

Thanks @zentol for reviewing.
Merged as f849ef3 into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants