|
|
|
@ -1188,15 +1188,15 @@ class GroupCoordinatorTest {
@@ -1188,15 +1188,15 @@ class GroupCoordinatorTest {
|
|
|
|
|
|
|
|
|
|
EasyMock.reset(replicaManager) |
|
|
|
|
val followerId = followerJoinGroupResult.memberId |
|
|
|
|
val follwerSyncGroupResult = syncGroupFollower(groupId, leaderJoinGroupResult.generationId, followerId) |
|
|
|
|
assertEquals(Errors.NONE, follwerSyncGroupResult._2) |
|
|
|
|
val followerSyncGroupResult = syncGroupFollower(groupId, leaderJoinGroupResult.generationId, followerId) |
|
|
|
|
assertEquals(Errors.NONE, followerSyncGroupResult._2) |
|
|
|
|
assertTrue(getGroup(groupId).is(Stable)) |
|
|
|
|
|
|
|
|
|
new RebalanceResult(newGeneration, |
|
|
|
|
leaderId, |
|
|
|
|
leaderSyncGroupResult._1, |
|
|
|
|
followerId, |
|
|
|
|
follwerSyncGroupResult._1) |
|
|
|
|
followerSyncGroupResult._1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private def checkJoinGroupResult(joinGroupResult: JoinGroupResult, |
|
|
|
@ -3101,6 +3101,31 @@ class GroupCoordinatorTest {
@@ -3101,6 +3101,31 @@ class GroupCoordinatorTest {
|
|
|
|
|
assertEquals(Errors.NONE, thirdResult.error) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
def testCompleteHeartbeatWithGroupDead(): Unit = { |
|
|
|
|
val rebalanceResult = staticMembersJoinAndRebalance(leaderInstanceId, followerInstanceId) |
|
|
|
|
EasyMock.reset(replicaManager) |
|
|
|
|
heartbeat(groupId, rebalanceResult.leaderId, rebalanceResult.generation) |
|
|
|
|
val group = getGroup(groupId) |
|
|
|
|
group.transitionTo(Dead) |
|
|
|
|
val leaderMemberId = rebalanceResult.leaderId |
|
|
|
|
assertTrue(groupCoordinator.tryCompleteHeartbeat(group, leaderMemberId, false, DefaultSessionTimeout, () => true)) |
|
|
|
|
groupCoordinator.onExpireHeartbeat(group, leaderMemberId, false, DefaultSessionTimeout) |
|
|
|
|
assertTrue(group.has(leaderMemberId)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
def testCompleteHeartbeatWithMemberAlreadyRemoved(): Unit = { |
|
|
|
|
val rebalanceResult = staticMembersJoinAndRebalance(leaderInstanceId, followerInstanceId) |
|
|
|
|
EasyMock.reset(replicaManager) |
|
|
|
|
heartbeat(groupId, rebalanceResult.leaderId, rebalanceResult.generation) |
|
|
|
|
val group = getGroup(groupId) |
|
|
|
|
val leaderMemberId = rebalanceResult.leaderId |
|
|
|
|
group.remove(leaderMemberId) |
|
|
|
|
assertFalse(groupCoordinator.tryCompleteHeartbeat(group, leaderMemberId, false, DefaultSessionTimeout, () => true)) |
|
|
|
|
groupCoordinator.onExpireHeartbeat(group, leaderMemberId, false, DefaultSessionTimeout) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private def getGroup(groupId: String): GroupMetadata = { |
|
|
|
|
val groupOpt = groupCoordinator.groupManager.getGroup(groupId) |
|
|
|
|
assertTrue(groupOpt.isDefined) |
|
|
|
|