-
Notifications
You must be signed in to change notification settings - Fork 196
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
Conversation
This pull request will not pass CI until #2987 is merged, as it uses some Python 3-only syntax in the CLI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dad53db
to
e2279ba
Compare
@@ -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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and thanks!
bodhi/tests/server/test_models.py
Outdated
@@ -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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
bodhi/tests/server/test_models.py
Outdated
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() |
There was a problem hiding this comment.
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.
bodhi/tests/server/test_models.py
Outdated
builds=[build1], user=user, | ||
status=UpdateStatus.testing, | ||
request=UpdateRequest.stable, | ||
notes=u'Useful details!', release=release, | ||
test_gating_status=TestGatingStatus.passed) | ||
update1.assign_alias() |
There was a problem hiding this comment.
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.
bodhi/tests/server/test_models.py
Outdated
builds=[build2], user=user, | ||
status=UpdateStatus.testing, | ||
request=UpdateRequest.stable, | ||
notes=u'Useful details!', release=release, | ||
test_gating_status=TestGatingStatus.passed) | ||
update2.assign_alias() |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!
There was a problem hiding this 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.
484a944
to
d6b9a71
Compare
6a5f885
to
81aff6a
Compare
a4c638f
to
2fdd2c2
Compare
The |
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>
This patch is planned for inclusion in the upcoming 4.0.0 release: #3221 |
Bodhi 4.0.0 beta is built and deployed to staging: https://copr.fedorainfracloud.org/coprs/bowlofeggs/bodhi-pre-release |
There are two commits in this pull request. Please see their messages for details. The summary: