regiond violates not-null constraint
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MAAS | Status tracked in 3.6 | |||||
3.4 |
Won't Fix
|
Medium
|
Unassigned | |||
3.5 |
Won't Fix
|
Medium
|
Unassigned | |||
3.6 |
Triaged
|
Medium
|
Unassigned |
Bug Description
When commissioning new machines, most machines succeed but one fails because it seems to fail to post back its dns info
mass version: 3.4.0
When the postgresql-ha fails to serialize access due to concurrent update:
2023-11-26 22:46:11.696 UTC [178210] maas@maasdb ERROR: could not serialize access due to concurrent update
2023-11-26 22:46:11.696 UTC [178210] maas@maasdb STATEMENT: SELECT "maasserver_
50-maas-
django.
DETAIL: Failing row contains (96, 96, 2023-11-26 22:46:19.67433+00, null).
CONTEXT: SQL statement "INSERT INTO maasserver_
VALUES
PL/pgSQL function sys_dns_
SQL statement "SELECT sys_dns_
'ip ' || host(sip.ip) || ' unlinked from resource ' ||
PL/pgSQL function sys_dns_
run: https:/
artefacts: https:/
files messages found in: /10.244.
description: | updated |
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → Medium |
milestone: | none → 3.5.0 |
milestone: | 3.5.0 → 3.4.x |
Changed in maas: | |
milestone: | 3.4.x → 3.5.x |
A first update: the problem seems to be in the trigger that calls `sys_dns_ publish_ update` dnsresource_ ip_unlink( ) staticipaddress ; dnsresource; staticipaddress .* INTO sip staticipaddress staticipaddress .id = OLD.staticipadd ress_id; dnsresource. * INTO resource dnsresource dnsresource. id = OLD.dnsresource_id; domain. id = resource.domain_id; publish_ update(
COALESCE( resource. name, 'NULL') || ' on zone ' || domain.name);
```
CREATE OR REPLACE FUNCTION sys_dns_
RETURNS trigger as $$
DECLARE
sip maasserver_
resource maasserver_
domain maasserver_domain;
BEGIN
SELECT maasserver_
FROM maasserver_
WHERE maasserver_
SELECT maasserver_
FROM maasserver_
WHERE maasserver_
SELECT maasserver_domain.* INTO domain
FROM maasserver_domain
WHERE maasserver_
IF sip.ip IS NOT NULL THEN
PERFORM sys_dns_
'ip ' || host(sip.ip) || ' unlinked from resource ' ||
END IF;
RETURN OLD;
END;
```
if `sip.ip` == NULL, then `'ip ' || host(sip.ip)` == NULL and we hit the not-null contraint. I need to dig deeper on why staticipaddress .* INTO sip staticipaddress staticipaddress .id = OLD.staticipadd ress_id;
```
SELECT maasserver_
FROM maasserver_
WHERE maasserver_
```
produces a NULL sip. Maybe a race condition on the ip that changed or something