Prepare issues bigint indexes batch two

What does this MR do and why?

Asynchronously prepares the bigint indexes for batch two of the issues integer ID to bigint conversion, tracked in #629828.

Following the agreed batch split, the work is divided by column to keep the peak number of duplicate indexes low during the transition:

  • Batch one — the six free single-column FK columns (closed_by_id, duplicated_to_id, last_edited_by_id, moved_to_id, promoted_to_epic_id, updated_by_id). Merged.
  • Batch two — id on its own, together with every index that contains it (this batch).
  • Batch three — project_id, milestone_id, author_id.

This is the first MR for batch two. It only queues the indexes; it does not build them. They are created by the async index worker, then created synchronously in a follow-up MR once the builds are confirmed. This mirrors the batch one prepare MR (!251347 (merged)) and the merge_requests stage three equivalent.

Batch two targets the 19.5 milestone end to end (prepare, sync creation, incoming foreign keys, swap, and cleanup of temporary objects).

Indexes prepared (13)

All are prepared against id_convert_to_bigint:

Index Notes
issues_pkey prepared as a unique index; becomes the primary key during the swap
index_issues_on_id_and_weight
index_issues_on_namespace_id_created_at_id_state_id
index_issues_on_namespace_id_relative_position_id_state_id
index_issues_on_namespace_id_updated_at_id_state_id
index_issues_on_milestone_id_and_id shared with batch three
idx_issues_on_project_id_and_created_at_and_id_and_state_id shared with batch three
idx_issues_on_project_id_and_due_date_and_id_and_state_id shared with batch three
idx_issues_on_project_id_and_rel_position_and_id_and_state_id shared with batch three
idx_issues_on_project_id_and_updated_at_and_id_and_state_id shared with batch three
index_issues_on_project_id_closed_at_desc_state_id_and_id shared with batch three; keeps closed_at DESC NULLS LAST
idx_open_issues_on_project_and_confidential_and_author_and_id shared with batch three
index_open_issues_on_namespace_id_confidential_author_id_id shared with batch three

The eight indexes shared with batch three are prepared here in their current shape (only id swapped to bigint) and will be rebuilt in their final shape in batch three. Rebuilding them twice is the deliberate trade for a lower peak duplicate-index count, as discussed on the work item.

Each index is prepared under bigint_index_name(<original name>), which produces a bigint_idx_* name.

Migration output

db/structure.sql is unchanged: preparing an async index does not modify the schema, and the id_convert_to_bigint column is not part of the committed schema.

Follow-up

Once the async builds are confirmed on GitLab.com, a follow-up MR creates the indexes synchronously, then further MRs add the incoming foreign keys on issues.id, perform the swap, and drop the temporary objects.

MR acceptance checklist

  • Database review requested — asynchronous index preparation only, no synchronous DDL.
Edited by Mario Celi

Merge request reports

Loading
Loading