[nexus] Remove SELECT FOR UPDATE, patch tests#6729
Merged
Conversation
smklein
commented
Oct 1, 2024
Comment on lines
+2325
to
+2326
| #[tokio::test] | ||
| async fn test_ensure_external_networking_works_with_good_target() { |
Collaborator
Author
There was a problem hiding this comment.
I split this into a new test because it's really important that we actually perform a write after checking the target in the "bad case" below.
If we don't actually perform a write, then there is no circular dependency between transactions, and CockroachDB can logically re-order the "ensure resources" task before other operations that might write to the target, regardless of when it actually happened.
jgallagher
approved these changes
Oct 1, 2024
jgallagher
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this. The comment in the reworked test is excellent.
Co-authored-by: John Gallagher <john@oxidecomputer.com>
…computer/omicron into select_for_serializability
andrewjstone
reviewed
Oct 1, 2024
|
|
||
| // Release `ensure_resources_task` to finish. | ||
| return_on_completion.store(true, Ordering::SeqCst); | ||
| // == WHAT ORDERING DO WE EXPECT? |
andrewjstone
approved these changes
Oct 1, 2024
andrewjstone
left a comment
Contributor
There was a problem hiding this comment.
Awesome stuff @smklein
hawkw
pushed a commit
that referenced
this pull request
Oct 2, 2024
Building off of: - #6229 (comment) - #6694 - https://github.com/oxidecomputer/sqldance This PR acknowledges that `SELECT FOR UPDATE` is a performance "optimization" in the situation where a blueprint's value is checked before performing a subsequent operation, as we do with setting network resources. It arguably could make performance worse in certain cases, as it locks out concurrent read operations from accessing the database. This PR removes the usage of `SELECT FOR UPDATE`, and significantly overhauls the `test_ensure_external_networking_bails_on_bad_target` test to account for the concurrent control that CockroachDB may be performing with respect to operation re-ordering. --------- Co-authored-by: John Gallagher <john@oxidecomputer.com>
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.
Building off of:
This PR acknowledges that
SELECT FOR UPDATEis a performance "optimization" in the situation where a blueprint's value is checked before performing a subsequent operation, as we do with setting network resources. It arguably could make performance worse in certain cases, as it locks out concurrent read operations from accessing the database.This PR removes the usage of
SELECT FOR UPDATE, and significantly overhauls thetest_ensure_external_networking_bails_on_bad_targettest to account for the concurrent control that CockroachDB may be performing with respect to operation re-ordering.