-
Notifications
You must be signed in to change notification settings - Fork 41
Merge operation recorders #199
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
base: main
Are you sure you want to change the base?
Merge operation recorders #199
Conversation
maxdml
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shirzady1934 for the PR.
| isGetResult: true, | ||
| stepName: "DBOS.getResult", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to use the stepName to determine whether this is a get result step (no need for isGetResult). (We also don't need the on conflict cause.)
| conflictClause := "" | ||
| if input.isGetResult { | ||
| conflictClause = "ON CONFLICT DO NOTHING" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want that -- this was a bug in record child result and we should absolutely let conflicts return errors (which are caught later in this function)
| require.Eventually(t, func() bool { | ||
| args := append([]string{"workflow", "list", "--queue", "example-queue"}, baseArgs...) | ||
| cmd := exec.Command(cliPath, args...) | ||
| cmd.Env = append(os.Environ(), "DBOS_SYSTEM_DATABASE_URL="+getDatabaseURL(dbRole)) | ||
|
|
||
| output, err := cmd.CombinedOutput() | ||
| if err != nil { | ||
| return false | ||
| } | ||
| var workflows []dbos.WorkflowStatus | ||
| err = json.Unmarshal(output, &workflows) | ||
| if err != nil { | ||
| return false | ||
| } | ||
| return len(workflows) >= 10 | ||
| }, 5*time.Second, 500*time.Millisecond, "Should find at least 10 workflows in the queue") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
This PR addresses issue #148 by refactoring the system database to merge the functionality of
recordChildGetResultintorecordOperationResult.The
recordOperationResultfunction has been updated to handle the parent-child relationship by accepting achildWorkflowID. TherecordChildGetResultfunction has been removed, and its call sites have been updated to use the newrecordOperationResult.During the development process, a few other issue were identified and resolved a bug in the dynamic SQL query construction in the refactored
recordOperationResultfunction was fixed.Additionally, this PR addresses a race condition in the CLI integration tests that was causing flaky test runs. The tests were failing because they were checking for queued workflows before the parent workflow had finished enqueueing them. A polling mechanism has been added to wait until the expected number of workflows are present in the queue before proceeding with the assertions.