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

Drop the update.title field from the database #3038

Merged
merged 2 commits into from
Mar 13, 2019

Conversation

bowlofeggs
Copy link
Contributor

There are two commits in this pull request. Please see their messages for details. The summary:

  • The first one indexes a field that really should have always been indexed. This is needed for the downgrade() on the migration for the second commit, which takes more than 10 minutes without an index (I killed it, so no idea how long it actually takes, just that it's more than 10 minutes). With the index, the downgrade() takes about 7 seconds on my laptop.
  • The second commit drops the title field from updates, and disallows referencing updates by title.

@bowlofeggs bowlofeggs added API Issues related to Bodhi's REST API Composer Issues related to the composer Client Issues with the bodhi command line interface tool Migration Issues or pull requests that involve a database migration High priority These issues are higher priority than normal Refactor Issues that are a refactor to improve maintainability for Bodhi reliability Issues pertaining to Bodhi's reliability Search Issues related to Bodhi's searching features Backwards incompatible The proposed change is backwards incompatible and should wait for the next major release labels Feb 22, 2019
@bowlofeggs bowlofeggs requested a review from a team as a code owner February 22, 2019 16:22
@bowlofeggs
Copy link
Contributor Author

This pull request will not pass CI until #2987 is merged, as it uses some Python 3-only syntax in the CLI.

Copy link
Contributor

@Zlopez Zlopez left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1672,7 +1666,7 @@ class Update(Base):
date_stable = Column(DateTime)

# eg: FEDORA-EPEL-2009-12345
alias = Column(Unicode(32), unique=True, nullable=True)
alias = Column(Unicode(32), unique=True, nullable=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

With this change, we can mark commit as fixing #1714

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, and thanks!

@@ -3248,7 +3246,7 @@ def test_comment_empty(self):
self.assertEqual(str(exc.exception), 'You must provide either some text or feedback')

def test_get_url(self):
self.assertEqual(self.obj.get_url(), u'updates/TurboGears-1.0.8-3.fc11')
self.assertEqual(self.obj.get_url(), f'updates/{self.obj.alias}')
idx = 'a3bbe1a8f2'
with mock.patch(target='uuid.uuid4', return_value='wat'):
self.obj.assign_alias()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method assign_alias was removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I believe I've successfully removed this everywhere.

builds=[build], user=user,
status=UpdateStatus.testing,
request=UpdateRequest.stable,
type=UpdateType.enhancement,
notes=u'Useful details!',
test_gating_status=TestGatingStatus.passed)
update.release = release
update.assign_alias()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method assign_alias was removed.

builds=[build1], user=user,
status=UpdateStatus.testing,
request=UpdateRequest.stable,
notes=u'Useful details!', release=release,
test_gating_status=TestGatingStatus.passed)
update1.assign_alias()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method assign_alias was removed.

builds=[build2], user=user,
status=UpdateStatus.testing,
request=UpdateRequest.stable,
notes=u'Useful details!', release=release,
test_gating_status=TestGatingStatus.passed)
update2.assign_alias()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method assign_alias was removed.

@@ -1631,10 +1627,8 @@ class Update(Base):

__tablename__ = 'updates'
__exclude_columns__ = ('id', 'user_id', 'release_id')
__include_extras__ = ('meets_testing_requirements', 'url',)
__get_by__ = ('title', 'alias')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Removing title from this container will block access to updates via /updates/{title}(like: bodhi.fedoraproject.org/updates/phpdoc-2.9.0-7.fc29) so maybe we should add note in release notes in B/I section?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

Copy link
Collaborator

@sebwoj sebwoj left a comment

Choose a reason for hiding this comment

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

It looks like this PR is in WIP state, but I've left just a few comments.

@bowlofeggs
Copy link
Contributor Author

The f28-integration test failure is a timeout waiting on the DB container to start. I wrote #3054 to help with this, and I think we can safely ignore it here.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
The updates.title field used to be a space separated list of the
builds found in the update, with a uniqueness constraint. There
were at least two problems with it.

One problem was that the list of builds was not consistently
updated (fedora-infra#1946) and sometimes the title did not reflect the current
set of builds in the update. This was more severe than it may seem,
because it turns out that the CLI was using the title to set the
list of builds when editing updates, instead of using the list of
builds. This means that the CLI could set the list of builds back
to a former set, rather than leaving it at the set it was
currently at. Note that the CLI does not currently support editing
the set of builds on an update (fedora-infra#3037), so it is especially
surprising when this happens.

The second problem is that large updates with many builds end up
generating a very long title and PostgreSQL raises an error
because it refuses to index strings beyond a certain length. It
was found, for example, that release engineering could not create
an update with 300 builds in it. Since we plan to use Bodhi to work
with side tags as part of gating Fedora Rawhide, it will be
important for users to be able to create updates with large
numbers of builds.

The title was also not a particularly useful field. It was possible
to use it as a key to access an update, but that was a poor use for
it since the title changes when the list of builds change, and
because the order of the list of builds was important. This led to
unpredictable and unstable URLs for updates, and Bodhi already had
an update alias field which is stable and is better suited for that
purpose.

This commit drops the field from the database and removes it from
being used to reference updates in the API. It preserves it in API
responses, however, but now generates it dynamically so that the
title is always an accurate list of the builds included in the
update.

fixes fedora-infra#186
fixes fedora-infra#1542
fixes fedora-infra#1714
fixes fedora-infra#1946

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
@bowlofeggs bowlofeggs merged commit 60dc56c into fedora-infra:develop Mar 13, 2019
@bowlofeggs bowlofeggs deleted the 1542 branch March 13, 2019 17:10
@bowlofeggs
Copy link
Contributor Author

This patch is planned for inclusion in the upcoming 4.0.0 release: #3221

@bowlofeggs
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to Bodhi's REST API Backwards incompatible The proposed change is backwards incompatible and should wait for the next major release Client Issues with the bodhi command line interface tool Composer Issues related to the composer High priority These issues are higher priority than normal Migration Issues or pull requests that involve a database migration Refactor Issues that are a refactor to improve maintainability for Bodhi reliability Issues pertaining to Bodhi's reliability Search Issues related to Bodhi's searching features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants