-
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
Conversation
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 16/edge #852 +/- ##
===========================================
- Coverage 71.03% 70.83% -0.21%
===========================================
Files 15 15
Lines 3870 3888 +18
Branches 571 580 +9
===========================================
+ Hits 2749 2754 +5
- Misses 938 949 +11
- Partials 183 185 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
…ools Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
if temp_location is not None: | ||
cursor.execute("SELECT TRUE FROM pg_tablespace WHERE spcname='temp';") | ||
if cursor.fetchone() is None: | ||
cursor.execute(f"CREATE TABLESPACE temp LOCATION '{temp_location}';") | ||
cursor.execute("GRANT CREATE ON TABLESPACE temp TO public;") |
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.
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 |
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.
This was needed for async replication, when sometimes the pg_wal folder got recreated at some point with old data.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Mapping the WAL directory to the logs
storage in the primary.
basebackup: | ||
- waldir: /var/snap/charmed-postgresql/common/data/logs |
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.
Mapping the WAL directory to the logs
storage in the replicas.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Configure PostgreSQL to use the temp storage for temporary tablespaces.
logger.info("Checking charm storages") | ||
expected_storages = ["archive", "data", "logs", "temp"] | ||
storages = await ops_test.model.list_storage() | ||
assert len(storages) == 4, f"Expected 4 storages, got: {len(storages)}" | ||
for index, storage in enumerate(storages): | ||
assert ( | ||
storage["attachments"]["unit-postgresql-0"].__dict__["storage_tag"] | ||
== f"storage-{expected_storages[index]}-{index}" | ||
), f"Storage {expected_storages[index]} not found" |
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.
Testing the presence of multiple storages.
await ops_test.model.deploy( | ||
await ops_test.juju( |
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.
This will be rolled back as soon as a revision is published to the 16/edge
channel.
await ops_test.model.deploy( | ||
await ops_test.juju( |
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.
This will be rolled back as soon as a revision is published to the 16/beta
channel.
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.
IMHI, we can merge this tested PR and rediscuss binaries
on Monday.
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
…ools Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Issue
The new PG 16 charm needs 4 different storage areas to separate the different kinds of data produced by the database system. More details are explained at DPE-2603.
Solution
Modify the charm to have 4 different storages instead of 1 and adapt the charm code to configure PostgreSQL to use 3 of them (data, logs and temp) for the needed purposes and keep the last one (archive) for local backups.
Notes:
Checklist