Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix add_pgnode.yml: Clear the data directory for the new node for bootstrapping #527

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions roles/patroni/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@
postgresql_packages|join(" ") is not search("postgrespro")) and
not postgresql_conf_file.stat.exists

# When performing PITR, we do not clear the directory if pgbackrest is used
# to be able to use the '--delta restore' option.
- name: Prepare PostgreSQL | make sure the data directory "{{ postgresql_data_dir }}" is empty
ansible.builtin.file:
path: "{{ postgresql_data_dir }}"
Expand All @@ -466,7 +468,7 @@
- absent
- directory
when: (is_master | bool and patroni_cluster_bootstrap_method != "pgbackrest")
or (not is_master | bool and 'pgbackrest' not in patroni_create_replica_methods) # --delta restore
or (not is_master | bool and ('pgbackrest' not in patroni_create_replica_methods or new_node | default(false) | bool))

- name: Prepare PostgreSQL | make sure the custom WAL directory "{{ postgresql_wal_dir }}" is empty
ansible.builtin.file:
Expand All @@ -480,7 +482,7 @@
- directory
when: (postgresql_wal_dir is defined and postgresql_wal_dir | length > 0) and
((is_master | bool and patroni_cluster_bootstrap_method != "pgbackrest")
or (not is_master | bool and 'pgbackrest' not in patroni_create_replica_methods)) # --delta restore
or (not is_master | bool and ('pgbackrest' not in patroni_create_replica_methods or new_node | default(false) | bool)))
when: not postgresql_exists | bool or patroni_cluster_bootstrap_method != "initdb"
tags: patroni, point_in_time_recovery

Expand Down