Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Failed to parse pg_controldata output #26

Closed
meiyifei opened this issue Jun 18, 2019 · 2 comments · Fixed by #27
Closed

BUG: Failed to parse pg_controldata output #26

meiyifei opened this issue Jun 18, 2019 · 2 comments · Fixed by #27
Assignees
Labels
bug Something isn't working

Comments

@meiyifei
Copy link

meiyifei commented Jun 18, 2019

[postgres@test1 ~]$ pg_autoctl create monitor --pgdata ./pgdata
10:59:54 INFO  Initialising a PostgreSQL cluster at "./pgdata"
10:59:54 INFO  Now using absolute pgdata value "/home/postgres/pgdata" in the configuration
10:59:54 INFO   /usr/pgsql-11/bin/pg_ctl --pgdata ./pgdata --options "-p 5432" --options "-h *" --wait start
10:59:54 ERROR Failed to parse pg_controldata output
10:59:54 FATAL Failed to discover PostgreSQL setup, please fix previous errors.
10:59:54 FATAL Failed to initialise a monitor node, see above for details
@meiyifei
Copy link
Author

meiyifei commented Jun 18, 2019

[resolve]:

$sudo localectl set-locale LANG=en_US.utf8

reboot

[postgres@test1 ~]$ echo $LANG
en_US.utf8
[postgres@test1 ~]$ pg_autoctl create monitor --pgdata ./pgdata
11:40:37 INFO  Initialising a PostgreSQL cluster at "./pgdata"
11:40:37 INFO  Now using absolute pgdata value "/home/postgres/pgdata" in the configuration
11:40:37 INFO   /usr/pgsql-11/bin/pg_ctl --pgdata ./pgdata --options "-p 5432" --options "-h *" --wait start
11:40:38 INFO  Granting connection privileges on 192.168.0.0/22
11:40:38 INFO  Your pg_auto_failover monitor instance is now ready on port 5432.
11:40:38 INFO  pg_auto_failover monitor is ready at postgres://autoctl_node@test1:5432/pg_auto_failover
11:40:38 INFO  Monitor has been succesfully initialized.

@DimCitus
Copy link
Collaborator

Hi @meiyifei !

So it seems that the problem is with ERROR Failed to parse pg_controldata output then. We should probably force the LANG environment to be set to C when we parse the output of the PostgreSQL commands run internally in pg_autoctl.

Thanks for your feedback. Marking this issue as a bug and assigning it to the next release, I think we should be able to have a fix that soon!

@DimCitus DimCitus added this to the pg_auto_failover 1.0.3 milestone Jun 18, 2019
@DimCitus DimCitus self-assigned this Jun 18, 2019
@DimCitus DimCitus added the bug Something isn't working label Jun 18, 2019
@DimCitus DimCitus changed the title 【failed】Failed to get PGDATA either from the environment or from --pgdata BUG: Failed to parse pg_controldata output Jun 18, 2019
DimCitus pushed a commit that referenced this issue Jun 19, 2019
We parse the output of pg_controldata and expect English output. Force the
environment to be in C locale when calling pg_controldata so that we do not
depend on the user locale settings here.

The other output parsing we do is on pg_ctl --version, where we only parse
the version string. As that's only digits and dots ([[:digit:].]+), we don't
need to set the LANG=C in that case. I think. At least this patch does
nothing for this case.

Fix #26.
DimCitus added a commit that referenced this issue Jun 20, 2019
We parse the output of pg_controldata and expect English output. Force the
environment to be in C locale when calling pg_controldata so that we do not
depend on the user locale settings here.

The other output parsing we do is on pg_ctl --version, where we only parse
the version string. As that's only digits and dots ([[:digit:].]+), we don't
need to set the LANG=C in that case. I think. At least this patch does
nothing for this case.

Fix #26.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants