Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dpe-2681-upgrade-from…
Browse files Browse the repository at this point in the history
…-stable
  • Loading branch information
marceloneppel committed Oct 11, 2023
2 parents 83f6030 + 26a6648 commit a7b7b6b
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 117 deletions.
2 changes: 1 addition & 1 deletion charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ parts:
- cargo
- pkg-config
charm-binary-python-packages:
- psycopg2-binary==2.9.8 # renovate
- psycopg2-binary==2.9.9 # renovate
283 changes: 201 additions & 82 deletions lib/charms/data_platform_libs/v0/data_interfaces.py

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions lib/charms/data_platform_libs/v0/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def restart(self, event) -> None:

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 12
LIBPATCH = 13

PYDEPS = ["pydantic>=1.10,<2", "poetry-core"]

Expand Down Expand Up @@ -921,7 +921,10 @@ def on_upgrade_changed(self, event: EventBase) -> None:
logger.debug("Cluster failed to upgrade, exiting...")
return

if self.cluster_state == "recovery":
if self.substrate == "vm" and self.cluster_state == "recovery":
# Only defer for vm, that will set unit states to "ready" on upgrade-charm
# on k8s only the upgrading unit will receive the upgrade-charm event
# and deferring will prevent the upgrade stack from being popped
logger.debug("Cluster in recovery, deferring...")
event.defer()
return
Expand All @@ -944,7 +947,7 @@ def on_upgrade_changed(self, event: EventBase) -> None:
logger.debug("upgrade-changed event handled before pre-checks, exiting...")
return

logger.debug("Did not find upgrade-stack or completed cluster state, deferring...")
logger.debug("Did not find upgrade-stack or completed cluster state, skipping...")
return

# upgrade ongoing, set status for waiting units
Expand Down
64 changes: 42 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository = "https://github.com/canonical/postgresql-operator"
python = "^3.10.6"
ops = "2.7.0"
cryptography = "41.0.4"
boto3 = "1.28.59"
boto3 = "1.28.62"
pgconnstr = "1.0.1"
requests = "2.31.0"
tenacity = "8.2.3"
Expand Down Expand Up @@ -47,7 +47,7 @@ coverage = {extras = ["toml"], version = "7.3.2"}
pytest = "7.4.2"
pytest-asyncio = "0.21.1"
jsonschema = "4.19.1"
psycopg2 = {version = "2.9.8", extras = ["binary"]}
psycopg2 = {version = "2.9.9", extras = ["binary"]}
jinja2 = "3.1.2"

[tool.poetry.group.integration]
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
boto3==1.28.59 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
botocore==1.31.59 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
boto3==1.28.62 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
botocore==1.31.62 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
certifi==2023.7.22 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
cffi==1.16.0 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
charset-normalizer==3.3.0 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
Expand All @@ -22,4 +22,4 @@ six==1.16.0 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
tenacity==8.2.3 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
typing-extensions==4.8.0 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
urllib3==1.26.17 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
websocket-client==1.6.3 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
websocket-client==1.6.4 ; python_full_version >= "3.10.6" and python_full_version < "4.0.0"
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# Snap constants.
PGBACKREST_EXECUTABLE = "charmed-postgresql.pgbackrest"
POSTGRESQL_SNAP_NAME = "charmed-postgresql"
SNAP_PACKAGES = [(POSTGRESQL_SNAP_NAME, {"revision": "79"})]
SNAP_PACKAGES = [(POSTGRESQL_SNAP_NAME, {"revision": "85"})]

SNAP_COMMON_PATH = "/var/snap/charmed-postgresql/common"
SNAP_CURRENT_PATH = "/var/snap/charmed-postgresql/current"
Expand Down
6 changes: 5 additions & 1 deletion templates/patroni.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ name: {{ member_name }}

log:
dir: {{ log_path }}
dateformat: "%Y-%m-%d %H:%M:%S %Z"
format: "%(asctime)s [%(process)d]: %(levelname)s: %(message)s "
file_num: 10080
file_size: 600

restapi:
listen: '{{ self_ip }}:8008'
Expand Down Expand Up @@ -80,7 +84,7 @@ bootstrap:
log_statement_sample_rate: 1
log_statement_stats: 'off'
log_temp_files: 1
log_timezone: 'GMT'
log_timezone: 'UTC'
log_truncate_on_rotation: 'on'
logging_collector: 'on'
wal_level: logical
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ async def reused_replica_storage(ops_test: OpsTest, unit_name) -> bool:
ops_test,
unit_name,
"grep 'Database cluster state: in archive recovery' "
"/var/snap/charmed-postgresql/common/var/log/patroni/patroni.log",
"/var/snap/charmed-postgresql/common/var/log/patroni/patroni.log*",
)
return True

Expand All @@ -792,6 +792,6 @@ async def reused_full_cluster_recovery_storage(ops_test: OpsTest, unit_name) ->
ops_test,
unit_name,
"grep -E 'Database cluster state: in archive recovery|Database cluster state: shut down' "
"/var/snap/charmed-postgresql/common/var/log/patroni/patroni.log",
"/var/snap/charmed-postgresql/common/var/log/patroni/patroni.log*",
)
return True

0 comments on commit a7b7b6b

Please sign in to comment.