Skip to content

Commit 923c776

Browse files
committed
Add --wait --timeout options for pg_ctl stop
1 parent 5046b77 commit 923c776

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

roles/patroni/tasks/main.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -552,23 +552,15 @@
552552
- name: Prepare PostgreSQL | stop PostgreSQL (will be managed by patroni)
553553
become: true
554554
become_user: postgres
555-
command: "/usr/bin/pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} stop -m fast"
556-
register: stop_result
557-
until: stop_result.rc == 0
558-
retries: 300
559-
delay: 10
555+
command: "/usr/bin/pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} stop -m fast -- -w -t 600"
560556
when: (checkpoint_result.rc is defined and checkpoint_result.rc == 0) and
561557
(ansible_os_family == "Debian" and postgresql_packages|join(" ") is not search("postgrespro"))
562558

563559
# "RedHat" or PostgresPro
564560
- name: Prepare PostgreSQL | stop PostgreSQL (will be managed by patroni)
565561
become: true
566562
become_user: postgres
567-
command: "{{ postgresql_bin_dir }}/pg_ctl stop -D {{ postgresql_data_dir }} -m fast"
568-
register: stop_result
569-
until: stop_result.rc == 0
570-
retries: 300
571-
delay: 10
563+
command: "{{ postgresql_bin_dir }}/pg_ctl stop -D {{ postgresql_data_dir }} -m fast -w -t 600"
572564
when: (checkpoint_result.rc is defined and checkpoint_result.rc == 0) and
573565
(ansible_os_family == "RedHat" or postgresql_packages|join(" ") is search("postgrespro"))
574566

@@ -693,20 +685,12 @@
693685
failed_when: false
694686

695687
- name: Stop PostgreSQL # "Debian"
696-
command: "/usr/bin/pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} stop -m fast"
697-
register: stop_result
698-
until: stop_result.rc == 0
699-
retries: 10
700-
delay: 10
688+
command: "/usr/bin/pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} stop -m fast -- -w -t 600"
701689
when: ansible_os_family == "Debian" and
702690
(pg_ctl_status_result.rc is defined and pg_ctl_status_result.rc != 3)
703691

704692
- name: Stop PostgreSQL # "RedHat" or PostgresPro
705-
command: "{{ postgresql_bin_dir }}/pg_ctl stop -D {{ postgresql_data_dir }} -m fast"
706-
register: stop_result
707-
until: stop_result.rc == 0
708-
retries: 10
709-
delay: 10
693+
command: "{{ postgresql_bin_dir }}/pg_ctl stop -D {{ postgresql_data_dir }} -m fast -w -t 600"
710694
when: (ansible_os_family == "RedHat" or postgresql_packages|join(" ") is search("postgrespro")) and
711695
(pg_ctl_status_result.rc is defined and pg_ctl_status_result.rc != 3)
712696
when: patroni_cluster_bootstrap_method == "pgbackrest"

0 commit comments

Comments
 (0)