Merge "rdbms: Support secondary autocommit connections in LoadBalancer"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 18 Aug 2017 01:38:01 +0000 (01:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 18 Aug 2017 01:38:01 +0000 (01:38 +0000)
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
includes/specials/SpecialNewpages.php

index 991e0c6..692ddb7 100644 (file)
@@ -778,6 +778,8 @@ abstract class DatabaseMysqlBase extends Database {
         * @see https://www.percona.com/doc/percona-toolkit/2.1/pt-heartbeat.html
         */
        protected function getHeartbeatData( array $conds ) {
+               // Query time and trip time are not counted
+               $nowUnix = microtime( true );
                // Do not bother starting implicit transactions here
                $this->clearFlag( self::DBO_TRX, self::REMEMBER_PRIOR );
                try {
@@ -793,7 +795,7 @@ abstract class DatabaseMysqlBase extends Database {
                        $this->restoreFlags();
                }
 
-               return [ $row ? $row->ts : null, microtime( true ) ];
+               return [ $row ? $row->ts : null, $nowUnix ];
        }
 
        protected function getApproximateLagStatus() {
index f64cd56..1665a5e 100644 (file)
@@ -1208,7 +1208,7 @@ class LoadBalancer implements ILoadBalancer {
                        if ( $limit > 0 && $time > $limit ) {
                                throw new DBTransactionSizeError(
                                        $conn,
-                                       "Transaction spent $time second(s) in writes, exceeding the $limit limit.",
+                                       "Transaction spent $time second(s) in writes, exceeding the limit of $limit.",
                                        [ $time, $limit ]
                                );
                        }
index 6a79714..e3b73a9 100644 (file)
@@ -494,17 +494,22 @@ class SpecialNewpages extends IncludableSpecialPage {
        }
 
        protected function feedItemDesc( $row ) {
-               $revision = $this->revisionFromRcResult( $row );
-               if ( $revision ) {
-                       // XXX: include content model/type in feed item?
-                       return '<p>' . htmlspecialchars( $revision->getUserText() ) .
-                               $this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
-                               htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
-                               "</p>\n<hr />\n<div>" .
-                               nl2br( htmlspecialchars( $revision->getContent()->serialize() ) ) . "</div>";
+               $revision = Revision::newFromId( $row->rev_id );
+               if ( !$revision ) {
+                       return '';
                }
 
-               return '';
+               $content = $revision->getContent();
+               if ( $content === null ) {
+                       return '';
+               }
+
+               // XXX: include content model/type in feed item?
+               return '<p>' . htmlspecialchars( $revision->getUserText() ) .
+                       $this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
+                       htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
+                       "</p>\n<hr />\n<div>" .
+                       nl2br( htmlspecialchars( $content->serialize() ) ) . "</div>";
        }
 
        protected function getGroupName() {