Modify the replication slot name conversion in sample scripts to add support for...
authorBo Peng <pengbo@sraoss.co.jp>
Fri, 17 Nov 2023 03:46:54 +0000 (12:46 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Fri, 17 Nov 2023 03:46:54 +0000 (12:46 +0900)
Patch in created by Sheikh Wasiu Al Hasib and modified by Be Peng.

src/sample/scripts/failover.sh.sample
src/sample/scripts/follow_primary.sh.sample
src/sample/scripts/recovery_1st_stage.sample

index 11a8b96f7f54c3f3d2d1171b76de4c415fb56dac..bc47b21b7fc8b0fff6d30c1d98ddfb3f5afc1271 100755 (executable)
@@ -32,7 +32,7 @@ OLD_PRIMARY_NODE_HOST="${11}"
 OLD_PRIMARY_NODE_PORT="${12}"
 
 PGHOME=/usr/pgsql-16
-REPL_SLOT_NAME=${FAILED_NODE_HOST//[-.]/_}
+REPL_SLOT_NAME=$(echo ${FAILED_NODE_HOST,,} | tr -- -. _)
 POSTGRESQL_STARTUP_USER=postgres
 SSH_KEY_FILE=id_rsa_pgpool
 SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/${SSH_KEY_FILE}"
index 2a04e33cf4dba53d8eb354c7bc12d65346565f57..de0ae0004c636a94bb02636563bba0bede99e6f1 100755 (executable)
@@ -36,7 +36,7 @@ REPLUSER=repl
 PCP_USER=pgpool
 PGPOOL_PATH=/usr/bin
 PCP_PORT=9898
-REPL_SLOT_NAME=${NODE_HOST//[-.]/_}
+REPL_SLOT_NAME=$(echo ${NODE_HOST,,} | tr -- -. _)
 POSTGRESQL_STARTUP_USER=postgres
 SSH_KEY_FILE=id_rsa_pgpool
 SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/${SSH_KEY_FILE}"
index a01b737855016399d9534b88edcb09b88bb1c477..7e462d1d893d9f7f522f502b30a4b764ba58f4b3 100755 (executable)
@@ -14,7 +14,7 @@ PRIMARY_NODE_HOST="$7"
 PGHOME=/usr/pgsql-16
 ARCHIVEDIR=/var/lib/pgsql/archivedir
 REPLUSER=repl
-REPL_SLOT_NAME=${DEST_NODE_HOST//[-.]/_}
+REPL_SLOT_NAME=$(echo ${DEST_NODE_HOST,,} | tr -- -. _)
 POSTGRESQL_STARTUP_USER=postgres
 SSH_KEY_FILE=id_rsa_pgpool
 SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/${SSH_KEY_FILE}"