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 2020/05/07 23:16:07 UTC

[GitHub] [pulsar] phemmer opened a new issue #6913: Batched producer gets invalid message ID

phemmer opened a new issue #6913:
URL: https://github.com/apache/pulsar/issues/6913


   **Describe the bug**
   When using a producer with batched messaging enabled, attempting to obtain the resultant message ID gives an invalid value.
   
   This is with the C backed Go client.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   Run:
   ```
   pulsar-admin namespaces create public/test
   pulsar-admin namespaces set-retention public/test --time -1 --size -1
   ```
   
   ```go
   package main
   
   import (
   	"context"
   	"fmt"
   	"os"
   	"sync"
   
   	"github.com/apache/pulsar/pulsar-client-go/pulsar"
   )
   
   func main() {
   	if err := Main(); err != nil {
   		fmt.Fprintf(os.Stderr, "Error: %s\n", err)
   		os.Exit(1)
   	}
   	os.Exit(0)
   }
   
   func Main() error {
   	client, err := pulsar.NewClient(pulsar.ClientOptions{
   		URL: "pulsar://localhost:6650",
   	})
   	if err != nil {
   		return err
   	}
   
   	if err := Test(client, true); err != nil { return err }
   	if err := Test(client, false); err != nil { return err }
   
   	return nil
   }
   
   func Test(client pulsar.Client, batching bool) error {
   	producer, err := client.CreateProducer(pulsar.ProducerOptions{
   		Topic: "persistent://public/test/test",
   		Batching: batching,
   	})
   	if err != nil { return err }
   
   	wg := sync.WaitGroup{}
   
   	callback := func(msgid pulsar.MessageID, err error) {
   		fmt.Printf("MsgID: %x\n", msgid.Serialize())
   		wg.Done()
   	}
   
   	fmt.Printf("Batching: %v\n", batching)
   
   	wg.Add(5)
   	for i := 0; i < 5; i++ {
   		producer.SendAndGetMsgIDAsync(context.Background(), pulsar.ProducerMessage{
   			Key:     "abcd",
   			Payload: []byte("test"),
   		}, callback)
   	}
   
   	wg.Wait()
   
   	return nil
   }
   ```
   
   **Expected behavior**
   To be able to obtain valid message IDs.
   
   **Screenshots**
   ```
   2020/05/07 19:11:54.376 c_client.go:68: [info] INFO  | ConnectionPool:85 | Created connection for pulsar://localhost:6650
   2020/05/07 19:11:54.379 c_client.go:68: [info] INFO  | ClientConnection:330 | [127.0.0.1:58554 -> 127.0.0.1:6650] Connected to broker
   2020/05/07 19:11:54.382 c_client.go:68: [info] INFO  | BatchMessageContainer:43 | { BatchContainer [size = 0] [batchSizeInBytes_ = 0] [maxAllowedMessageBatchSizeInBytes_ = 131072] [maxAllowedNumMessagesInBatch_ = 1000] [topicName = persistent://public/test/test] [producerName_ = ] [batchSizeInBytes_ = 0] [numberOfBatchesSent = 0] [averageBatchSize = 0]} BatchMessageContainer constructed
   2020/05/07 19:11:54.382 c_client.go:68: [info] INFO  | HandlerBase:53 | [persistent://public/test/test, ] Getting connection from pool
   2020/05/07 19:11:54.384 c_client.go:68: [info] INFO  | ProducerImpl:151 | [persistent://public/test/test, ] Created producer on broker [127.0.0.1:58554 -> 127.0.0.1:6650] 
   Batching: true
   MsgID: 08ffffffffffffffffff0110ffffffffffffffffff01
   MsgID: 08ffffffffffffffffff0110ffffffffffffffffff01
   MsgID: 08ffffffffffffffffff0110ffffffffffffffffff01
   MsgID: 08ffffffffffffffffff0110ffffffffffffffffff01
   MsgID: 08ffffffffffffffffff0110ffffffffffffffffff01
   2020/05/07 19:11:54.397 c_client.go:68: [info] INFO  | HandlerBase:53 | [persistent://public/test/test, ] Getting connection from pool
   2020/05/07 19:11:54.399 c_client.go:68: [info] INFO  | ProducerImpl:151 | [persistent://public/test/test, ] Created producer on broker [127.0.0.1:58554 -> 127.0.0.1:6650] 
   Batching: false
   MsgID: 08501032
   MsgID: 08501033
   MsgID: 08501034
   MsgID: 08501035
   MsgID: 08501036
   ```
   
   **Desktop (please complete the following information):**
    - OS: Linux - Fedora 31
   
   **Additional context**
   Client library version 2.5.1 with server 2.5.1


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on issue #6913: Batched producer gets invalid message ID

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on issue #6913:
URL: https://github.com/apache/pulsar/issues/6913#issuecomment-625621575


   Seems like the bug I fixed not long ago, see #6812 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] phemmer commented on issue #6913: Batched producer gets invalid message ID

Posted by GitBox <gi...@apache.org>.
phemmer commented on issue #6913:
URL: https://github.com/apache/pulsar/issues/6913#issuecomment-625858678


   Ah, seems likely. I'll go ahead and close this then. Thanks.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org