-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Function Workers to use exclusive producer to write to internal topics #9275
Enable Function Workers to use exclusive producer to write to internal topics #9275
Conversation
.supplier(() -> { | ||
try { | ||
Producer<byte[]> producer = client.newProducer().topic(topic) | ||
.accessMode(ProducerAccessMode.Exclusive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use WaitForExclusive
here? So that the producer instance will stay pending until it becomes the leader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is a good idea for "liveness" is we block forever which may cause deadlocks. While blocking, the worker might be not even be the leader anymore. I think we should keep retrying and periodically check if we are still the leader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @jerrypeng
try { | ||
Producer<byte[]> producer = client.newProducer().topic(topic) | ||
.accessMode(ProducerAccessMode.Exclusive) | ||
.enableBatching(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you remember if there was any reason for not using batching here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not. We could enable it but I wouldn't expect much benefit as we are not exactly optimizing for metadata operation throughput. For debugging it is a little easier without batching as you will know exactly how many messages are in the internal topics.
What happens if the broker is still on an old version that does not support ExclusiveProducer mode ? |
If the broker hasn't been updated and does not support exclusive producing mode, the client can still connect and produce but exclusivity is not guaranteed |
Thanks. Makes sense |
17cd361
to
2fc028a
Compare
58062fd
to
b893b48
Compare
…l topics (apache#9275) Co-authored-by: Jerry Peng <jerryp@splunk.com>
Motivation
To maintain correctness, we need to use exclusive producer to write to the internal topics Pulsar Functions to manage metadata / state.