Skip to content

Search::IndexRepairService still using Repository index for projects

What does this MR do and why?

index_name was set to Repository.__elasticsearch__.index_name which is wrong when projects use a separate index. So replaced it with Project.index_name which gives the correct value based on the status of the migration migrate_projects_to_separate_index

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 the elasticsearch is enabled

  1. Open rails console: rails c
  2. Get an existing project: p = Project.last
  3. Kick off the repair service: Search::IndexRepairService.execute(p)
  4. Verify in the logs/elasticsearch.log that the project is queued for indexing and the following log is not present.
{
  "severity": "WARN",
  "time": "2023-10-25T19:22:51.599Z",
  "class": "Search::IndexRepairService",
  "message": "project document missing from index",
  "namespace_id": 71,
  "root_namespace_id": 71,
  "project_id": 28
}
{
  "severity": "DEBUG",
  "time": "2023-10-25T19:22:51.608Z",
  "class": "Elastic::ProcessBookkeepingService",
  "redis_set": "elastic:incremental:updates:0:zset",
  "message": "track_items",
  "count": 1,
  "tracked_items_encoded": "[[97,\"Project 28 project_28\"]]"
}

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 #429456 (closed)

Edited by Ravi Kumar

Merge request reports