Tim Starling has uploaded a new change for review.

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


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, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/67387/1

diff --git a/includes/Revision.php b/includes/Revision.php
index 47626a2..7f72492 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -115,7 +115,8 @@
                        // Use a join to get the latest revision
                        $conds[] = 'rev_id=page_latest';
                }
-               return self::newFromConds( $conds, (int)$flags );
+               $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : 
DB_SLAVE );
+               return self::loadFromConds( $db, $conds, $flags );
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41189fcde1b8065ac134982241376d63b78732a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>

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

Reply via email to