Closed Bug 1181751 Opened 10 years ago Closed 10 years ago

Persona.display_username has shorter max_length than UserProfile.display_name, results in errors

Categories

(addons.mozilla.org Graveyard :: Developer Pages, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
2015-07

People

(Reporter: kmag, Assigned: magopian)

References

()

Details

We should really drop this column entirely and use the author's display_name directly. Sentry URL: http://sentry.mktmon.services.phx1.mozilla.com/mkt/addonsmozillaorg/group/6322/ Aggregate Details: * First Seen: May 7, 2014 * Last Seen: 10 hours ago * Number of tracebacks: undefined Traceback: Stacktrace (most recent call last): File "django/core/handlers/base.py", line 112, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "amo/decorators.py", line 165, in wrapper return f(*args, **kw) File "amo/decorators.py", line 152, in __call__ return self.f(*args, **kw) File "amo/decorators.py", line 32, in wrapper return func(request, *args, **kw) File "devhub/views.py", line 1601, in submit_theme addon = form.save() File "addons/forms.py", line 523, in save p.save() File "django/db/models/base.py", line 545, in save force_update=force_update, update_fields=update_fields) File "django/db/models/base.py", line 573, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "django/db/models/base.py", line 654, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "django/db/models/base.py", line 687, in _do_insert using=using, raw=raw) File "django/db/models/manager.py", line 232, in _insert return insert_query(self.model, objs, fields, **kwargs) File "django/db/models/query.py", line 1514, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "django/db/models/sql/compiler.py", line 903, in execute_sql cursor.execute(sql, params) File "django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) File "django/db/utils.py", line 99, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) File "django/db/backends/mysql/base.py", line 124, in execute return self.cursor.execute(query, args) File "MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue
Dropping the field might cause us some troubles performance wise: having this field denormalized allows us to get the display name straight from the same table, without joins. If we use the user display_name, it means we have to join from the persona table on - the addons - the addons_users - the users It also makes sense to denormalize this field because unlike for add-ons, there's only one author for a theme. This needs more investigation, because if we're only using this field on the theme listing, and not on the "theme list page" or anywhere where it would result in an exponential number of db queries (eg if the lists are queried from ElasticSearch), we could very well drop the field and not care that much about the extra joins. Thoughts? I'm submitting the naive/simple fix for now which is to increase the size of the display_username field: https://github.com/mozilla/olympia/pull/606
I'm not sure we get a significant performance win from this. This field exists entirely for legacy reasons. Personas on AMO used to be simple mirrors from getpersonas.org, where authorship worked differently, and they weren't linked to actual AMO accounts. And even if there were a significant win from cutting out that join, we're doing it anyway in most cases where we deal with personas, for other reasons.
Commits pushed to master at https://github.com/mozilla/olympia https://github.com/mozilla/olympia/commit/6bbb7a45e911dea75fddb432cb59c438f9f9203d Increase the Persona author and display_username fields size (bug 1181751) https://github.com/mozilla/olympia/commit/b4416ae9dcebe75b12ed8c83e052e07a51b6ecfc Merge pull request #606 from magopian/1181751-increase-persona-author-display_username Increase the Persona author and display_username fields size (bug 1181751)
Assignee: nobody → mathieu
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2015-07
the STRs are: 1/ change your username and/or display name to be longuer than 32 characters 2/ submit a new lightweight theme 3/ it shouldn't show the Oops page (previously, as can be tested on production, it was raising a 500 server error)
Thanks Mathieu for the details! Verified as fixed in FF39(Win7) Postfix screencast: http://screencast.com/t/4VYzPhc1 Closing bug.
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.