• Stan Hu's avatar
    Log PostgreSQL errors · 35a0af92
    Stan Hu authored
    Flag errors from psql when restoring from backups
    
    When a database restore from PostgreSQL finishes, it's easy to miss
    important errors that cause significant issues down the road. For
    example, in https://gitlab.com/gitlab-org/gitlab/-/issues/36405, the
    primary key constraint in `application_settings` was not able to be
    created due to duplicate keys present.
    
    With this change, we now:
    
    1. Track all messages from stderr
    
    2. Filter out messages with `does not exist`. These are present because
    `pg_dump` is run with the `--clean` argument to issue DROP statements,
    but `--if-exists` will filter this out automatically
    (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40792).
    
    3. If there are any error messages, play them back to the user with
    a warning that these errors may impact GitLab.
    
    4. Prompt the user to continue.
    35a0af92
task_helpers.rb 5.87 KB