Create tag relations one by one, and use CTEs to minimize queries doing so#3043
Merged
rtibbles merged 1 commit intolearningequality:hotfixesfrom Mar 26, 2021
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## hotfixes #3043 +/- ##
============================================
+ Coverage 85.71% 85.76% +0.05%
============================================
Files 298 298
Lines 15879 15943 +64
============================================
+ Hits 13611 13674 +63
- Misses 2268 2269 +1
Continue to review full report at Codecov.
|
rtibbles
approved these changes
Mar 26, 2021
Member
rtibbles
left a comment
There was a problem hiding this comment.
Tag creation has good test coverage, and the code seems logical to me!
This was referenced Mar 26, 2021
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.
Summary
We're receiving quite a bit of Sentry errors for attempts to create duplicate tags and tag-node relationships. This PR moves to creating them one by one, as @rtibbles suggested, but also uses a more complex, single, query to obtain all of the necessary information to create the tags and relations. It may still encounter attempts to duplicate tags or relations due to more than one user attempting to create the same tag at the same time, but since it uses
get_or_createit shouldn't error any longer.Description of the change(s) you made
django_cteto support thisWithclasses to pass along other join types than justINNERorLOUTER, which in combination with a CTE values list can be a powerful tool by usingRIGHTorFULLjoinsManual verification steps performed
Reviewer guidance
How can a reviewer test these changes?
References
Addresses: #2826
Contributor's Checklist
Testing:
Reviewer's Checklist
This section is for reviewers to fill out.
yarnandpip)