diff options
author | Petr Malik <pmalik@tesora.com> | 2016-10-09 13:07:24 -0400 |
---|---|---|
committer | Petr Malik <pmalik@tesora.com> | 2016-10-14 12:05:52 -0400 |
commit | 16bae26001c68aff69f64967c3c4665af4611bbe (patch) | |
tree | c3ff69b47aef9edc3556d195f7976787b3bc348e | |
parent | 4bedc8b6e0fd462a7811baa7efcc9f9a0cb5859b (diff) | |
download | trove-16bae26001c68aff69f64967c3c4665af4611bbe.tar.gz |
Fix Postgresql pg_rewind call
Removed an extra 'source-pgdata' argument and replaced
'-D' with more verbose version of the same flag.
Give the replicator user superaccess.
Change-Id: Id8e3eefad60666e73c029a03ce59e765d390e908
Closes-Bug: 1633515
-rw-r--r-- | releasenotes/notes/fix-postgres-pg-rewind-6eef0afb568439ce.yaml | 2 | ||||
-rw-r--r-- | trove/guestagent/strategies/replication/experimental/postgresql_impl.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/releasenotes/notes/fix-postgres-pg-rewind-6eef0afb568439ce.yaml b/releasenotes/notes/fix-postgres-pg-rewind-6eef0afb568439ce.yaml new file mode 100644 index 00000000..980ec567 --- /dev/null +++ b/releasenotes/notes/fix-postgres-pg-rewind-6eef0afb568439ce.yaml @@ -0,0 +1,2 @@ +fixes: + - Fix Postgresql promote (bug 1633515). diff --git a/trove/guestagent/strategies/replication/experimental/postgresql_impl.py b/trove/guestagent/strategies/replication/experimental/postgresql_impl.py index e0b1e3a1..855b48fb 100644 --- a/trove/guestagent/strategies/replication/experimental/postgresql_impl.py +++ b/trove/guestagent/strategies/replication/experimental/postgresql_impl.py @@ -143,7 +143,8 @@ class PostgresqlReplicationStreaming(base.Replication): repl_user = models.PostgreSQLUser(name=REPL_USER, password=pw) admin._create_user(context=None, user=repl_user) - admin.alter_user(None, repl_user, True, 'REPLICATION', 'LOGIN') + admin.alter_user(None, repl_user, True, + 'REPLICATION', 'SUPERUSER', 'LOGIN') return pw @@ -219,8 +220,8 @@ class PostgresqlReplicationStreaming(base.Replication): tmprec = "/tmp/recovery.conf.bak" operating_system.move(rec, tmprec, as_root=True) - cmd_full = " ".join(["pg_rewind", "-D", service.pgsql_data_dir, - '--source-pgdata=' + service.pgsql_data_dir, + cmd_full = " ".join(["pg_rewind", + '--target-pgdata=' + service.pgsql_data_dir, '--source-server=' + conninfo]) out, err = utils.execute("sudo", "su", "-", service.pgsql_owner, "-c", "%s" % cmd_full, check_exit_code=0) |