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 @@ -1033,8 +1033,11 @@ private static class MetadataSnapshot {

private MetadataSnapshot(SubscriptionState subscription, Cluster cluster, int version) {
Map<String, Integer> partitionsPerTopic = new HashMap<>();
for (String topic : subscription.groupSubscription())
partitionsPerTopic.put(topic, cluster.partitionCountForTopic(topic));
for (String topic : subscription.groupSubscription()) {
Integer numPartitions = cluster.partitionCountForTopic(topic);
if (numPartitions != null)
partitionsPerTopic.put(topic, numPartitions);
}
this.partitionsPerTopic = partitionsPerTopic;
this.version = version;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,13 @@ public synchronized void resume(TopicPartition tp) {
}

synchronized void requestFailed(Set<TopicPartition> partitions, long nextRetryTimeMs) {
for (TopicPartition partition : partitions)
assignedState(partition).requestFailed(nextRetryTimeMs);
for (TopicPartition partition : partitions) {
// by the time the request failed, the assignment may no longer
// contain this partition any more, in which case we would just ignore.
final TopicPartitionState state = assignedStateOrNull(partition);
if (state != null)
state.requestFailed(nextRetryTimeMs);
}
}

synchronized void movePartitionToEnd(TopicPartition tp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void partitionAssignment() {
state.seek(tp0, 1);
assertTrue(state.isFetchable(tp0));
assertEquals(1L, state.position(tp0).offset);
state.assignFromUser(Collections.<TopicPartition>emptySet());
state.assignFromUser(Collections.emptySet());
assertTrue(state.assignedPartitions().isEmpty());
assertEquals(0, state.numAssignedPartitions());
assertFalse(state.isAssigned(tp0));
Expand Down