This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
SUS-1620 | Introduced User::touch() method to bump the getTouched() value using memcached #12923
Merged
Conversation
This file contains 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
…alue using memcached * This lets some callers avoid the heavyweight invalidateCache() method Backporting wikimedia/mediawiki@87d2eba (MW 1.25)
… query * This method is used for clearing the User cache as well as bumping the value of getTouched() for HTTP 304 logic. These do not need to do the actual user_touched update. * This also avoids problems with setting mTouched but deferring the update. That confused the CAS update logic since it expects mTouched to be in the DB. Backporting wikimedia/mediawiki@5b4bd16 (MW 1.26)
WikiaTech
reviewed
May 16, 2017
@@ -130,12 +130,18 @@ class User implements JsonSerializable { | |||
/** @name Cache variables */ | |||
//@{ |
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.
SonarQube analysis reported 96 issues Watch the comments in this conversation to review them. Top 10 extra issuesNote: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:
|
WikiaTech
reviewed
May 16, 2017
@@ -130,12 +130,18 @@ class User implements JsonSerializable { | |||
/** @name Cache variables */ | |||
//@{ | |||
var $mId, $mName, $mRealName, | |||
$mEmail, $mTouched, $mToken, $mEmailAuthenticated, | |||
$mEmail, $mToken, $mEmailAuthenticated, | |||
$mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides, | |||
$mCookiePassword, $mEditCount, $mAllowUsertalk; | |||
var $mBirthDate; // Wikia. Added to reflect our user table layout. |
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.
WikiaTech
reviewed
May 16, 2017
@@ -130,12 +130,18 @@ class User implements JsonSerializable { | |||
/** @name Cache variables */ | |||
//@{ | |||
var $mId, $mName, $mRealName, | |||
$mEmail, $mTouched, $mToken, $mEmailAuthenticated, | |||
$mEmail, $mToken, $mEmailAuthenticated, | |||
$mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides, | |||
$mCookiePassword, $mEditCount, $mAllowUsertalk; | |||
var $mBirthDate; // Wikia. Added to reflect our user table layout. | |||
//@} |
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.
mszabo-wikia
approved these changes
May 16, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
https://wikia-inc.atlassian.net/browse/SUS-1620
User::invalidateCache
will no longer try to updateuser.user_touched
on shared database which was prone to deadlocks. Instead it will just set a key in memcache (via newUser::touch
method). This will greatly reduce the number of such queries (we currently make 640k of these every day, that's 68% of allUPDATE
queries on shared db master node).invalidateCache
is usually called when an edit / upload is made (viaUser::addWatch
method) or when a user is created from an auth token (User::newFromToken
method).user_touched
field is still updated whenUser::saveSettings
is called (e.g. preferences are saved).User::getTouched
will now return the greater of these -user_touched
field fromuser
table / value stored in memcache (set viaUser::touch
)