Open cazzen2k4 opened 3 years ago
I was able to work around this issue in my installation by manually adding 3 missing indexes to main_inventoryupdateevent before migrating all the way to 19.2.0+
I have no idea why they were missing. I figured this out by manually comparing a vanilla 19.0.0 installation to my migrated 19.0.0 database
CREATE INDEX main_inventoryupdateevent_inventory_update_id_start_line_idx ON main_inventoryupdateevent (inventory_update_id, start_line);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_end_line_idx ON main_inventoryupdateevent(inventory_update_id, end_line);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_uuid_idx ON main_inventoryupdateevent(inventory_update_id, uuid);
CREATE INDEX main_projectupdateevent_project_update_id_end_line_idx ON main_projectupdateevent (project_update_id, end_line);
CREATE INDEX main_projectupdateevent_project_update_id_event_idx ON main_projectupdateevent (project_update_id, event);
CREATE INDEX main_projectupdateevent_project_update_id_start_line_idx ON main_projectupdateevent (project_update_id, start_line);
CREATE INDEX main_projectupdateevent_project_update_id_uuid_idx ON main_projectupdateevent (project_update_id, uuid);
CREATE INDEX main_systemjobevent_system_job_id_end_line_idx ON main_systemjobevent (system_job_id, end_line);
CREATE INDEX main_systemjobevent_system_job_id_start_line_idx ON main_systemjobevent (system_job_id, start_line);
CREATE INDEX main_systemjobevent_system_job_id_uuid_idx ON main_systemjobevent (system_job_id, uuid);
Is there a way to dump all the sql for main.0144_event_partitions? I've a awx 19.2.0 instance and can't get it to upgrade to any version above 19.2.0. I've tried 19.2.1, 19.2.2 and 19.3.0, all failed to migrate the 19.2.0 db. Its stuck on main.0144_event_partitions and it errors out on main_adhoccommandevent.
Is there a way to dump all the sql for main.0144_event_partitions? I've a awx 19.2.0 instance and can't get it to upgrade to any version above 19.2.0. I've tried 19.2.1, 19.2.2 and 19.3.0, all failed to migrate the 19.2.0 db. Its stuck on main.0144_event_partitions and it errors out on main_adhoccommandevent.
Some of the SQL is literal in the source code, other is abstracted with Django: https://github.com/ansible/awx/blob/devel/awx/main/migrations/0144_event_partitions.py
I just edited my comment above to include all the edits I made to my indexes before running the migration. To figure out what I needed, I compared my database tables to a vanilla/stock AWX 19.0.0 installation via simple Postgres commands. You might try the same with your main_adhoccommandevent table
\dt main_inventoryupdateevent_inventory_update_id_start_line_idx
\dt main_projectupdateevent_project_update_id_event_idx
\dt main_systemjobevent_system_job_id_uuid_idx
I compared my awx db with a fresh installed awx 19.2.0 db and the tables are identical. All the indexes on both db are the same. Attempting to run your commands listed above just errors with index already exist.
I was able to work around this issue in my installation by manually adding 3 missing indexes to main_inventoryupdateevent before migrating all the way to 19.2.0+
I have no idea why they were missing. I figured this out by manually comparing a vanilla 19.0.0 installation to my migrated 19.0.0 database
CREATE INDEX main_inventoryupdateevent_inventory_update_id_start_line_idx ON main_inventoryupdateevent (inventory_update_id, start_line); CREATE INDEX main_inventoryupdateevent_inventory_update_id_end_line_idx ON main_inventoryupdateevent(inventory_update_id, end_line); CREATE INDEX main_inventoryupdateevent_inventory_update_id_uuid_idx ON main_inventoryupdateevent(inventory_update_id, uuid); CREATE INDEX main_projectupdateevent_project_update_id_end_line_idx ON main_projectupdateevent (project_update_id, end_line); CREATE INDEX main_projectupdateevent_project_update_id_event_idx ON main_projectupdateevent (project_update_id, event); CREATE INDEX main_projectupdateevent_project_update_id_start_line_idx ON main_projectupdateevent (project_update_id, start_line); CREATE INDEX main_projectupdateevent_project_update_id_uuid_idx ON main_projectupdateevent (project_update_id, uuid); CREATE INDEX main_systemjobevent_system_job_id_end_line_idx ON main_systemjobevent (system_job_id, end_line); CREATE INDEX main_systemjobevent_system_job_id_start_line_idx ON main_systemjobevent (system_job_id, start_line); CREATE INDEX main_systemjobevent_system_job_id_uuid_idx ON main_systemjobevent (system_job_id, uuid);
It looks like I came up with the exact same solution as you did, but forgot to reply to my own thread. I created the indexes based on each traceback I got by re-running the migrations after creating an index.
I created the following indexes to make the migrations to complete (looks to be identical to yours) :
CREATE INDEX main_projectupdateevent_project_update_id_job__bfd22241_idx ON main_projectupdateevent(project_update_id, start_line);
CREATE INDEX main_projectupdateevent_project_update_id_job__bfd22242_idx ON main_projectupdateevent(project_update_id, end_line);
CREATE INDEX main_projectupdateevent_project_update_id_job__bfd22243_idx ON main_projectupdateevent(project_update_id, event);
CREATE INDEX main_projectupdateevent_project_update_id_job__bfd22244_idx ON main_projectupdateevent(project_update_id, uuid);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_job__bfd22241_idx ON main_inventoryupdateevent(inventory_update_id, start_line);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_job__bfd22242_idx ON main_inventoryupdateevent(inventory_update_id, end_line);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_job__bfd22243_idx ON main_inventoryupdateevent(inventory_update_id, event);
CREATE INDEX main_inventoryupdateevent_inventory_update_id_job__bfd22244_idx ON main_inventoryupdateevent(inventory_update_id, uuid);
CREATE INDEX main_systemjobevent_system_job_id_job__bfd22241_idx ON main_systemjobevent(system_job_id, start_line);
CREATE INDEX main_systemjobevent_system_job_id_job__bfd22242_idx ON main_systemjobevent(system_job_id, end_line);
CREATE INDEX main_systemjobevent_system_job_id_job__bfd22244_idx ON main_systemjobevent(system_job_id, uuid);
good to know I wasn't alone with this issue.
I installed a new 19.2.0 instance with db and turn the awx db to log all sql. Then ran the migration/upgrade to 19.2.1. I took the sql from the log for main_0144 and after backing up my real db, manually ran the migration of just main_0144, then deploy awx 19.2.1 and it was successfully migrated. All the commands from the sql generate from a clean installed ran without a hitch on the copy of my prod db.
Summary
I have migrated the postgresql-data from an older AWX docker-installation to a kubernetes-installation. Upgrade to version 19.2.0 (operator 0.10.0) works like a charm. Upgrading to either 19.2.1 or 19.2.2 fails during the data migration. The awx-operator logs prints no errors but browsing to the awx web-ui shows "awx is upgrading" in a forever-loop.
Running the "awx-manage migrate" manually from the awx-web container fails with:
Additional information from postgresql of table main_inventoryupdateevent:
AWX version
19.2.2
Installation method
kubernetes
Modifications
no
Ansible version
default
Operating system
Centos 8
Web browser
No response
Steps to reproduce
Either by migrating the database from an older docker-installation (e.g. awx version 17) directly into (19.2.1/19.2.2) or by migrating the data into 19.2.0 and then upgrade awx to (19.2.1/19.2.2) using the awx-operator (0.11.0 / 0.12.0).
Expected results
A working awx-installation
Actual results
awx-task & awx-web stuck during data-migration phase.
Additional information
No response