kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [kafka] branch trunk updated: MINOR: Remove unused isSticky assert out from tests only do constrainedAssign (#8788)
Date Mon, 08 Jun 2020 21:25:50 GMT
This is an automated email from the ASF dual-hosted git repository.

guozhang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new aed7ba9  MINOR: Remove unused isSticky assert out from tests only do constrainedAssign
(#8788)
aed7ba9 is described below

commit aed7ba9f164ec35adbab948afd1ff8b20ccd8283
Author: showuon <43372967+showuon@users.noreply.github.com>
AuthorDate: Tue Jun 9 05:25:20 2020 +0800

    MINOR: Remove unused isSticky assert out from tests only do constrainedAssign (#8788)
    
    Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
---
 .../kafka/clients/consumer/internals/AbstractStickyAssignor.java   | 2 +-
 .../java/org/apache/kafka/clients/consumer/StickyAssignorTest.java | 6 ------
 .../clients/consumer/internals/AbstractStickyAssignorTest.java     | 7 -------
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java
b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java
index a1af6d9..629f05a 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java
@@ -72,7 +72,6 @@ public abstract class AbstractStickyAssignor extends AbstractPartitionAssignor
{
     @Override
     public Map<String, List<TopicPartition>> assign(Map<String, Integer>
partitionsPerTopic,
                                                     Map<String, Subscription> subscriptions)
{
-        partitionMovements = new PartitionMovements();
         Map<String, List<TopicPartition>> consumerToOwnedPartitions = new HashMap<>();
         if (allSubscriptionsEqual(partitionsPerTopic.keySet(), subscriptions, consumerToOwnedPartitions))
{
             log.debug("Detected that all consumers were subscribed to same set of topics,
invoking the "
@@ -273,6 +272,7 @@ public abstract class AbstractStickyAssignor extends AbstractPartitionAssignor
{
                                                             Map<String, Subscription>
subscriptions) {
         Map<String, List<TopicPartition>> currentAssignment = new HashMap<>();
         Map<TopicPartition, ConsumerGenerationPair> prevAssignment = new HashMap<>();
+        partitionMovements = new PartitionMovements();
 
         prepopulateCurrentAssignments(subscriptions, currentAssignment, prevAssignment);
 
diff --git a/clients/src/test/java/org/apache/kafka/clients/consumer/StickyAssignorTest.java
b/clients/src/test/java/org/apache/kafka/clients/consumer/StickyAssignorTest.java
index fb89944..2189700 100644
--- a/clients/src/test/java/org/apache/kafka/clients/consumer/StickyAssignorTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/consumer/StickyAssignorTest.java
@@ -83,7 +83,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertTrue(r2partitions2.containsAll(r1partitions2));
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
         assertFalse(Collections.disjoint(r2partitions2, r1partitions3));
 
         subscriptions.remove(consumer1);
@@ -97,7 +96,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertTrue(Collections.disjoint(r3partitions2, r3partitions3));
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
     }
 
     @Test
@@ -130,7 +128,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertTrue(r2partitions2.containsAll(r1partitions2));
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
 
         subscriptions.put(consumer1, buildSubscriptionWithGeneration(topics(topic), r1partitions1,
1));
         subscriptions.put(consumer2, buildSubscriptionWithGeneration(topics(topic), r2partitions2,
2));
@@ -146,7 +143,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertEquals(r1partitions3, r3partitions3);
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
     }
 
     @Test
@@ -185,7 +181,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertTrue(c3partitions0.containsAll(c3partitions));
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
     }
 
     @Test
@@ -218,7 +213,6 @@ public class StickyAssignorTest extends AbstractStickyAssignorTest {
         assertTrue(c2partitions0.containsAll(c2partitions));
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
     }
 
     private Subscription buildSubscriptionWithGeneration(List<String> topics, List<TopicPartition>
partitions, int generation) {
diff --git a/clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignorTest.java
b/clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignorTest.java
index c7b4523..b4c9b05 100644
--- a/clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignorTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignorTest.java
@@ -244,7 +244,6 @@ public abstract class AbstractStickyAssignorTest {
         assertEquals(partitions(tp(topic, 0), tp(topic, 1)), assignment.get(consumer1));
         assertEquals(partitions(tp(topic, 2)), assignment.get(consumer2));
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
 
         subscriptions.remove(consumer1);
         subscriptions.put(consumer2, buildSubscription(topics(topic), assignment.get(consumer2)));
@@ -254,7 +253,6 @@ public abstract class AbstractStickyAssignorTest {
 
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
         assertTrue(isFullyBalanced(assignment));
-        assertTrue(assignor.isSticky());
     }
 
     /**
@@ -330,7 +328,6 @@ public abstract class AbstractStickyAssignorTest {
         assertTrue(consumer1assignment.size() == 3 && consumer2assignment.size()
== 3);
         assertTrue(consumer1assignment.containsAll(consumer1Assignment1));
         assertTrue(consumer2assignment.containsAll(consumer2Assignment1));
-        assertTrue(assignor.isSticky());
 
         partitionsPerTopic.remove(topic);
         subscriptions.put(consumer1, buildSubscription(topics(topic2), assignment.get(consumer1)));
@@ -347,7 +344,6 @@ public abstract class AbstractStickyAssignorTest {
             (consumer1Assignment3.size() == 2 && consumer2Assignment3.size() == 1));
         assertTrue(consumer1assignment.containsAll(consumer1Assignment3));
         assertTrue(consumer2assignment.containsAll(consumer2Assignment3));
-        assertTrue(assignor.isSticky());
     }
 
 
@@ -397,7 +393,6 @@ public abstract class AbstractStickyAssignorTest {
 
         assignment = assignor.assign(partitionsPerTopic, subscriptions);
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
-        assertTrue(assignor.isSticky());
     }
 
     @Test
@@ -425,7 +420,6 @@ public abstract class AbstractStickyAssignorTest {
 
         assignment = assignor.assign(partitionsPerTopic, subscriptions);
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
-        assertTrue(assignor.isSticky());
     }
 
     @Test(timeout = 30 * 1000)
@@ -575,7 +569,6 @@ public abstract class AbstractStickyAssignorTest {
 
         assignment = assignor.assign(partitionsPerTopic, subscriptions);
         verifyValidityAndBalance(subscriptions, assignment, partitionsPerTopic);
-        assertTrue(assignor.isSticky());
 
         assignments = assignment.entrySet();
         for (Map.Entry<String, List<TopicPartition>> entry: assignments) {


Mime
View raw message