You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lifepuzzlefun (via GitHub)" <gi...@apache.org> on 2023/03/26 09:35:23 UTC
[GitHub] [pulsar] lifepuzzlefun opened a new issue, #19928: [Bug] Retry & DLQ Producer keeps sending GET_OR_CREATE_SCHEMA when send message.
lifepuzzlefun opened a new issue, #19928:
URL: https://github.com/apache/pulsar/issues/19928
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
current master.
### Minimal reproduce step
1. enable debug log of pulsar client.
2. use below code. set `maxRedeliverCount` just to make message fast to go to DLQ
```
package org.apache.pulsar.client;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.DeadLetterPolicy;
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.MessageListener;
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
import java.util.concurrent.TimeUnit;
public class H {
public static void main(String[] args) throws PulsarClientException, InterruptedException {
PulsarClient client = PulsarClient.builder()
.serviceUrl("pulsar://localhost:6650")
.build();
Consumer<byte[]> hello = client.newConsumer()
.topic("hello")
.subscriptionName("sub")
.enableRetry(true)
.deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(1).build())
.messageListener(new MessageListener<byte[]>() {
@Override
public void received(Consumer<byte[]> consumer, Message<byte[]> msg) {
try {
consumer.reconsumeLater(msg, 1, TimeUnit.SECONDS);
} catch (PulsarClientException e) {
throw new RuntimeException(e);
}
}
})
.subscribe();
Thread.sleep(10000);
}
}
```
you can see a lot `GET_OR_CREATE_SCHEMA_RESPONSE` rpc is send before each message resend to broker.
17:27:25.489 [main] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema request
17:27:25.489 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_OR_CREATE_SCHEMA_RESPONSE
17:27:25.489 [pulsar-client-io-1-3] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema succeed
17:27:25.490 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Re-Sending message in cnx [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650], sequenceId 995
17:27:25.492 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd SEND_RECEIPT
17:27:25.492 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ClientCnx - [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650] Got receipt for producer: 0 -- msg: 995 -- id: 0:3197
17:27:25.492 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Received ack for msg 995
17:27:25.492 [main] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema request
17:27:25.492 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_OR_CREATE_SCHEMA_RESPONSE
17:27:25.492 [pulsar-client-io-1-3] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema succeed
17:27:25.492 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Re-Sending message in cnx [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650], sequenceId 996
17:27:25.494 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd SEND_RECEIPT
17:27:25.494 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ClientCnx - [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650] Got receipt for producer: 0 -- msg: 996 -- id: 0:3198
17:27:25.494 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Received ack for msg 996
17:27:25.494 [main] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema request
17:27:25.495 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_OR_CREATE_SCHEMA_RESPONSE
17:27:25.495 [pulsar-client-io-1-3] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema succeed
17:27:25.495 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Re-Sending message in cnx [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650], sequenceId 997
17:27:25.497 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd SEND_RECEIPT
17:27:25.497 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ClientCnx - [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650] Got receipt for producer: 0 -- msg: 997 -- id: 0:3199
17:27:25.497 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Received ack for msg 997
17:27:25.497 [main] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema request
17:27:25.498 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_OR_CREATE_SCHEMA_RESPONSE
17:27:25.498 [pulsar-client-io-1-3] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema succeed
17:27:25.498 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Re-Sending message in cnx [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650], sequenceId 998
17:27:25.500 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd SEND_RECEIPT
17:27:25.500 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ClientCnx - [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650] Got receipt for producer: 0 -- msg: 998 -- id: 0:3200
17:27:25.500 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Received ack for msg 998
17:27:25.500 [main] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema request
17:27:25.500 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_OR_CREATE_SCHEMA_RESPONSE
17:27:25.500 [pulsar-client-io-1-3] INFO org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] GetOrCreateSchema succeed
17:27:25.500 [pulsar-client-io-1-3] DEBUG org.apache.pulsar.client.impl.ProducerImpl - [hello] [standalone-0-16] Re-Sending message in cnx [id: 0x014f6bed, L:/127.0.0.1:61200 - R:localhost/127.0.0.1:6650], sequenceId 999
### What did you expect to see?
the current code double the rpc send to broker when using retry and dlq feature. this should not happen and have pressure to the backend service.
### What did you see instead?
only send GetOrCreateSchema once.
### Anything else?
_No response_
### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Technoboy- closed issue #19928: [Bug] Retry & DLQ Producer keeps sending GET_OR_CREATE_SCHEMA when send message.
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- closed issue #19928: [Bug] Retry & DLQ Producer keeps sending GET_OR_CREATE_SCHEMA when send message.
URL: https://github.com/apache/pulsar/issues/19928
--
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