streamnative / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
1 stars 2 forks source link

ISSUE-577: Failed to get last message id when reader try to read from last message id #201

Open sijie opened 3 years ago

sijie commented 3 years ago

Original Issue: apache/pulsar-client-go#577


Expected behavior

Failed to get the last message-id should not appeared.

Actual behavior

Failed to get the last message-id for many times until everything seems good to go

time="2021-07-28T15:25:31+09:00" level=info msg="[Connecting to broker]" remote_addr="pulsar://localhost:6650"
time="2021-07-28T15:25:31+09:00" level=info msg="[TCP connection established]" local_addr="[::1]:65070" remote_addr="pulsar://localhost:6650"
time="2021-07-28T15:25:31+09:00" level=info msg="[Connection is ready]" local_addr="[::1]:65070" remote_addr="pulsar://localhost:6650"
time="2021-07-28T15:25:31+09:00" level=info msg="[Connected consumer]" consumerID=1 name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=info msg="[Created consumer]" consumerID=1 name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=info msg="Broker notification of Closed consumer: 1" local_addr="[::1]:65070" remote_addr="pulsar://localhost:6650"
time="2021-07-28T15:25:31+09:00" level=info msg="[Reconnecting to broker in  100ms]" consumerID=1 name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id]" consumerID=1 error="server error: MetadataError: Consumer not found" name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=error msg="[Failed to get last message id from broker]" error="server error: MetadataError: Consumer not found" topic=topic
time="2021-07-28T15:25:31+09:00" level=info msg="[Connected consumer]" consumerID=1 name= subscription=reader-piqzh topic=topic
time="2021-07-28T15:25:31+09:00" level=info msg="[Reconnected consumer to broker]" consumerID=1 name= subscription=reader-piqzh topic=topic

Steps to reproduce

Step 1. startup pulsar standalone Step 2. produce some messages to a topic Step 3. try to get latest message via reader api

cl, err := pulsar.NewClient(pulsar.ClientOptions{
        URL:               url,
        OperationTimeout:  10 * time.Second,
        ConnectionTimeout: 10 * time.Second,
    })
cl.Close()
reader, err := cl.CreateReader(pulsar.ReaderOptions{
        Topic:          topic,
        StartMessageID: pulsar.LatestMessageID(),
        StartMessageIDInclusive: true,
    })
for reader.HasNext() {
    msg, err := reader.Next(context.Background())
}()

System configuration

Pulsar version: 2.7.1

czs007 commented 2 years ago

hi, any updates ?