fix: index and entity link sync issues on parent block deletion#37541
fix: index and entity link sync issues on parent block deletion#37541ChrisChV merged 7 commits intoopenedx:masterfrom
Conversation
Use `breadcrumbs` field in meilisearch index to filter blocks containing this parent and delete them.
|
Thanks for the pull request, @navinkarkera! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
268bc61 to
976f4b4
Compare
| Fields.last_published, | ||
| Fields.content + "." + Fields.problem_types, | ||
| Fields.publish_status, | ||
| Fields.breadcrumbs + "." + Fields.usage_key, |
There was a problem hiding this comment.
Just want to note this: we had to include breadcrumbs in filterable field list, and I think change requires a reindex.
There was a problem hiding this comment.
How can we handle this kind of change in a production environment? Should we create a "migration' to force the reindex?
There was a problem hiding this comment.
If you run reindex_studio --init, which should run on any deployment, it will warn you that the index needs to be rebuilt, because of this code: https://github.com/openedx/edx-platform/blob/3dc96a97e99b90060c14f5b8d5b580fcef8287eb/openedx/core/djangoapps/content/search/api.py#L350-L397
But the whole thing is pretty messy right now, and we need to clean it up eventually: #36868
rpenido
left a comment
There was a problem hiding this comment.
LGTM 👍
Thank you for your work, @navinkarkera!
- I tested this using the instructions from the PR
- I read through the code
- I checked for accessibility issues
- Includes documentation
| Fields.last_published, | ||
| Fields.content + "." + Fields.problem_types, | ||
| Fields.publish_status, | ||
| Fields.breadcrumbs + "." + Fields.usage_key, |
There was a problem hiding this comment.
How can we handle this kind of change in a production environment? Should we create a "migration' to force the reindex?
|
@navinkarkera Could you update the testing instructions, including that we need to create/delete the containers on a Course (and not on a Library)? |
…edx#37541) Meilisearch index documents were not synced properly when any block with children blocks like units, subsections, sections etc. were being deleted as the `XBLOCK_DELETED` is only triggered for the deleted block. This PR fixes it by deleting all index documents that contain the deleted block in its `breadcrumbs` field as only blocks that are children of this block will have it its breadcrumbs field. Similarly, the entity links that store links between course and library blocks was not synced properly due to children `ContainerLinks` not being deleted.
Description
Meilisearch index documents were not synced properly when any block with children blocks like units, subsections, sections etc. were being deleted as the
XBLOCK_DELETEDis only triggered for the deleted block.This PR fixes it by deleting all index documents that contain the deleted block in its
breadcrumbsfield as only blocks that are children of this block will have it its breadcrumbs field.Similarly, the entity links that store links between course and library blocks was not synced properly due to children
ContainerLinksnot being deleted.Useful information to include:
Supporting information
Private-ref: https://tasks.opencraft.com/browse/FAL-4267Testing instructions
admin/contentstore/containerlink/and verify that the container links are created.tutor dev run cms ./manage.py cms reindex_studio --experimental --resetandtutor dev run cms ./manage.py cms reindex_studio --experimentalbreadcrumbs.usage_keyfield to filterable fields list.Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Include anything else that will help reviewers and consumers understand the change.