Skip to content

Conversation

@dragomirp
Copy link
Contributor

@dragomirp dragomirp commented Sep 30, 2025

  • Remove reinitialisations
  • Use /mnt storage for microk8s
  • Update charm libs

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@github-actions github-actions bot added the Libraries: Out of sync The charm libs used are out-of-sync label Sep 30, 2025
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.28%. Comparing base (9f0a36e) to head (4cbbccf).
⚠️ Report is 1 commits behind head on 16/edge.

❌ Your project status has failed because the head coverage (67.28%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           16/edge    #1114      +/-   ##
===========================================
- Coverage    67.30%   67.28%   -0.03%     
===========================================
  Files           16       16              
  Lines         3762     3723      -39     
  Branches       541      537       -4     
===========================================
- Hits          2532     2505      -27     
+ Misses        1072     1061      -11     
+ Partials       158      157       -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines -1712 to -1719
if not self._patroni.member_started and self._patroni.is_database_running:
try:
container.restart(self.postgresql_service)
logger.info("restarted Patroni because it was not running")
except ChangeError:
logger.error("failed to restart Patroni after checking that it was not running")
return False
return True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks practically identical to thee restart check in _on_update_status() itself:

if (
not self.is_cluster_restoring_backup
and not self.is_cluster_restoring_to_time
and not self.is_unit_stopped
and services[0].current != ServiceStatus.ACTIVE
):
logger.warning(
f"{self.postgresql_service} pebble service inactive, restarting service"
)
try:
container.restart(self.postgresql_service)
except ChangeError:
logger.exception("Failed to restart patroni")
# If service doesn't recover fast, exit and wait for next hook run to re-check
if not self._patroni.member_started:
self.unit.status = MaintenanceStatus("Database service inactive, restarting")
return
.

Comment on lines -1622 to -1624
if self._handle_processes_failures():
return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reinit removed and the restart check seems to be duplicated to the one above.

@dragomirp dragomirp marked this pull request as ready for review September 30, 2025 09:51
@dragomirp dragomirp requested review from a team, marceloneppel and taurus-forever and removed request for a team September 30, 2025 09:52
@dragomirp dragomirp changed the title [MISC] No reinit [DPE-8439] No reinit Sep 30, 2025
Comment on lines -455 to -467
@property
def is_database_running(self) -> bool:
"""Returns whether the PostgreSQL database process is running (and isn't frozen)."""
container = self._charm.unit.get_container("postgresql")
output = container.exec(["ps", "aux"]).wait_output()
postgresql_processes = [
process
for process in output[0].split("/n")
if "/usr/lib/postgresql/14/bin/postgres" in process
]
# Check whether the PostgreSQL process has a state equal to T (frozen).
return any(process for process in postgresql_processes if process.split()[7] != "T")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code. Also 14 specific.

Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dragomirp dragomirp merged commit 973a118 into 16/edge Sep 30, 2025
562 of 576 checks passed
@dragomirp dragomirp deleted the no-reinit branch September 30, 2025 19:16
@shipperizer shipperizer mentioned this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync The charm libs used are out-of-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants