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

Bug 1423549 - PerformanceSignature specifies unique_together twice, so the first is ignored #3979

Merged
merged 1 commit into from Oct 1, 2018

Conversation

ionutgoldan
Copy link
Contributor

No description provided.


operations = [
migrations.AlterUniqueTogether(
name='performancesignature',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How big is this table? (Time taken to run the migration)

Could we try the migration on prototype? Also worth noting that there's presumably a chance the constraint could fail when it runs on production, due to it not having been enforced before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How big is this table? (Time taken to run the migration)

I couldn't say something about the duration of running this. ATM the performance_signature table contains around 350K rows.

Could we try the migration on prototype?

Yes, we should do that.

Also worth noting that there's presumably a chance the constraint could fail when it runs on production, due to it not having been enforced before.

@edmorley How easy is it for us to recover from a migration exception during deployment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How easy is it for us to recover from a migration exception during deployment?

I think in this case the new indexes/constraints would just get rolled back, but you'd need to check the MySQL docs or with a DBA to be sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATM the performance_signature table contains around 350K rows.

Ah small enough that time taken won't be an issue (guessing seconds to minutes).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this link which says there are DDL statements (including table altering) that can not be rolled back. Unfortunately, it doesn't mention about ALTER TABLE ADD CONSTRAINT UNIQUE specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edmorley Found this in the MySQL docs:

When you create a UNIQUE or PRIMARY KEY index, MySQL must do some extra work. For UNIQUE indexes, MySQL checks that the table contains no duplicate values for the key.

This sounds like we would only get a console error, but the database shouldn't have problems (schema & data wise). This person here confirms my assumption, saying that an error message will be prompted if duplicated data already exists.

Copy link
Contributor

@edmorley edmorley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the research - I'm happy to give this a go on prototype once it's rebased on master and the change made below?

class Migration(migrations.Migration):

dependencies = [
('model', '0008_remove_failure_match'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adjust this for the new migrations on master? (s/0008_remove_failure_match/0010_remove_runnable_job/)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adjust this for the new migrations on master? (s/0008_remove_failure_match/0010_remove_runnable_job/)

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis is failing; the dependency now references a deleted migration

@ionutgoldan ionutgoldan temporarily deployed to treeherder-prototype September 28, 2018 12:42 Inactive
@ionutgoldan ionutgoldan temporarily deployed to treeherder-prototype September 28, 2018 12:50 Inactive
@ionutgoldan
Copy link
Contributor Author

ionutgoldan commented Oct 1, 2018

@edmorley I deployed this on treeherder-prototype last Friday, tested it a little bit and all went fine. It's good to land.

@edmorley
Copy link
Contributor

edmorley commented Oct 1, 2018

Sounds good - I'll merge now, thank you :-)

@edmorley edmorley merged commit e307fad into mozilla:master Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants