-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix: sometimes, changes to subsections are not reflected in the Studio Search Index #34800
Fix: sometimes, changes to subsections are not reflected in the Studio Search Index #34800
Conversation
Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
87b52e1
to
807fc26
Compare
d11a5de
to
3b28599
Compare
Initially we used `_get_bulk_ops_record()` however that had side-effects of creating records since it uses a defaultdict internally. So we swapped the implementation similar how we check in `_clear_bulk_ops_record()`
3b28599
to
57043cb
Compare
@ormsbee Would you be able to review this PR? We'd also like to backport it to Redwood, as it's a bugfix. |
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.
@yusuf-musleh Looks good 👍
- I tested this: I followed the testing instructions with: Sections, Units and components
- I read through the code and considered the security, stability and performance implications of the changes.
- I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
- Includes tests for bugfixes and/or features added.
- Includes documentation
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.
Nice! This is honestly a lot cleaner than I thought it would be when you described the problem. 😛
Haha yeah @ormsbee I'm happy with how the fix shaped up; we were able to implement it without needing to change too much. |
@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
…enedx#34800) Co-authored-by: Yusuf Musleh <[email protected]>
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
…4800) Co-authored-by: Yusuf Musleh <[email protected]>
Description
There is a race condition that causes some changes to not be reflected in the Studio search index.
Technical Details
What's happening is that the XBlock is updated with
modulestore.update_item()
in the initial request, that function immediately triggers theXBLOCK_UPDATED
signal. However, when our handler processes that in a worker, even though there is no active MySQL transaction, the modulestore "bulk operation" may still be active, so the actual modulestore data in mongo/mysql hasn't been updated yet. The data only gets committed when the outermost bulk operation scope is exited.I couldn't find any existing mechanism to listen for that "actual commit" of draft content, because the code seems to assume that other parts of the system only need to know when new content has been published, not when new draft content has been committed to the DB. So I had to add that as a new capability.
Testing instructions
In
cms/envs/devstack.py
setCELERY_ALWAYS_EAGER = False
.We have focused testing on renaming subsections, but this likely affects other types of edits.
Deadline
TBD