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

[DPE-3570] Save one min on charm deploy (by skipping _on_upgrade_charm_check_legacy() on early stage) #368

Closed
wants to merge 1 commit into from

Conversation

taurus-forever
Copy link
Contributor

@taurus-forever taurus-forever commented Feb 26, 2024

Issue:

  • the charm was sleeping one minute on deployment waiting for patroni on install hook, before patroni is installed.

Solution:

  • Avoid waiting for not-yet-started patroni before the cluster is initialized.

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.21%. Comparing base (dbd46b5) to head (24ed7c3).

Files Patch % Lines
src/upgrade.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #368   +/-   ##
=======================================
  Coverage   69.21%   69.21%           
=======================================
  Files          11       11           
  Lines        2865     2865           
  Branches      507      507           
=======================================
  Hits         1983     1983           
  Misses        781      781           
  Partials      101      101           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@taurus-forever
Copy link
Contributor Author

For the history, from test logs:

unit-postgresql-0: 08:31:35 DEBUG unit.postgresql/0.juju-log Installing SNAP charmed-postgresql rev 98, tracking 14/stable
unit-postgresql-2: 08:31:35 DEBUG unit.postgresql/2.juju-log Installing SNAP charmed-postgresql rev 98, tracking 14/stable
unit-postgresql-1: 08:31:35 DEBUG unit.postgresql/1.juju-log Installing SNAP charmed-postgresql rev 98, tracking 14/stable
unit-postgresql-1: 08:32:38 DEBUG unit.postgresql/1.juju-log The snap installation completed successfully
unit-postgresql-0: 08:32:39 DEBUG unit.postgresql/0.juju-log The snap installation completed successfully
unit-postgresql-2: 08:32:39 DEBUG unit.postgresql/2.juju-log The snap installation completed successfully

1 minute for each unit to download SNAP charmed-postgresql (180MB downloading size currently).

@taurus-forever taurus-forever marked this pull request as draft March 4, 2024 16:46
…eck_legacy()

The _on_upgrade_charm_check_legacy() was necessary to allow very old
revision 228 refresh to the revision 336 (the revision 228 didn't
have `pre-upgrade-check` action). It is no longer topical, but still
is being called from __init__ of class PostgreSQLUpgrade() for each Juju event.

Inside we are checking `if self.charm._patroni.member_started` which is
causing one minute waiting timeout for patroni which is not yet even installed:

> 13:19:04 DEBUG unit.postgresql/0.juju-log ops 2.9.0 up and running.
> 13:19:04 INFO unit.postgresql/0.juju-log Running legacy hooks/install.
> 13:19:05 DEBUG unit.postgresql/0.juju-log ops 2.9.0 up and running.
> 13:19:05 DEBUG unit.postgresql/0.juju-log Charm called itself via hooks/install.
> 13:19:05 DEBUG unit.postgresql/0.juju-log Legacy hooks/install exited with status 0.
> 13:19:05 DEBUG unit.postgresql/0.juju-log Wait all units join the upgrade relation
> 13:19:05 DEBUG unit.postgresql/0.juju-log Emitting Juju event install.
> 13:19:53 INFO juju.worker.uniter.operation ran "install" hook (via hook dispatching script: dispatch)
> 13:19:53 DEBUG unit.postgresql/0.juju-log upgrade:0: ops 2.9.0 up and running.
> 13:19:54 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:19:57 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:00 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:03 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:06 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:09 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:12 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:15 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:18 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:21 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:24 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:27 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:30 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:33 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:36 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:39 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:42 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:45 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:48 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:51 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:54 DEBUG unit.postgresql/0.juju-log upgrade:0: Starting new HTTP connection (1): 10.172.136.223:8008
> 13:20:54 DEBUG unit.postgresql/0.juju-log upgrade:0: Emitting Juju event upgrade_relation_created.
> 13:20:54 DEBUG unit.postgresql/0.juju-log upgrade:0: Persisting dependencies to upgrade relation data...
@taurus-forever taurus-forever force-pushed the alutay/speedup_deploy_1 branch from 8aee81a to 24ed7c3 Compare June 24, 2024 18:34
@taurus-forever taurus-forever changed the title [DPE-3570] Add snap debug timing + save one min on charm deploy (by skipping _on_upgrade_charm_check_legacy() on early stage) [DPE-3570] Save one min on charm deploy (by skipping _on_upgrade_charm_check_legacy() on early stage) Jun 24, 2024
@taurus-forever
Copy link
Contributor Author

taurus-forever commented Jun 24, 2024

Superseded by #413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant