Skip to content

Properly return PostgreSQL errors on geo-replication-resume

What does this MR do?

Before this PR, the exception included the stdout of the query execution. This wasn't helpful because on errors, psql logs to stderr:

root@foo.gitlab01:~# gitlab-psql 'SELECT foo;' > /dev/null
psql: error: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
root@foo.gitlab01:~# gitlab-psql 'SELECT foo;' 2> /dev/null

This led to the unhelpful error message:

root@foo.gitlab01:~# gitlab-ctl geo-replication-resume
* Resume replication
Postgres encountered an error: Unable to resume postgres replication

With the new stderr logging, this will look like this:

root@foo.gitlab01:~# gitlab-ctl geo-replication-resume
* Resume replication
Postgres encountered an error:
 Unable to resume postgres replication psql: error: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?

Related issues

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened
Edited by Jason Plum

Merge request reports