Skip to content

Fix API docs slow migration issue

Administrator requested to merge sg/reroll into main

Created by: slimsag

This PR reintroduces #25994, which was reverted last night in #26074 as part of an incident in which the migration was too slow to succeed on Sourcegraph.com.

The actual migration was fine, and hence passed dev/CI/staging environments, but due to the scale of data on Sourcegraph.com was too slow to succeed there before Kubernetes killed the pod due to health checks.

The underlying cause was a single statement taking 4 minutes:

UPDATE lsif_data_documentation_pages SET search_indexed='false';

In this PR, we replace that statement instead with:

ALTER TABLE lsif_data_documentation_pages DROP COLUMN search_indexed;
ALTER TABLE lsif_data_documentation_pages ADD COLUMN search_indexed boolean DEFAULT 'false';

This is almost instantaneous, I have verified so on a clone of our production DB (thanks @efritz for the idea of testing this like this!)

Helps #21938

Merge request reports

Loading