Skip to content

Zoekt Add initial_indexing task

Ravi Kumar requested to merge 442883-zoekt-add-initial_indexing-task into master

What does this MR do and why?

Add a new task initial_indexing which will move all the pending zoekt indices to initializing with an intermediate state in_progress. in_progress state is the condition when the indexing worker has been called for a zoekt_index. Also added a new worker NamespaceInitialIndexingWorker which calls index_async for each project(also sub-projects) under a namespace iteratively. The zoekt_index will be moved to initializing when the zoekt_repositories count for a namespace is greater than or equal to all the projects(including subprojects) in a namespace.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

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

Numbered steps to set up and validate the change are strongly suggested.

Query plan

SELECT
    COUNT(*)
FROM
    "projects"
WHERE
    "projects"."namespace_id" IN (
        SELECT
            namespaces.traversal_ids[array_length(namespaces.traversal_ids, 1)] AS id
        FROM
            "namespaces"
        WHERE
            "namespaces"."type" = 'Group'
            AND (traversal_ids @> ('{9970}')))

https://console.postgres.ai/shared/60088a5e-96e3-452b-ac2d-a71bfb131c3f

SELECT
    "projects"."id"
FROM
    "projects"
WHERE
    "projects"."namespace_id" = 9970

https://console.postgres.ai/shared/3a55e61a-1a6e-4ecf-9be0-d591fe992d98

SELECT
    "namespaces"."id"
FROM
    "namespaces"
WHERE
    "namespaces"."parent_id" = 9970
    AND "namespaces"."type" = 'Group'

https://console.postgres.ai/shared/c3a83379-444d-48e0-98fa-fd51b170078d

Related to #442883 (closed)

Edited by Ravi Kumar

Merge request reports