Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about OpenUpgrade migration process #2255

Closed
ypapouin opened this issue Mar 25, 2020 · 7 comments · Fixed by #2256
Closed

Question about OpenUpgrade migration process #2255

ypapouin opened this issue Mar 25, 2020 · 7 comments · Fixed by #2256

Comments

@ypapouin
Copy link

Still in the process of migrating a database from 11.0 to 12.0 I just go an issue that made me asking for the migration process.

At the first attempt to migrate [A], I got an exception raised from UoM _check_category_reference_uniqueness because I had two entries set as reference for the same category.
After fixing the DB manualy, I made a new attempt to migrate [B], but a new exception is raised about a non existing column from the resource module pre-migration script.

After watching logs, I can see that the resource module has already been migrated during [A] (pre and post migration scripts are executed) and looking at the database schema, I can see that the column openupgrade_legacy_12_0_tz is already there.

So my question is :

  • Does the migration process is made using transaction ?
  • Why the resource module version has not been written during [A] since the exception is raised from another module migration (uom) ?

A: migrate-11-07_26__120_Upgrade_dec_database_to_OpenERP_Odoo_12_via_openupgrade.log
B: migrate-14-14_45__120_Upgrade_dec_database_to_OpenERP_Odoo_12_via_openupgrade.log

@pedrobaeza
Copy link
Member

Always restart the migration from the beginning for avoiding such problems and the ones depicted in #1879

@ypapouin
Copy link
Author

Thank you for answering me, I didn't have this issue on previous migrations (6.1->7.0->8.0->10.0->11.0) even after having to fix multiple database content issue using the try and retry naive iterative method, resuming was never an issue since once a module was migrated, its version was updated too and changes were committed to database.

I took a look on the loading script changes between 11.0 and 12.0

On 11.0 a commit is done after writing module latest_version and state attributes in the for loop
https://github.com/OCA/OpenUpgrade/blob/11.0/odoo/modules/loading.py#L265

On 12.0 this commit is done before writing these module attributes
https://github.com/OCA/OpenUpgrade/blob/12.0/odoo/modules/loading.py#L284

I can see a comment about unit tests and I understand why a commit is necessary first but I think a second commit should be done at the end of the for loop before the next iteration. What do you think about this ?

@pedrobaeza
Copy link
Member

As said, you are not doing things properly because of the end migration scripts. Any way, if there's a code error in that process that can be improved, @StefanRijnhart and @MiquelRForgeFlow can comment that are the main participants in that code.

@StefanRijnhart
Copy link
Member

Agreed with committing after the version number was written as well (so here: https://github.com/OCA/OpenUpgrade/blob/12.0/odoo/modules/loading.py#L305). Will you file a PR?

@pedrobaeza
Copy link
Member

I insist that resuming migration doesn't serve due to #1879, but it's good to fix the code any way.

@ypapouin
Copy link
Author

I insist that resuming migration doesn't serve due to #1879, but it's good to fix the code any way.

I agree with you and since odoo closed (cancelled ?) this POC, does OpenUpgrade should add a migration_state column to module table in order to resume a migration and execute end correctly ?

@StefanRijnhart
Copy link
Member

Yes, that would be the best thing, so if you could file a PR for that even better!

StefanRijnhart pushed a commit to StefanRijnhart/OpenUpgrade that referenced this issue Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants