You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2023/02/06 01:55:35 UTC

[GitHub] [pulsar-client-go] BewareMyPower commented on a diff in pull request #944: [feat] Support Exclusive Producer access mode.

BewareMyPower commented on code in PR #944:
URL: https://github.com/apache/pulsar-client-go/pull/944#discussion_r1096876143


##########
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.
   
   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.
   
   https://github.com/apache/pulsar-client-go/blob/d9b18d0690c15d5da94c9f324d9c2618e3d60bfd/pulsar/internal/pulsar_proto/PulsarApi.pb.go#L3518-L3522



-- 
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