[MediaWiki-commits] [Gerrit] Guard "NotPatrollablePage" negative caching against slave lag - change (mediawiki/core)

2015-09-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Guard "NotPatrollablePage" negative caching against slave lag
..


Guard "NotPatrollablePage" negative caching against slave lag

After some poking I'm fairly sure this is why pages get
"unpatrollable".

Bug: T100986
Change-Id: I137b25ec0538dcc7ad8b6f1b32d5103fd256462c
---
M includes/page/Article.php
1 file changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/page/Article.php b/includes/page/Article.php
index 54db19c..120aa5c 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1121,16 +1121,26 @@
'rc_new' => 1,
'rc_timestamp' => 
$oldestRevisionTimestamp,
'rc_namespace' => 
$this->getTitle()->getNamespace(),
-   'rc_cur_id' => 
$this->getTitle()->getArticleID(),
-   'rc_patrolled' => 0
+   'rc_cur_id' => 
$this->getTitle()->getArticleID()
),
__METHOD__,
array( 'USE INDEX' => 'new_name_timestamp' )
);
+   } else {
+   // Cache the information we gathered above in case we 
can't patrol
+   // Don't cache in case we can patrol as this could 
change
+   $cache->set( wfMemcKey( 'NotPatrollablePage', 
$this->getTitle()->getArticleID() ), '1' );
}
 
if ( !$rc ) {
-   // No RC entry around
+   // Don't cache: This can be hit if the page gets 
accessed very fast after
+   // its creation or in case we have high slave lag. In 
case the revision is
+   // too old, we will already return above.
+   return false;
+   }
+
+   if ( $rc->getAttribute( 'rc_patrolled' ) ) {
+   // Patrolled RC entry around
 
// Cache the information we gathered above in case we 
can't patrol
// Don't cache in case we can patrol as this could 
change

-- 
To view, visit https://gerrit.wikimedia.org/r/227760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I137b25ec0538dcc7ad8b6f1b32d5103fd256462c
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Ori.livneh 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Guard "NotPatrollablePage" negative caching against slave lag - change (mediawiki/core)

2015-07-29 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/227760

Change subject: Guard "NotPatrollablePage" negative caching against slave lag
..

Guard "NotPatrollablePage" negative caching against slave lag

After some poking I'm fairly sure this is why pages get
"unpatrollable".

Bug: T100986
Change-Id: I137b25ec0538dcc7ad8b6f1b32d5103fd256462c
---
M includes/page/Article.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/227760/1

diff --git a/includes/page/Article.php b/includes/page/Article.php
index e58ffc8..5f1f1d7 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1129,8 +1129,11 @@
);
}
 
-   if ( !$rc ) {
-   // No RC entry around
+   $lagArray = wfGetLB()->getMaxLag();
+   $revisionAge = time() - wfTimestamp( TS_UNIX, 
$oldestRevisionTimestamp );
+
+   if ( !$rc && $revisionAge > $lagArray[1] && $revisionAge > 1 ) {
+   // No RC entry around, and we can be sure that the miss 
above wasn't caused by slave lag.
 
// Cache the information we gathered above in case we 
can't patrol
// Don't cache in case we can patrol as this could 
change

-- 
To view, visit https://gerrit.wikimedia.org/r/227760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I137b25ec0538dcc7ad8b6f1b32d5103fd256462c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits