canonical / canonical/postgresql-operator

"database-peers-relation-broken" 'NoneType' object has no attribute 'data'

Open
#691 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
20
Forks
36
Avg merge
4d 15h
Merged PRs (30d)
30

Description

## Steps to reproduce

1. Install PostgreSQL using juju

2. Try to delete failed node
```
juju remove-unit postgresql/1 --destroy-storage
```
## Expected behavior
Expected that unit would be deleted without problems

## Actual behavior
Unit postgresql/1 becomes in error state with 'hook failed: "database-peers-relation-broken"' error.

## Versions
Operating system: Ubuntu 22.04.5 LTS
Juju CLI: 3.4.6-genericlinux-amd64
Charm revision: 411
LXD: 5.21.2 LTS

```
juju status

Model Controller Cloud/Region Version SLA Timestamp
postgresql-maas lxd-maas-default lxd-maas/default 3.4.4 unsupported 14:14:07Z

SAAS Status Store URL
grafana active controller-openstack admin/cos.grafana
loki active controller-openstack admin/cos.loki
prometheus active controller-openstack admin/cos.prometheus

App Version Status Scale Charm Channel Rev Exposed Message
data-integrator active 2 data-integrator latest/stable 27 no
grafana-agent active 2 grafana-agent latest/stable 216 no
keycloac-integrator active 1 data-integrator latest/stable 41 no
postgresql 14.11 active 3 postgresql 14/stable 411 no
postgresql-keycloak 14.11 active 1 postgresql 14/stable 411 no

Unit Workload Agent Machine Public address Ports Message
data-integrator/3* active idle 0 10.88.80.8
data-integrator/4 active idle 1 10.88.80.9
keycloac-integrator/0* active idle 0 10.88.80.8
postgresql-keycloak/0* active idle 6 10.88.81.132 5432/tcp Primary
postgresql/0* active idle 0 10.88.80.8 5432/tcp Primary
grafana-agent/5 active idle 10.88.80.8
postgresql/1 error idle 1 10.88.80.9 5432/tcp hook failed: "database-peers-relation-broken"
postgresql/5 active idle 9 10.88.80.10 5432/tcp
grafana-agent/6* active idle 10.88.80.10

Machine State Address Inst id Base AZ Message
0 started 10.88.80.8 juju-9eb3f3-0 ubuntu@22.04 Running
1 started 10.88.80.9 juju-9eb3f3-1 ubuntu@22.04 Running
6 started 10.88.81.132 juju-9eb3f3-6 ubuntu@22.04 Running
9 started 10.88.80.10 juju-9eb3f3-9 ubuntu@22.04 Running
```

## Log output
```
juju debug-log --include=postgresql/1

unit-postgresql-1: 14:10:01 DEBUG unit.postgresql/1.juju-log database-peers:2: ops 2.12.0 up and running.
unit-postgresql-1: 14:10:01 DEBUG unit.postgresql/1.juju-log database-peers:2: Re-emitting deferred event .
unit-postgresql-1: 14:10:01 ERROR unit.postgresql/1.juju-log database-peers:2: Uncaught exception while in charm code:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-postgresql-1/charm/./src/charm.py", line 1646, in
main(PostgresqlOperatorCharm)
File "/var/lib/juju/agents/unit-postgresql-1/charm/venv/ops/main.py", line 544, in main
manager.run()
File "/var/lib/juju/agents/unit-postgresql-1/charm/venv/ops/main.py", line 520, in run
self._emit()
File "/var/lib/juju/agents/unit-postgresql-1/charm/venv/ops/main.py", line 506, in _emit
self.framework.reemit()
File "/var/lib/juju/agents/unit-postgresql-1/charm/venv/ops/framework.py", line 861, in reemit
self._reemit()
File "/var/lib/juju/agents/unit-postgresql-1/charm/venv/ops/framework.py", line 941, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-postgresql-1/charm/./src/charm.py", line 479, in _on_peer_relation_changed
if "cluster_initialised" not in self._peers.data[self.app]:
AttributeError: 'NoneType' object has no attribute 'data'
unit-postgresql-1: 14:10:02 ERROR juju.worker.uniter.operation hook "database-peers-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.