Package: resource-agents
Version: 1:4.0.0~rc1-3
Severity: important
Tags: stretch, patch

Dear Maintainer,

there have been two relevant commits to the pgsql resource agent since
4.0.0rc1, which add support for quoting synchronous standby names in the
configuration.  Since Postgres-9.6 now treats the standby names as SQL
identfiers, they need to be quoted or else dashes etc. in the names will
make it break. So this should be fixed for stretch.

The relevant upstream commits are
6e91193f0e4d3f72d22564e1fe393e7391691f9d and
6ad25cf64e00cebe5d90ec96430d94a38b240d31, the latter fixes up the former
(and is not in a release yet AFAICT).

There is one other commit to the pgsql RA since 4.0.0r1 but this one
(c7bb30e9584c9613f816861f4924fe3f5154bd4f) is for support of Pacemaker
1.1.17 and up, so not needed for stretch at this point.

I've attached a debian/patches-ready patch.


Michae


-- System Information:
Debian Release: 8.7
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
commit 6e91193f0e4d3f72d22564e1fe393e7391691f9d
Author: Andreas Ntaflos <andreas.ntaf...@rise-world.com>
Date:   Mon Dec 12 14:43:59 2016 +0100

    Double-quote value of synchronous_standby_names in rep_mode.conf
    
    PostgreSQL 9.6 introduced a new syntax for specifying
    synchronous_standby_names. The old syntax, used by the pgsql RA, is
    still valid but PostgreSQL now treats the standby-names in
    synchronous_standby_names as SQL identifiers. This means such values
    need to be double-quoted since they can easily contain dashes or other
    characters that are not valid in a bare SQL identifier.
    
    See the docs for synchronous_standby_names in
    https://www.postgresql.org/docs/9.6/static/runtime-config-replication.html
    for confirmation and
    https://www.postgresql.org/message-id/21183.1481253534%40sss.pgh.pa.us
    for a short discussion.

commit 6ad25cf64e00cebe5d90ec96430d94a38b240d31
Author: Gianluca De Cicco <gnlcd...@gmail.com>
Date:   Thu Mar 23 15:12:24 2017 +0100

    fix regex in set async mode

Index: resource-agents/heartbeat/pgsql
===================================================================
--- resource-agents.orig/heartbeat/pgsql
+++ resource-agents/heartbeat/pgsql
@@ -1474,7 +1474,7 @@ set_async_mode_all() {
 }
 
 set_async_mode() {
-    cat $REP_MODE_CONF |  grep -q -e "[,' ]$1[,' ]"
+    cat $REP_MODE_CONF |  grep -q -E "(\"$1\")|([,' ]$1[,' ])"
     if [ $? -eq 0 ]; then
         ocf_log info "Setup $1 into async mode."
         runasowner -q err "echo \"synchronous_standby_names = ''\" > \"$REP_MODE_CONF\""
@@ -1493,7 +1493,7 @@ set_sync_mode() {
         ocf_log debug "$sync_node_in_conf is already sync mode."
     else
         ocf_log info "Setup $1 into sync mode."
-        runasowner -q err "echo \"synchronous_standby_names = '$1'\" > \"$REP_MODE_CONF\""
+        runasowner -q err "echo \"synchronous_standby_names = '\\\"$1\\\"'\" > \"$REP_MODE_CONF\""
         [ "$RE_CONTROL_SLAVE" = "false" ] && RE_CONTROL_SLAVE="true"
         exec_with_retry 0 reload_conf
     fi

Reply via email to