equanz commented on a change in pull request #10279:
URL: https://github.com/apache/pulsar/pull/10279#discussion_r700948961
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicsConsumerImplTest.java
##########
@@ -863,7 +863,7 @@ public void
testConsumerDistributionInFailoverSubscriptionWhenUpdatePartitions()
.messageRouter(new MessageRouter() {
@Override
public int choosePartition(Message<?> msg, TopicMetadata
metadata) {
- return Integer.parseInt(msg.getKey()) %
metadata.numPartitions();
+ return msg.hasKey() ? Integer.parseInt(msg.getKey()) %
metadata.numPartitions() : 0;
Review comment:
I'll add this behavior for authn/authz (please see also
https://github.com/apache/pulsar/pull/11570#issuecomment-897463605 ). Elect
first partition index by MessageRouter with blank message.
https://github.com/equanz/pulsar/blob/844cca7cf84b76b7d27f12de4dbf36e23cbf29e9/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java#L87-L88
If we shouldn't change this test and behavior,
1. add pseudo message key like `xxx` to blank message
2. handle exceptions in PartitionedProducerImpl
3. select first partition index without MessageRouter (e.g. randomly select)
- if message router elects partition from part of partitions like
singlepartition routing mode, create redundant producer for this change
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicsConsumerImplTest.java
##########
@@ -863,7 +863,7 @@ public void
testConsumerDistributionInFailoverSubscriptionWhenUpdatePartitions()
.messageRouter(new MessageRouter() {
@Override
public int choosePartition(Message<?> msg, TopicMetadata
metadata) {
- return Integer.parseInt(msg.getKey()) %
metadata.numPartitions();
+ return msg.hasKey() ? Integer.parseInt(msg.getKey()) %
metadata.numPartitions() : 0;
Review comment:
I'll add this behavior for authn/authz (please see also
https://github.com/apache/pulsar/pull/11570#issuecomment-897463605 ). Elect
first partition index by MessageRouter with blank message.
https://github.com/equanz/pulsar/blob/844cca7cf84b76b7d27f12de4dbf36e23cbf29e9/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java#L87-L88
If we shouldn't change this test and behavior,
1. add pseudo message key like `xxx` to blank message
2. handle exceptions in PartitionedProducerImpl
3. select first partition index without MessageRouter (e.g. randomly select)
- if message router elects partition from part of partitions like
singlepartition routing mode, create redundant producer for this change
4. etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]