Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/199819
Change subject: Fixed the usage of $flags in loadLastEdit()
......................................................................
Fixed the usage of $flags in loadLastEdit()
Bug: T93976
Change-Id: I57eb41b463116ea27c0fc8dac8fff07db593499a
---
M includes/page/WikiPage.php
1 file changed, 17 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/19/199819/1
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 5527ace..2315dc7 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -602,13 +602,23 @@
return; // page doesn't exist or is missing page_latest
info
}
- // Bug 37225: if session S1 loads the page row FOR UPDATE, the
result always includes the
- // latest changes committed. This is true even within
REPEATABLE-READ transactions, where
- // S1 normally only sees changes committed before the first S1
SELECT. Thus we need S1 to
- // also gets the revision row FOR UPDATE; otherwise, it may not
find it since a page row
- // UPDATE and revision row INSERT by S2 may have happened after
the first S1 SELECT.
- //
http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read.
- $flags = ( $this->mDataLoadedFrom == self::READ_LOCKING ) ?
Revision::READ_LOCKING : 0;
+ if ( $this->mDataLoadedFrom == self::READ_LOCKING ) {
+ // Bug 37225: if session S1 loads the page row FOR
UPDATE, the result always
+ // includes the latest changes committed. This is true
even within REPEATABLE-READ
+ // transactions, where S1 normally only sees changes
committed before the first S1
+ // SELECT. Thus we need S1 to also gets the revision
row FOR UPDATE; otherwise, it
+ // may not find it since a page row UPDATE and revision
row INSERT by S2 may have
+ // happened after the first S1 SELECT.
+ //
http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read.
+ $flags = Revision::READ_LOCKING;
+ } elseif ( $this->mDataLoadedFrom == self::READ_LATEST ) {
+ // Bug T93976: if page_latest was loaded from the
master, fetch the
+ // revision from there as well, as it may not exist yet
on a slave DB.
+ // Also, this keeps the queries in the same
REPEATABLE-READ snapshot.
+ $flags = Revision::READ_LATEST;
+ } else {
+ $flags = 0;
+ }
$revision = Revision::newFromPageId( $this->getId(), $latest,
$flags );
if ( $revision ) { // sanity
$this->setLastEdit( $revision );
--
To view, visit https://gerrit.wikimedia.org/r/199819
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I57eb41b463116ea27c0fc8dac8fff07db593499a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits