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

add column to packages for current_serial, as well as trigger on journal... #195

Closed
wants to merge 5 commits into from

Conversation

ewdurbin
Copy link
Member

@ewdurbin ewdurbin commented Feb 9, 2014

...s to keep it up to date.

this will allow our XMLRPC call for list_packages_with_serial() to execute without the insane join

…nals to keep it up to date.

this will allow our XMLRPC call for list_packages_with_serial() to execute without the insane join
FOR EACH ROW
EXECUTE PROCEDURE update_packages_current_serial();
""")
op.execute("""
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't apply this as a part of the migration. I'd recommend doing this as a backfill on all columns that are NULL later.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahhh, the NULL check should be part of this command regardless.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'd just separate this data migration from the schema migration personally. Since this is going to just update 40k rows. Everything else is non-blocking.

Copy link
Member Author

Choose a reason for hiding this comment

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

i'd approximate the update to block for only 20 to 30 seconds based on benchmarks for the select i performed last night.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine. We can do this with 0 blocking though. :) But the downtime is your call. I also, out of principal, like to keep data and schema migrations separately. The schema migration here is safe to apply at any time, and you'd want to more-or-less, schedule the data migration or run it offline, etc. Again, not sure how things are set upw tih pypi or how things are typically done. Just my 2 cents.

Copy link
Member Author

Choose a reason for hiding this comment

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

the migration is going to run in a transaction, so there are two things i think i can confidently say:

  • NULL check is good practice, but shouldn't be necessary
  • calls to the packages table in the meantime will just wait for the transaction to finish, so downtime shouldn't be necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if that's a risk you're willing to take, then I'd just do this all in one shot and remove the nullable constraint at the end. Or just set a default and let it block while writing the column.

I only suggested making it nullable assuming a data migration "at some point in the future".

@dstufft
Copy link
Member

dstufft commented Feb 14, 2014

Do we still need/want this with the tuning we've done to PostgreSQL?

@ewdurbin
Copy link
Member Author

i don't think it'll be necessary quite yet.

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 this pull request may close these issues.

None yet

4 participants