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

Add last BuildID to workflow info #1335

Merged
merged 6 commits into from
Jan 5, 2024

Conversation

Sushisource
Copy link
Member

What was changed

Add the BuildID of the last completed task to info. Importantly this does not use the worker's current build id if it isn't in history, as that would be nondeterministic, unlike Binary Checksum which is guaranteed to be set as soon as the first WFT is completed which is not the case here.

Why?

Useful

Checklist

  1. Part of [Feature Request] Expose build ID via WorkflowInfo. features#253

  2. How was this tested:
    Added IT

  3. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner January 4, 2024 01:10
@Sushisource Sushisource marked this pull request as draft January 4, 2024 01:21
@Sushisource
Copy link
Member Author

Realized I did this a bit of a silly way at first. Draft while I fix it.

internal/internal_task_handlers.go Outdated Show resolved Hide resolved
ts.Equal("1.0", lastBuildID)

// Add new compat ver
err = ts.client.UpdateWorkerBuildIdCompatibility(ctx, &client.UpdateWorkerBuildIdCompatibilityOptions{
Copy link
Member

Choose a reason for hiding this comment

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

nit: this doesn't require versioning to test, you can use build ID with unversioned workers.

Copy link
Member

Choose a reason for hiding this comment

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

Could make sense to test with and without versioning just to be safe.

Copy link
Member Author

@Sushisource Sushisource Jan 4, 2024

Choose a reason for hiding this comment

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

The bit you reviewed is subtly wrong in terms of querying on a cached worker after the worker has completed a task with its' ID. New test also makes sure the first task doesn't have an ID, which covers this path.

(will need another update to fix the problem I mention)

@Sushisource Sushisource marked this pull request as ready for review January 4, 2024 18:30
@Sushisource Sushisource force-pushed the add-build-id-wfinfo branch 2 times, most recently from 0626a9f to fdc5610 Compare January 4, 2024 22:10
// GetCurrentBuildID returns the Build ID of the worker that processed this task, which may be
// empty. During replay this id may not equal the id of the replaying worker. If not replaying and
// this worker has a defined Build ID, it will equal that ID. It is safe to use for branching.
func (wInfo *WorkflowInfo) GetCurrentBuildID() string {
Copy link
Contributor

@Quinn-With-Two-Ns Quinn-With-Two-Ns Jan 4, 2024

Choose a reason for hiding this comment

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

May want to add a note for queries. Since they are not replaying, but also not using the current workers build ID.

@@ -1016,6 +1026,11 @@ ProcessEvents:
} else {
w.workflowInfo.BinaryChecksum = binaryChecksum
}
if isReplay {
w.workflowInfo.currentTaskBuildID = currentBuildID
} else if !isReplay && !isQueryOnlyTask {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a comment here explaining why a query only task is treated special.

@Sushisource Sushisource enabled auto-merge (squash) January 5, 2024 01:06
@Sushisource Sushisource merged commit 2f61d2f into temporalio:master Jan 5, 2024
12 checks passed
@Sushisource Sushisource deleted the add-build-id-wfinfo branch January 5, 2024 02:06
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.

3 participants