Migration during the upgrade to 3.4 stable is failing for MAAS instances that were originally installed with 1.x
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Unassigned | ||
3.4 |
Fix Released
|
High
|
Unassigned | ||
3.5 |
Fix Released
|
High
|
Unassigned |
Bug Description
As per discourse post https:/
snap refresh --channel=3.4 maas
results in SQL error:
Operations to perform:
Apply all migrations: auth, contenttypes, maasserver, metadataserver, piston3, sessions, sites
Running migrations:
Applying metadataserver.
Applying maasserver.
Applying maasserver.
File "/snap/
return self.cursor.
psycopg2.
and
Applying maasserver.
File "/snap/
return self.cursor.
psycopg2.
Related branches
- MAAS Lander: Approve
- Jacopo Rota: Approve
-
Diff: 129 lines (+86/-0)2 files modifiedsrc/maasserver/migrations/maasserver/0292_use_builtin_json_field.py (+15/-0)
src/maasserver/migrations/maasserver/0302_big_auto_field.py (+71/-0)
- MAAS Lander: Approve
- Anton Troyanov: Approve
-
Diff: 129 lines (+86/-0)2 files modifiedsrc/maasserver/migrations/maasserver/0292_use_builtin_json_field.py (+15/-0)
src/maasserver/migrations/maasserver/0302_big_auto_field.py (+71/-0)
description: | updated |
Changed in maas: | |
milestone: | 3.5.0 → 3.5.0-beta1 |
status: | Fix Committed → Fix Released |
From the user's database
``` 22.04.1) )
psql (14.10 (Ubuntu 14.10-0ubuntu0.
Type "help" for help.
maasdb=# \d maasserver_ bootresourcefil e;
Table "public. maasserver_ bootresourcefil e" ------- ---+--- ------- ------- ------- --+---- ------- +------ ----+-- ------- ------- ------- ------- ------- ------- ------- ------ 'maasserver_ bootresourcefil e_id_seq' ::regclass) _bootresourcefi le_pkey" PRIMARY KEY, btree (id) _bootresourcefi _resource_ set_id_ 1bdfd52f7cc6de8 0_uniq" UNIQUE CONSTRAINT, btree (resource_set_id, filename) _bootresourcefi le_largefile_ id" btree (largefile_id) _bootresourcefi le_resource_ set_id" btree (resource_set_id) id_refs_ id_6192daf196cc 0427" FOREIGN KEY (largefile_id) REFERENCES maasserver_ largefile( id) DEFERRABLE INITIALLY DEFERRED set_id_ refs_id_ 5740a0afd6adefa 0" FOREIGN KEY (resource_set_id) REFERENCES maasserver_ bootresourceset (id) DEFERRABLE INITIALLY DEFERRED
Column | Type | Collation | Nullable | Default
-------
id | integer | | not null | nextval(
created | timestamp with time zone | | not null |
updated | timestamp with time zone | | not null |
resource_set_id | integer | | not null |
largefile_id | integer | | not null |
filename | character varying(255) | | not null |
filetype | character varying(20) | | not null | 'tgz'::character varying
extra | text | | not null | '""'::text
Indexes:
"maasserver
"maasserver
"maasserver
"maasserver
Foreign-key constraints:
"largefile_
"resource_
I'd say that the migration fails to cast the extra column to jsonb due to its default value '""'::text. The fix would be to specify how this column should be migrated - i.e. should should not just cast the column to jsonb.
```
However, from a plain 3.2/stable installation I could not manage to get the same default value for the column
``` maas-testmigrat ion:~$ sudo maas-test-db.psql
ubuntu@
psql (12.4)
Type "help" for help.
maasdb=# select * from ^C bootresourcefil e;
Table "public. maasserver_ bootresourcefil e" ------- ---+--- ------- ------- ------- --+---- ------- +------ ----+-- ------- ------- ------- ------- ------- ------- ------- ------ 'maasserver_ bootresourcefil e_id_seq' ::regclass)
maasdb=# \d maasserver_
Column | Type | Collation | Nullable | Default
-------
id | integer | | not null | nextval(
created | timestamp with time zone | | not null |
updated | timestamp with time zone | | not null |
filename | character varying(255) | | not null |
filetype | character varying(20) | | not null |
extra | text | | not null |
largefile_id | integer | | not null |
resource_set_id | integer | | not null |
```...