Skip to content

Commit

Permalink
Fix add_pgnode.yml: Clear the data directory for the new node
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Dec 11, 2023
1 parent 1c645be commit 7d19b6e
Showing 1 changed file with 4 additions and 2 deletions.
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.

Check failure on line 459 in roles/patroni/tasks/main.yml

View workflow job for this annotation

GitHub Actions / build

yaml[trailing-spaces]

Trailing spaces

Check failure on line 459 in roles/patroni/tasks/main.yml

View workflow job for this annotation

GitHub Actions / build

459:54 [trailing-spaces] trailing spaces
- 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

0 comments on commit 7d19b6e

Please sign in to comment.