Failed updating from 3.3 to 3.4/beta

Bug #2037524 reported by Anton Troyanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Committed
High
Alberto Donato
3.4
Fix Committed
High
Alberto Donato

Bug Description

ubuntu@foo:/root$ sudo snap install maas-test-db && sudo snap install maas
maas-test-db (3.3/stable) 14.2-29-g.ed8d7f2 from Canonical✓ installed
maas (3.3/stable) 3.3.4-13189-g.f88272d1e from Canonical✓ installed

ubuntu@foo:/root$ sudo maas init region+rack

>>>
maasdb=# \d maasserver_fabric_id_seq
              Sequence "public.maasserver_fabric_id_seq"
  Type | Start | Minimum | Maximum | Increment | Cycles? | Cache
---------+-------+---------+------------+-----------+---------+-------
 integer | 1 | 1 | 2147483647 | 1 | no | 1
Owned by: public.maasserver_fabric.id

maasdb=# select * from maasserver_fabric;
 id | created | updated | name | class_type | description
----+-------------------------------+-------------------------------+----------+------------+-------------
  0 | 2023-09-27 09:48:09.865126+00 | 2023-09-27 09:48:09.865126+00 | fabric-0 | |
(1 row)
>>>

ubuntu@foo:/root$ sudo snap refresh maas --channel=3.4/beta
Handling re-refresh of "maas" as needed -
  Applying maasserver.0291_rdns_hostnames_as_array... OK
  Applying maasserver.0292_use_builtin_json_field... OK
  Applying maasserver.0293_drop_verbose_regex_validator... OK
  Applying maasserver.0294_keyring_data_binary_field... OK
  Applying maasserver.0295_macaddress_text_field... OK
  Applying metadataserver.0035_move_metadata_node_models... OK
  Applying metadataserver.0036_move_metadata_script_models... OK
  Applying maasserver.0296_move_metadata_node_models... OK
  Applying maasserver.0297_move_metadata_script_models... OK
  Applying maasserver.0298_current_script_set_foreign_keys_drop_indexes... OK
  Applying maasserver.0299_current_script_set_foreign_keys_cleanup... OK
  Applying maasserver.0300_current_script_set_foreign_keys_readd... OK
  Applying maasserver.0301_discovery_ignore_fks... OK
  Applying maasserver.0302_big_auto_field...Traceback (most recent call last):
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.NumericValueOutOfRange: setval: value 0 is out of bounds for sequence "maasserver_fabric_id_seq" (1..9223372036854775807)

More detailed stacktrace:
[|] Performing database migrations
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/snap/maas/30266/lib/python3.10/site-packages/maasserver/management/commands/dbupgrade.py", line 125, in handle
    call_command(
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 181, in call_command
    return command.execute(*args, **defaults)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/core/management/commands/migrate.py", line 244, in handle
    post_migrate_state = executor.migrate(
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/migrations/operations/fields.py", line 244, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 608, in alter_field
    self._alter_field(model, old_field, new_field, old_type, new_type,
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/postgresql/schema.py", line 196, in _alter_field
    super()._alter_field(
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 794, in _alter_field
    self.execute(sql, params)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/base/schema.py", line 145, in execute
    cursor.execute(sql, params)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 79, in _execute
    with self.db.wrap_database_errors:
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/snap/maas/30266/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: setval: value 0 is out of bounds for sequence "maasserver_fabric_id_seq" (1..9223372036854775807)

Related branches

Changed in maas:
status: New → Triaged
importance: Undecided → High
Alberto Donato (ack)
Changed in maas:
status: Triaged → In Progress
assignee: nobody → Alberto Donato (ack)
milestone: none → 3.4.0
description: updated
Alberto Donato (ack)
Changed in maas:
milestone: 3.4.0 → none
Changed in maas:
milestone: none → 3.5.0
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.