You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug 2089200 - Enforce unique nicknames with a UNIQUE index on profiles.nickname - #2815
New test t/bmo/user-nickname-unique.t: 9/9 pass, with no log noise.
Upgrade from today's schema: I set up a DB the old way (NOT NULL DEFAULT '' with a plain index) and ran checksetup. The '' values became NULL, the existing nickname stayed, and MySQL now shows UNIQUE KEY profiles_nickname_idx. A second checksetup run changed nothing.
Sanity suite plus extensions/Needinfo/t/mentions.t: 56 files, 17801 tests, all pass.
What changed (4 files):
Bugzilla/DB/Schema.pm: nickname can be NULL now, and its index is UNIQUE.
Bugzilla/Install/DB.pm: new _make_nicknames_unique(). It runs before _migrate_nicknames(), because that one saves users and would otherwise try to write NULL into a NOT NULL column. I also changed _migrate_nicknames() to look for nickname IS NULL instead of NOT nickname, which matched almost every nickname anyway.
Bugzilla/User.pm: users without a nickname now get NULL instead of ''. nick() still falls back to the part of the email before the @.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The nickname uniqueness constraint can abort upgrades when existing duplicates are present and cause uncaught duplicate-key errors during concurrent user saves.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The duplicate _update_nickname definition has an argument contract incompatible with its caller, causing saves to crash for existing nicknames, preventing nickname clearing, and omitting first-time assignments from the changes hash.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Profile cache eviction occurs before the outer transaction commits, allowing concurrent requests to repopulate stale profile data that remains cached after the save completes.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Evict the profile cache again after transaction commit
Bugzilla/User.pm:289
The new outer transaction moves SUPER::update()'s memcached eviction before the actual commit; _claim_nickname() also evicts while this transaction is still open. A concurrent request can then reload the old committed profile into memcached after the last eviction, leaving stale nicknames and other profile fields cached after the save completes. Invalidate the profile cache again after this commit so the earlier evictions cannot leave that stale entry behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests (all passing):
What changed (4 files):