Skip to content

Zoekt data is not getting deleted when elasticsearch_indexing? is false in application settings

Summary

We are deleting the zoekt data in the maintain_elasticsearch_destroy here: https://gitlab.com/gitlab-org/gitlab/-/blob/bad10ba535b2bcc74f68108e680ce5e4a5396a38/ee/app/models/concerns/elastic/projects_search.rb#L53

And this callback depends on a condition after_commit :maintain_elasticsearch_destroy, on: :destroy, if: :maintaining_elasticsearch? That means if an admin user disables elasticsearch from the admin settings, zoekt data cannot be deleted on the project deletion.

Steps to reproduce

Prerequisite: Zoekt should be enabled.

Disable the elasticsearch(make elasticsearch_indexing? to false) from the admin settings. Now delete a Zoekt project immediately. All the Zoekt data is not getting deleted.

What is the current bug behavior?

On the deletion of a zoekt project the zoekt data is not getting deleted if the admin has disabled the elasticsearch

What is the expected correct behavior?

On the deletion of a zoekt project the zoekt data should get deleted even if the admin has disabled the elasticsearch

Relevant logs and/or screenshots

Possible fixes

Edited by Ravi Kumar