Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -90,16 +89,13 @@ public static void main(final String[] args) throws Exception {
final KafkaStreams streams = new KafkaStreams(builder.build(), config, kafkaClientSupplier);
streams.start();

Runtime.getRuntime().addShutdownHook(new Thread() {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just Java8 cleanup.

@Override
public void run() {
System.out.println("closing Kafka Streams instance");
System.out.flush();
streams.close();
System.out.println("UPGRADE-TEST-CLIENT-CLOSED");
System.out.flush();
}
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("closing Kafka Streams instance");
System.out.flush();
streams.close();
System.out.println("UPGRADE-TEST-CLIENT-CLOSED");
System.out.flush();
}));
}

private static class FutureKafkaClientSupplier extends DefaultKafkaClientSupplier {
Expand Down Expand Up @@ -168,7 +164,7 @@ public void onAssignment(final PartitionAssignor.Assignment assignment) {
assignment.userData().putInt(0, AssignmentInfo.LATEST_SUPPORTED_VERSION));

final List<TopicPartition> partitions = new ArrayList<>(assignment.partitions());
Collections.sort(partitions, PARTITION_COMPARATOR);
partitions.sort(PARTITION_COMPARATOR);

// version 1 field
final Map<TaskId, Set<TopicPartition>> activeTasks = new HashMap<>();
Expand Down
7 changes: 3 additions & 4 deletions tests/kafkatest/tests/streams/streams_upgrade_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@

"""


class StreamsUpgradeTest(Test):
"""
Test upgrading Kafka Streams (all version combination)
Expand Down Expand Up @@ -348,7 +349,7 @@ def update_leader(self):
while retries > 0:
for p in self.processors:
found = list(p.node.account.ssh_capture("grep \"Finished assignment for group\" %s" % p.LOG_FILE, allow_fail=True))
if len(found) == self.leader_counter[p] + 1:
if len(found) >= self.leader_counter[p] + 1:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is one fix. If rebalance happens quickly, we might see this message for the second rebalance early. Cf. #6763

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

After #6779 is merged, I can rebase this PR -- we still want this fix I guess :)

if self.leader is not None:
raise Exception("Could not uniquely identify leader")
self.leader = p
Expand Down Expand Up @@ -403,8 +404,7 @@ def start_all_nodes_with(self, version):
timeout_sec=60,
err_msg="Never saw output '%s' on " % self.processed_msg + str(node2.account))


# start third with <version>
# start third with <version>
self.prepare_for(self.processor3, version)
node3 = self.processor3.node
with node1.account.monitor_log(self.processor1.STDOUT_FILE) as first_monitor:
Expand All @@ -425,7 +425,6 @@ def start_all_nodes_with(self, version):
timeout_sec=60,
err_msg="Never saw output '%s' on " % self.processed_msg + str(node3.account))


@staticmethod
def prepare_for(processor, version):
processor.node.account.ssh("rm -rf " + processor.PERSISTENT_ROOT, allow_fail=False)
Expand Down