-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Create the users from database backend in a transaction #35561
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
Merged
Merged
Conversation
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
juliusknorr
approved these changes
Jan 12, 2023
Member
|
/rebase |
8294a74 to
0ba3e5c
Compare
0ba3e5c to
a0be051
Compare
ChristophWurst
approved these changes
Jan 12, 2023
Merged
Merged
Merged
Contributor
|
What is missing here? |
Member
|
Just a merge it seems. |
Member
|
/rebase |
In OC\User\Manager::createUserFromBackend the newly created user is read using getUserObject($uid, $backend) but that can cause causal read issues (wrote in DB primary, not yet in secondary). In OC\User\Database user backend the user cache is unset after the insert, so it can't be used by getRealUID() (which is called by getUserObject()). To avoid that we make sure the user cache is repopulated in a transaction. Signed-off-by: Thomas Citharel <[email protected]>
a0be051 to
f7e65b1
Compare
blizzz
reviewed
Mar 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Summary
In
OC\User\Manager::createUserFromBackendthe newly created user is read again usinggetUserObject($uid, $backend)but that can cause causal read issues (wrote in DB primary, not yet in secondary).In
OC\User\Databaseuser backend the user cache is unset after the insert, so it can't be used bygetRealUID()(which is called bygetUserObject()).To avoid that we make sure the user cache is repopulated in a transaction. This doesn't change the total number of queries made.
Checklist