Merge "Guard "NotPatrollablePage" negative caching against slave lag"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 17 Sep 2015 18:46:52 +0000 (18:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 17 Sep 2015 18:46:52 +0000 (18:46 +0000)
includes/page/Article.php

index 54db19c..120aa5c 100644 (file)
@@ -1121,16 +1121,26 @@ class Article implements Page {
                                        '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