• Yorick Peterse's avatar
    Reduce UPDATEs for background column type changes · 0054d383
    Yorick Peterse authored
    Prior to this commit we would essentially update all rows in a table,
    even those where the source column (e.g. `issues.closed_at`) was NULL.
    This in turn could lead to statement timeouts when using the default
    batch size of 10 000 rows per job.
    
    To work around this we don't schedule jobs for rows where the source
    value is NULL. We also don't update rows where the source column is NULL
    (as an extra precaution) or the target column already has a non-NULL
    value. Using this approach it should be possible to update 10 000 rows
    in the "issues" table in about 7.5 - 8 seconds.
    
    Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/42158
    0054d383