[fix][broker] Fix the replicator unnecessary get schema request for BYTES schema #17523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
We can see many logs like the following (not master since #16345 has changed to level to debug)
And it is easy to reproduce. You can just create a geo-replicated cluster
and produce the bytes messages.
It should be related to this change #17049 (haven't released) which fixed the replicated schema issue.
But we shouldn't get the schema from the broker for the BYTES schema, the client side will not cache the BYTES schema.
So, the replicator tries to get the schema again and again.
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Lines 756 to 763 in eab2bb5
Modifications
The fix is the same as the normal messages with AUTO_PRODUCE producer do
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Lines 709 to 713 in eab2bb5
If the users will not change the message schema(send with bytes), the message schema is also AUTO_PRODUCE,
so the producer will not try to fetch schema from the broker.
Verifying this change
New test added.
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
Check the box below or label this PR directly.
Need to update docs?
doc-required(Your PR needs to update docs and you will update later)
doc-not-needed(Please explain why)
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)