Skip to content

Use UUID v7 and improve dequeue retry tracking#135

Open
jeanmartins wants to merge 7 commits into
microsoft:mainfrom
jeanmartins:main
Open

Use UUID v7 and improve dequeue retry tracking#135
jeanmartins wants to merge 7 commits into
microsoft:mainfrom
jeanmartins:main

Conversation

@jeanmartins

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings June 19, 2026 16:16
@jeanmartins

Copy link
Copy Markdown
Contributor Author

@cgillum could you review this PR, please?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, SequenceNumber to group related orchestrations (e.g., parent + sub-orchestrations).
  • Rework Postgres orchestration dequeue to compute RetryCount from the maximum DequeueCount across 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.

Comment thread internal/helpers/history.go
Comment thread backend/postgres/postgres.go
Comment thread internal/helpers/worker.go Outdated
Comment thread samples/parallel/parallel.go Outdated
Comment thread client/client_grpc.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Comment thread internal/helpers/history.go
Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants