Skip to content
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

PIP-161 Exclusive Producer: new mode ExclusiveWithFencing #15528

Closed
eolivelli opened this issue May 10, 2022 · 2 comments
Closed

PIP-161 Exclusive Producer: new mode ExclusiveWithFencing #15528

eolivelli opened this issue May 10, 2022 · 2 comments
Assignees
Milestone

Comments

@eolivelli
Copy link
Contributor

Motivation

In PIP-68 we introduced two access modes for the Producer:

  • Exclusive: The producer is the only one who can publish to the topic. Fail if there is another Exclusive Producer connected to the topic while creating the new Producer.
  • WaitForExclusive: Like Exclusive, but instead of Failing we are going to wait for the current Exclusive Producer to disconnect.

Those two modes are very powerful and allow you to perform some kind of Locking on a topic.

We are missing a third more, in which the Producer always succeeds to acquire the Exclusive lock on the topic by fencing out any other Producer that is connected, even the current Exclusive Producer and the other Producers waiting in WaitForExclusive mode.

Goal

The modes that are available with PIP-68 require a writer to acquire the lock and release it as soon as possible in order to allow other clients to write to the topic.

With the new mode it will be possible to implement locking in another way: the Producer holds the lock until someone else steals it. This way when you have very low contention you can achieve better latency for writes because you don't have to acquire the lock every time you want to write,.

API and Wire protocol Changes

Changes:

  • a new constant on the Wire Protocol for AccessMode
  • a new constant in the Java Client API AccessMode#ExclusiveWithFencing

Implementation

The new mode will behave mostly like AccessMode#Exclusive but instead of failing in case of the presence of other Producers it will force all of the current connected Producers to be removed and invalidated (they will see ProducerFencedException).

Reject Alternatives

None

@eolivelli eolivelli changed the title PIP-157 Exclusive Producer: new mode ExclusiveWithFencing PIP-161 Exclusive Producer: new mode ExclusiveWithFencing May 10, 2022
@eolivelli eolivelli self-assigned this May 11, 2022
@eolivelli eolivelli added this to the 2.11.0 milestone May 11, 2022
@github-actions
Copy link

The issue had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Jun 11, 2022
@eolivelli
Copy link
Contributor Author

This has been delivered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant