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

MVP of smart producer #255

Merged
merged 24 commits into from
Feb 19, 2024
Merged

MVP of smart producer #255

merged 24 commits into from
Feb 19, 2024

Conversation

Zerpet
Copy link
Contributor

@Zerpet Zerpet commented Nov 17, 2023

Summary

  • Bump to Go 1.21
  • Standard producer basic functionality
  • Make batch publishing delay configurable
  • Smart Send: force send when buffer is full
  • Publish confirmation tracker
  • Add dedicated type for message confirmation
  • Message confirmations in Send
  • Add unconfirmed messages in Send batch
  • Confirm timeouts in standard producer
  • Add Producer Manager component
  • Create Producer from Environment

ToDo's

  • Re-use producer manager when its already connected to a leader
  • Create additional producer manager when there are no available
  • Connect and forward publisher confirmation to the Producer

@Zerpet Zerpet added this to the 2.0 milestone Nov 17, 2023
@Zerpet Zerpet added the v2.x Applicable to v2.x issues label Nov 17, 2023
@Zerpet Zerpet force-pushed the zerpet/wip-producer-v2 branch 2 times, most recently from a66f886 to 947e258 Compare November 17, 2023 13:30
Signed-off-by: Aitor Pérez Cedres <[email protected]>
First pass for smart producer.

Signed-off-by: Aitor Perez Cedres <[email protected]>
GA version of `slog` has a different signature for `slog.New`.
This commit updates some code that was using the old signature.

Signed-off-by: Aitor Perez Cedres <[email protected]>
Internal component to track publisher confirmations.

Signed-off-by: Aitor Perez Cedres <[email protected]>
The semaphore provides an simple mechanism to synchronise
the addition and release of pending confirmation
messages. Given how channels work in Go, the functions to
add pending confirmations will block if the semaphore
does not have more slots or permits available.

Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
Channels synchronise naturally, and also act as a synchronised
queue. Those two properties make channels an excellent choice
to implement a semaphore and a message queue buffer.

Signed-off-by: Aitor Perez Cedres <[email protected]>
We want to provide a better abstraction for message confirmations in the
smart layer. The publish confirm frame sends a potentially long list of
IDs that are confirmed. In the stream protocol, a confirm for ID N does
not confirm messages with IDs < N. Therefore, we have to keep track of
all pending publishing IDs, and associate them with their AMQP message.

Signed-off-by: Aitor Perez Cedres <[email protected]>
To use a local binary version, and avoid changing the system binary for
Ginkgo CLI that may be present. The same for MockGen.

Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
At the raw layer, the client uses two different commands for publish
confirmation and publish error. At the smart layer, we abstract that
away and consider a publish error a "nack" or negative publish
confirmation. We have to adapt the channel in the producer, so that it
can receive publish confirmations or publish errors in the same channel.

Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
This component is responsible for keeping track of producers in the
environment. This component also sends the relevant frame to the broker,
so that the server registers a new publisher.

Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
- Producer status
- Export Broker references from raw layer
- Use metadata query to connect to the stream leader

Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
Signed-off-by: Aitor Perez Cedres <[email protected]>
We started developing in Go 1.21 because slog package became GA in Go
1.21. The toolchain directive in go.mod is new and only available in Go
1.21. We have to temporarily bump the Go version in CI to 'stable'. We
will provide compatibility to oldstable at a later date.

Signed-off-by: Aitor Perez Cedres <[email protected]>
@Zerpet Zerpet force-pushed the zerpet/wip-producer-v2 branch from 7ba9e23 to 3dcf74d Compare December 15, 2023 11:15
@Zerpet Zerpet marked this pull request as ready for review December 15, 2023 15:46
@Zerpet Zerpet requested a review from ablease December 15, 2023 15:46
Signed-off-by: Aitor Perez Cedres <[email protected]>
@Zerpet Zerpet force-pushed the zerpet/wip-producer-v2 branch from 8b37fa3 to 3ccfcf2 Compare December 15, 2023 15:48
@Zerpet
Copy link
Contributor Author

Zerpet commented Dec 15, 2023

@ablease we can merge this interim work to converge our branches. Then, we can branch off again from a common point.

Skipping system tests were not actually skipping system tests.

Signed-off-by: Aitor Perez Cedres <[email protected]>
@Gsantomaggio Gsantomaggio merged commit 87a1d38 into v2 Feb 19, 2024
4 checks passed
@Gsantomaggio Gsantomaggio deleted the zerpet/wip-producer-v2 branch February 19, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2.x Applicable to v2.x issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants