Add reindexing column in ActiveContext Code
What does this MR do and why?
We need to be able to handle force-pushes and force-reindex in general.
We settled on the solution to introduce a reindexing
flag and use this flag as such:
- During a forced reindexing (force-pushes or force-reindex), mark updated documents in the given project as
reindexing=true
- After all the documents have been updated, delete all documents in the given project with
reindexing=false
- meaning this document was not "found" during reindexing - Update all documents in the given project to
reindexing=false
- meaning we have moved back to the normal non-reindex mode
For further details on the solution, refer to gitlab-elasticsearch-indexer!704 (comment 2687184492).
Related issue: [Code indexing pipeline] Handle force_reindex (gitlab-elasticsearch-indexer#172 - closed)
Related implementation changes:
- feat: handle force reindex (gitlab-elasticsearch-indexer!704 - merged)
- Handle force pushes in Code Indexer (!200930 - merged)
References
Screenshots or screen recordings
N/A
How to set up and validate locally
-
Re-set the
gitlab_active_context_code_0
index:ActiveContext.adapter.client.client.indices.delete(index: "gitlab_active_context_code_0")
-
Re-migrate the
ActiveContext
Code collection migrations:ActiveContext::Migration::Dictionary.migrations.each do |migration_class| migration_class.new.migrate! end
-
Verify that the
gitlab_active_context_code_0
now has thereindexing
field:
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Pam Artiaga