Use UUID v7 and improve dequeue retry tracking#135
Open
jeanmartins wants to merge 7 commits into
Open
Conversation
Contributor
Author
|
@cgillum could you review this PR, please? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates orchestration instance ID generation to UUID v7 and adjusts Postgres dequeue behavior so retry counts reflect how many times events have been selected for processing, improving fairness/grouping and retry tracking in the work-item pipeline.
Changes:
- Switch instance ID generation to UUID v7 (including client-side scheduling paths).
- Update Postgres queue ordering to
ORDER BY InstanceID, SequenceNumberto group related orchestrations (e.g., parent + sub-orchestrations). - Rework Postgres orchestration dequeue to compute
RetryCountfrom the maximumDequeueCountacross dequeued events.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/parallel/parallel.go | Uses UUID v7 for sample device IDs. |
| internal/helpers/worker.go | Uses UUID v7 in default worker name generation. |
| internal/helpers/history.go | Uses UUID v7 for ExecutionId in execution-start events. |
| client/client_grpc.go | Uses UUID v7 for gRPC client instance ID generation. |
| backend/client.go | Uses UUID v7 for in-proc backend client instance ID generation. |
| backend/postgres/postgres.go | Uses UUID v7 in backend worker name; changes work-item ordering; updates dequeue/retry tracking. |
| go.mod | Bumps github.com/google/uuid to v1.6.0 (for UUID v7 support). |
| go.sum | Adds checksums for github.com/google/uuid v1.6.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changed the UUID to UUID v7 to prioritize orchestrators and sub-orchestrators that belong to the same group. Previously, when a new sub-orchestrator was started, it would go to the end of the queue, even though it is part of the main orchestration.
Additionally, the dequeue method was changed. rawEvents is a temporary structure that collects events from the database (binary payload + attempt counter). dequeue (DequeueCount) tracks how many times each event has been selected for processing. The highest value among the events defines the RetryCount of the work item, enabling retry logic based on previous attempts.