Skip to content

Issues not updated in the index when labels are deleted

What does this MR do and why?

When the Label gets deleted then we should remove this label_id from the label_ids field in the issues index.

Override LabelLink model in ee. Add an after_destroy callback to call Elastic::ProcessBookkeepingService on Issue. label_id is also stored for epics. I suspect this bug is for epics also. I will create a new issue for epics.

I could not use after_destroy_commit because LabelLink is importing BulkInsertSafe which does not allows to use any callbacks for commit.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Make sure elasticsearch is enabled.

  1. Pick any issue on the gdk. Attach any label to it.
  2. Check on the elastic search that the label_ids in the issues index has an array of all the labels attached to this issue.
  3. Now delete any label that is attached to this issue from the Manage>Labels section.
  4. Now verify on Elasticsearch that deleted label is not in the array of label_ids. It might take few extra seconds to reflect the changes in the elasticsearch.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #416091 (closed)

#424127 (closed)

Edited by Ravi Kumar

Merge request reports

Loading