-
Notifications
You must be signed in to change notification settings - Fork 56
Avoid checking a stale relationship #2949
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
Avoid checking a stale relationship #2949
Conversation
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.
Code Review
This pull request introduces several valuable improvements to the database models. It correctly fixes a bug in CoprBuildTargetModel.get_all_by by changing the sorting from build_id (a string) to id (an integer), ensuring that the latest builds are retrieved correctly. This fix is well-supported by a new test case. Furthermore, the creation logic for TFTTestRunGroupModel is now more robust against race conditions. The changes, such as using session.flush() to get object IDs within a transaction and checking for existing relationships via foreign key IDs, are excellent practices for avoiding stale data. These modifications enhance the overall correctness and reliability of the database operations.
8cfe963 to
1f95061
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 43s |
| new_run_model.copr_build_group = locked_run_model.copr_build_group | ||
| new_run_model.koji_build_group = locked_run_model.koji_build_group | ||
| new_run_model.test_run_group = test_run_group | ||
| new_run_model.test_run_group_id = test_run_group.id |
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.
Isn't this enough? Why keep the line above?
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.
I think the real problem is the if test. We end up on the wrong branch of the if. And the same PipelineModel line is overriden by the "second" task. But I may be wrong.
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.
Sure, I get that, but my comment is about recording the relationship (in either branch). Both lines do effectively the same thing, don't they?
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.
Oh ok, now I get your comment. Ok I think you are right, I think that removing the line above is safe.
1f95061 to
2052492
Compare
nforro
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.
Let's try.
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 45s |
|
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 1m 54s |
No description provided.