You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/22 08:39:29 UTC

[GitHub] [pulsar-client-go] wolfstudy commented on a diff in pull request #829: Enable seeking individual topic partitions

wolfstudy commented on code in PR #829:
URL: https://github.com/apache/pulsar-client-go/pull/829#discussion_r951165206


##########
pulsar/consumer_impl.go:
##########
@@ -575,15 +575,21 @@ func (c *consumer) Seek(msgID MessageID) error {
 	c.Lock()
 	defer c.Unlock()
 
-	if len(c.consumers) > 1 {
-		return newError(SeekFailed, "for partition topic, seek command should perform on the individual partitions")
-	}
-
 	mid, ok := c.messageID(msgID)
 	if !ok {
 		return nil
 	}
 
+	if mid.partitionIdx < 0 {
+		return newError(SeekFailed, "partitionIdx is negative")
+	}

Review Comment:
   In Go SDK, the partition index less than 0 is not allowed.
   
   ```
   // did we receive a valid partition index?
   	if partition < 0 || partition >= len(c.consumers) {
   		c.log.Warnf("invalid partition index %d expected a partition between [0-%d]",
   			partition, len(c.consumers))
   		return trackingMessageID{}, false
   	}
   ```
   
   And why do we need to modify the current logic, where the number of consumers is equivalent to the number of partitions, and each partition corresponds to a unique consumer.
   
   The Go SDK currently does not support seek operations on partitioned topics, and this logic is still being implemented.



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