Skip to content

Commit 5a3a98a

Browse files
committed
pgsql: Move the tmpdir creation process to the start action
1 parent 87ee5e0 commit 5a3a98a

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

heartbeat/pgsql

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,11 @@ user_recovery_conf() {
16091609
}
16101610

16111611
make_recovery_conf() {
1612+
if ! mkdir -p $OCF_RESKEY_tmpdir || ! chown $OCF_RESKEY_pgdba $OCF_RESKEY_tmpdir || ! chmod 700 $OCF_RESKEY_tmpdir; then
1613+
ocf_exit_reason "Can't create directory $OCF_RESKEY_tmpdir or it is not readable by $OCF_RESKEY_pgdba"
1614+
return 1
1615+
fi
1616+
16121617
runasowner "touch $RECOVERY_CONF"
16131618
if [ $? -ne 0 ]; then
16141619
ocf_exit_reason "Can't create recovery.conf."
@@ -1977,26 +1982,13 @@ validate_ocf_check_level_10() {
19771982
fi
19781983
fi
19791984
fi
1980-
if ! mkdir -p $OCF_RESKEY_tmpdir || ! chown $OCF_RESKEY_pgdba $OCF_RESKEY_tmpdir || ! chmod 700 $OCF_RESKEY_tmpdir; then
1981-
ocf_exit_reason "Can't create directory $OCF_RESKEY_tmpdir or it is not readable by $OCF_RESKEY_pgdba"
1982-
return $OCF_ERR_PERM
1983-
fi
19841985
fi
19851986

19861987
if [ "$OCF_RESKEY_rep_mode" = "slave" ]; then
19871988
if ocf_is_ms; then
19881989
ocf_exit_reason "Replication(rep_mode=slave) does not support Master/Slave configuration."
19891990
return $OCF_ERR_CONFIGURED
19901991
fi
1991-
# For slave mode in PostgreSQL 12 and later, create the tmp directory to place recovery.conf.
1992-
ocf_version_cmp "$version" "12"
1993-
rc=$?
1994-
if [ $rc -eq 1 ]||[ $rc -eq 2 ]; then # PosrgreSQL 12 or later.
1995-
if ! mkdir -p $OCF_RESKEY_tmpdir || ! chown $OCF_RESKEY_pgdba $OCF_RESKEY_tmpdir || ! chmod 700 $OCF_RESKEY_tmpdir; then
1996-
ocf_exit_reason "Can't create directory $OCF_RESKEY_tmpdir or it is not readable by $OCF_RESKEY_pgdba"
1997-
return $OCF_ERR_PERM
1998-
fi
1999-
fi
20001992
fi
20011993

20021994
if use_replication_slot; then

0 commit comments

Comments
 (0)