jenkins-bot has submitted this change and it was merged.

Change subject: Avoid master queries in Revision::newFromTitle(..., 
Revision::READ_NORMAL)
......................................................................


Avoid master queries in Revision::newFromTitle(..., Revision::READ_NORMAL)

The fallback to master makes sense in Revision::newFromId(), since a
revision ID known to exist by some other means might be present in the
master but not in the slave. But it doesn't make sense for
Revision::newFromTitle(), where by far the most common cause of this
case being hit is the page being nonexistent.

Change-Id: I41189fcde1b8065ac134982241376d63b78732a1
---
M includes/Revision.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Tim Starling: Looks good to me, approved
  Aaron Schulz: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/Revision.php b/includes/Revision.php
index 305c8ff..233eac0 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -116,11 +116,13 @@
                if ( $id ) {
                        // Use the specified ID
                        $conds['rev_id'] = $id;
+                       return self::newFromConds( $conds, (int)$flags );
                } else {
                        // Use a join to get the latest revision
                        $conds[] = 'rev_id=page_latest';
+                       $db = wfGetDB( ( $flags & self::READ_LATEST ) ? 
DB_MASTER : DB_SLAVE );
+                       return self::loadFromConds( $db, $conds, $flags );
                }
-               return self::newFromConds( $conds, (int)$flags );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I41189fcde1b8065ac134982241376d63b78732a1
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to