Reader doesn't return truly last message on LatestMessageID() when consuming messages sent with SendAsync
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- distributed-systems
Direzione di ricerca
Riproduci il problema con un Go Reader usando LatestMessageID e un producer che utilizza SendAsync con il batching abilitato. Esamina la gestione degli ID dei messaggi raggruppati da parte del Reader e confrontala con il risultato segnalato per il primo messaggio. Il lavoro è completato quando il Reader restituisce l'ultimo messaggio dell'ultimo batch, ad esempio msgId {999536 true}, anziché il primo messaggio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected behavior
Background/Setup:
I have a Reader setup to retrieve the last message from a topic. When a producer produces messages using SendAsync, the message IDs are the same for a batch of messages (I don't the detail of how Pulsar keeps them unique under the hood). For example, the following few messages are part of a larger batch that all have the same Pulsar message ID:
Received message Pulsar messageID: 4103:12132:0, msgId: {999533 true}, content: '{2023-08-04 12:49:33.961 +0000 UTC true}'
Received message Pulsar messageID: 4103:12132:0, msgId: {999534 true}, content: '{2023-08-04 13:52:10.133 +0000 UTC true}'
Received message Pulsar messageID: 4103:12132:0, msgId: {999535 true}, content: '{2023-08-04 14:55:43.391 +0000 UTC true}'
Received message Pulsar messageID: 4103:12132:0, msgId: {999536 true}, content: '{2023-08-03 22:36:42.701 +0000 UTC true}'
(There could be many more, but for this example we'll pretend those four messages are the batch of IDs related to 4103:12132:0)
Note: the msgId field comes from our data and shows that the messages are unique and sequential in the actual data.
I'm using a Reader configured with the following options:
reader, err = client.CreateReader(pulsar.ReaderOptions{
Topic: pulsarProducerTopicFullName,
StartMessageID: pulsar.LatestMessageID(),
StartMessageIDInclusive: true,
})
What should happen:
I would expect the Reader to return the following message:
Received message Pulsar messageID: 4103:12132:0, msgId: {999536 true}, content: '{2023-08-03 22:36:42.701 +0000 UTC true}'
Actual behavior
What actually happens:
The Reader returns the first message in the last batch. For example, the Reader returns the following:
Received message Pulsar messageID: 4103:12132:0, msgId: {999533 true}, content: '{2023-08-04 12:49:33.961 +0000 UTC true}'
Steps to reproduce
Configure a Reader with the above options.
Configure a Producer with Batching (probably not strictly necessary since it'll default to a batch of 1000):
producer, err = client.CreateProducer(pulsar.ProducerOptions{
Topic: pulsarProducerTopicFullName,
BatchingMaxMessages: 10000,
})
Produce using SendAsync
producer.SendAsync(ctx, &msg, msgCallback)
Setup a subscriber that prints the data and the Pulsar Message ID for the received messages. Something like this:
type KeyMessageFields struct {
Id sql.NullInt32 json:"id"
FirstName sql.NullString json:"firstname"
LastName sql.NullString json:"lastname"
EventTime sql.NullTime json:"event_time"
}
func consumer() {
// Code to set up client goes here
*** set up client here ***
// Set up Consumer
channel := make(chan pulsar.ConsumerMessage, 100)
options := pulsar.ConsumerOptions{
Topic: pulsarConsumerTopicFullName,
SubscriptionName: subscriptionName,
Type: pulsar.Exclusive,
SubscriptionInitialPosition: pulsar.SubscriptionPositionEarliest,
}
options.MessageChannel = channel
consumer, err := client.Subscribe(options)
if err != nil {
ls.LogFatal("failure subscribing: ", logNameValue{"error": err.Error()})
}
defer consumer.Close()
var keyMessageFields KeyMessageFields
for cm := range channel {
msg := cm.Message
err = json.Unmarshal(msg.Payload(), &keyMessageFields)
fmt.Printf("Received message Pulsar messageID: %v, msgId: %v, content: '%v'\n", msg.ID(), keyMessageFields.Id, keyMessageFields.EventTime)
consumer.Ack(msg)
}
System configuration
Pulsar version: 2.10.3.7 (hosted on StreamNative)
- Lingua principale
- Go
- Stelle
- 746
- Fork
- 394
- Merge medio
- 6g 13h
- PR unite (30g)
- 7
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/pulsar-client-go
-
[Bug] Default key routing (JavaStringHash) picks a different partition than the Java client for about half of keysForse già presa @0z5a l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/pulsar-client-go#1575 ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] Concurrent transactional ACKs can crash in registerAckTopicForse già presa @Ebispongebob l’ha presa 73 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/pulsar-client-go#1536 ·
I maintainer di solito rispondono entro 2 giorni
-
Nil pointer panic in `sendRequest.done()` during producer reconnection via `FailTimeoutMessages`Forse già presa @nodece l’ha presa 186 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/pulsar-client-go#1497 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug][Consumer] Throughput collapse and permanent deadlock on large payloads since v0.20.0Forse già presa @HrithikShet l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
apache/pulsar-client-go#1573 ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] Lookup retries use a fixed backoff that doubles to 60 s, so a reconnect during a broker outage can sleep through the failoverForse già presa @EdwardShen125 l’ha presa 26 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
apache/pulsar-client-go#1554 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di apache/pulsar-client-go
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
otelc go test fails for .go file targets with 'multiple packages found for file targets'Forse già presa @Aryanbhargava18 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open-telemetry/opentelemetry-go-compile-instrumentation#1877 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
rossoctl/context-guru#1268 ·
I maintainer di solito rispondono entro 1 giorno