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-8942][runtime] Pass heartbeat target ResourceID #5699

Closed
wants to merge 4 commits into from

Conversation

zentol
Copy link
Contributor

@zentol zentol commented Mar 14, 2018

What is the purpose of the change

With this PR the heartbeat target ResourceID is passed to the HeartbeatListener when retrieving the payload to send. This allows the listener to create target-dependent payloads.

The primary use-case is FLINK-8881, where accumulators are sent via heartbeats to the JobManager. Here we only want to send accumulators for the relevant job, and not for all jobs.

Brief change log

  • add a ResourceID parameter to HeartbeatListener#retrievePayload
  • modify return type of HeartbeatManagerImpl#getHeartbeatTargets to also contain the target ResourceID

Verifying this change

This change added tests:

HeartbeatManagerTest:

  • testHeartbeatManagerTargetPayload
  • testHeartbeatManagerSenderTargetPayload

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, Yarn/Mesos, ZooKeeper: (yes)
  • 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)

Copy link
Contributor

@tillrohrmann tillrohrmann 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 contribution @zentol. The changes look good to me. The only comment was whether we want to expose that we use a Map to store the heartbeat targets or whether we expose the ResourceID via the HeartbeatMonitor. What do you think?

@Test
public void testHeartbeatManagerSenderTargetPayload() throws Exception {
final long heartbeatTimeout = 100L;
final long heartbeatPeriod = 2000L;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's set the period to 1L to speed up the test a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That shouldn't have an affect on the test time. The HeartbeatManagerSenderImpl sends one heartbeat right away without delay, and we only require on for each target.

@@ -106,8 +107,8 @@ Executor getExecutor() {
return heartbeatListener;
}

Collection<HeartbeatManagerImpl.HeartbeatMonitor<O>> getHeartbeatTargets() {
return heartbeatTargets.values();
Collection<Map.Entry<ResourceID, HeartbeatMonitor<O>>> getHeartbeatTargets() {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about adding a getTargetID() to the HeartbeatMonitor? Then we would not have to expose, even though it is an internal method, that we use a Map to store the heartbeat targets. We could then keep the return type Collection<HeartbeatMonitor>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes that is a better solution.

@zentol
Copy link
Contributor Author

zentol commented Mar 20, 2018

@tillrohrmann I've addressed your comments.

@tillrohrmann
Copy link
Contributor

Thanks for addressing them. Merging this PR once Travis gave green light.

tillrohrmann pushed a commit to tillrohrmann/flink that referenced this pull request Mar 20, 2018
received payload field now volatile

Add HeartbeatMonitor#getHeartbeatTargetId

This closes apache#5699.
asfgit pushed a commit that referenced this pull request Mar 20, 2018
received payload field now volatile

Add HeartbeatMonitor#getHeartbeatTargetId

This closes #5699.
@asfgit asfgit closed this in f9fbbc3 Mar 20, 2018
@zentol zentol deleted the 8942 branch March 26, 2018 08:59
sampathBhat pushed a commit to sampathBhat/flink that referenced this pull request Jul 26, 2018
received payload field now volatile

Add HeartbeatMonitor#getHeartbeatTargetId

This closes apache#5699.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants