You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "shibd (via GitHub)" <gi...@apache.org> on 2023/02/06 07:23:32 UTC
[GitHub] [pulsar-client-go] shibd commented on a diff in pull request #944: [feat] Support Exclusive Producer access mode.
shibd commented on code in PR #944:
URL: https://github.com/apache/pulsar-client-go/pull/944#discussion_r1097019416
##########
pulsar/producer_partition.go:
##########
@@ -237,6 +239,11 @@ func (p *partitionProducer) grabCnx() error {
Schema: pbSchema,
Epoch: proto.Uint64(atomic.LoadUint64(&p.epoch)),
UserProvidedProducerName: proto.Bool(p.userProvidedProducerName),
+ ProducerAccessMode: toProtoProducerAccessMode(p.options.ProducerAccessMode).Enum(),
+ }
+
+ if p.topicEpoch > -1 {
Review Comment:
> The default value should be 0, not -1.
Because Go natively does not support `optional`. We need to initialize it to `-1` to judge whether have received `topicEpoch` from the broker(The broker is incremented from 0).
> nit: You should not use > n on a unsigned integer, even if you converted it to a signed integer. For example, 0xFFFFFFFFFFFFFFFFFFFF should be a valid uint64 epoch (though in Java it's overflowed), but when it's converted to int64, it will be -1 and treated as negative. I think you'd better use uint64 and avoid type cast.
I use uint64 ptr instead of it.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org