-
Notifications
You must be signed in to change notification settings - Fork 21
[DPE-6965] Storage pools #852
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
Changes from all commits
17c1566
742e72e
71f2469
638e40f
edd83c3
5af64a7
42a8019
cf4f2ae
6fbb350
45291bd
a6ece3b
d1ab5ab
f8f999f
4dcc9ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ | |
PATRONI_PASSWORD_KEY, | ||
PEER, | ||
PLUGIN_OVERRIDES, | ||
POSTGRESQL_DATA_PATH, | ||
POSTGRESQL_SNAP_NAME, | ||
RAFT_PASSWORD_KEY, | ||
REPLICATION_PASSWORD_KEY, | ||
|
@@ -197,9 +198,8 @@ def __init__(self, *args): | |
self.framework.observe(self.on.update_status, self._on_update_status) | ||
self.cluster_name = self.app.name | ||
self._member_name = self.unit.name.replace("/", "-") | ||
|
||
self._certs_path = "/usr/local/share/ca-certificates" | ||
self._storage_path = self.meta.storages["pgdata"].location | ||
self._storage_path = self.meta.storages["data"].location | ||
|
||
self.upgrade = PostgreSQLUpgrade( | ||
self, | ||
|
@@ -1469,7 +1469,9 @@ def _start_primary(self, event: StartEvent) -> None: | |
event.defer() | ||
return | ||
|
||
self.postgresql.set_up_database() | ||
self.postgresql.set_up_database( | ||
temp_location="/var/snap/charmed-postgresql/common/data/temp" | ||
) | ||
|
||
access_groups = self.postgresql.list_access_groups() | ||
if access_groups != set(ACCESS_GROUPS): | ||
|
@@ -1722,6 +1724,11 @@ def _handle_processes_failures(self) -> bool: | |
# Restart the PostgreSQL process if it was frozen (in that case, the Patroni | ||
# process is running by the PostgreSQL process not). | ||
if self._unit_ip in self.members_ips and self._patroni.member_inactive: | ||
data_directory_contents = os.listdir(POSTGRESQL_DATA_PATH) | ||
if len(data_directory_contents) == 1 and data_directory_contents[0] == "pg_wal": | ||
os.remove(os.path.join(POSTGRESQL_DATA_PATH, "pg_wal")) | ||
logger.info("PostgreSQL data directory was not empty. Removed pg_wal") | ||
return True | ||
Comment on lines
+1728
to
+1731
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was needed for async replication, when sometimes the pg_wal folder got recreated at some point with old data. |
||
try: | ||
self._patroni.restart_patroni() | ||
logger.info("restarted PostgreSQL because it was not running") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,9 +126,12 @@ bootstrap: | |
initdb: | ||
- encoding: UTF8 | ||
- data-checksums | ||
- waldir: /var/snap/charmed-postgresql/common/data/logs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mapping the WAL directory to the |
||
{%- endif %} | ||
|
||
postgresql: | ||
basebackup: | ||
- waldir: /var/snap/charmed-postgresql/common/data/logs | ||
Comment on lines
+133
to
+134
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mapping the WAL directory to the |
||
listen: '{{ self_ip }}:5432' | ||
connect_address: '{{ self_ip }}:5432' | ||
# Path to PostgreSQL binaries used in the database bootstrap process. | ||
|
@@ -147,6 +150,7 @@ postgresql: | |
ssl_cert_file: {{ conf_path }}/cert.pem | ||
ssl_key_file: {{ conf_path }}/key.pem | ||
{%- endif %} | ||
temp_tablespaces: temp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Configure PostgreSQL to use the temp storage for temporary tablespaces. |
||
unix_socket_directories: /tmp | ||
{%- if pg_parameters %} | ||
{%- for key, value in pg_parameters.items() %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configure PostgreSQL to use the
temp
storage for temporary tablespaces.