flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-4449) Heartbeat Manager between ResourceManager and TaskExecutor
Date Thu, 25 Aug 2016 03:54:20 GMT

    [ https://issues.apache.org/jira/browse/FLINK-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15436237#comment-15436237
] 

ASF GitHub Bot commented on FLINK-4449:
---------------------------------------

Github user beyond1920 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2410#discussion_r76176673
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/rpc/resourcemanager/ResourceManagerHATest.java
---
    @@ -0,0 +1,102 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.runtime.rpc.resourcemanager;
    +
    +import akka.actor.ActorSystem;
    +import akka.dispatch.Futures;
    +import akka.util.Timeout;
    +import org.apache.flink.runtime.akka.AkkaUtils;
    +import org.apache.flink.runtime.highavailability.HighAvailabilityServices;
    +import org.apache.flink.runtime.leaderelection.TestingLeaderElectionService;
    +import org.apache.flink.runtime.rpc.akka.AkkaRpcService;
    +import org.junit.AfterClass;
    +import org.junit.Assert;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +import scala.concurrent.Await;
    +import scala.concurrent.Future;
    +import scala.concurrent.duration.FiniteDuration;
    +
    +import java.util.UUID;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.TimeUnit;
    +
    +import static org.mockito.Matchers.any;
    +import static org.mockito.Matchers.eq;
    +import static org.mockito.Mockito.mock;
    +import static org.mockito.Mockito.timeout;
    +import static org.mockito.Mockito.verify;
    +import static org.mockito.Mockito.when;
    +
    +/**
    + * resourceManager HA test, including grant leadership and revoke leadership
    + */
    +public class ResourceManagerHATest {
    +	private static ActorSystem actorSystem;
    +	private static AkkaRpcService akkaRpcService;
    +
    +	private static final Timeout timeout = new Timeout(10000, TimeUnit.MILLISECONDS);
    +
    +	@BeforeClass
    +	public static void setup() throws Exception {
    +		actorSystem = AkkaUtils.createDefaultActorSystem();
    +
    +		akkaRpcService = new AkkaRpcService(actorSystem, timeout);
    +	}
    +
    +	@AfterClass
    +	public static void teardown() throws Exception {
    +		akkaRpcService.stopService();
    +
    +		actorSystem.shutdown();
    +		actorSystem.awaitTermination();
    +	}
    +
    +	@Test
    +	public void testGrantAndRevokeLeadership() throws Exception {
    +		TestingLeaderElectionService leaderElectionService = new TestingLeaderElectionService();
    +		HighAvailabilityServices highAvailabilityServices = mock(HighAvailabilityServices.class);
    +		when(highAvailabilityServices.getResourceManagerLeaderElectionService()).thenReturn(leaderElectionService);
    +		final ResourceManager resourceManager = new ResourceManager(akkaRpcService, highAvailabilityServices);
    +		resourceManager.start();
    +		// before grant leadership, resourceManager's leaderId is null
    +		Assert.assertNull(resourceManager.getLeaderSessionID());
    +		final UUID leaderId = UUID.randomUUID();
    +		leaderElectionService.isLeader(leaderId);
    +		// after grant leadership, resourceManager's leaderId has value
    +		Assert.assertEquals(getLatestLeaderId(resourceManager), leaderId);
    --- End diff --
    
    I don't think so. ResourceManager.getLeaderSessionID has to run in the main thread of
resourceManager, so that it can get new LeaderSessionId after resourceManager is granted leadership
or revoker leadership. 


> Heartbeat Manager between ResourceManager and TaskExecutor
> ----------------------------------------------------------
>
>                 Key: FLINK-4449
>                 URL: https://issues.apache.org/jira/browse/FLINK-4449
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Cluster Management
>            Reporter: zhangjing
>            Assignee: zhangjing
>
> HeartbeatManager is responsible for heartbeat between resourceManager to TaskExecutor
> 1. Register taskExecutors
> register heartbeat targets. If the heartbeat response for these targets is not reported
in time, mark target failed and notify resourceManager
> 2. trigger heartbeat
> trigger heartbeat from resourceManager to TaskExecutor periodically
> taskExecutor report slot allocation in the heartbeat response
> ResourceManager sync self slot allocation with the heartbeat response



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message