}
# Don't work with current revisions
- $tables[] = 'page';
- $conds[] = 'page_id=rev_page AND rev_id != page_latest';
+ # Don't lock the page table for update either -- TS 2006-04-04
+ #$tables[] = 'page';
+ #$conds[] = 'page_id=rev_page AND rev_id != page_latest';
$oldReadsSinceLastSlaveWait = 0; #check slave lag periodically
$totalMatchingRevisions = 0;
$dbr->ping();
# Get the page row
- $pageRes = $dbr->select( 'page', array('page_id', 'page_namespace', 'page_title'),
+ $pageRes = $dbr->select( 'page',
+ array('page_id', 'page_namespace', 'page_title','page_latest'),
$pageConds + array('page_id' => $pageId), $fname );
if ( $dbr->numRows( $pageRes ) == 0 ) {
continue;
# Load revisions
$revRes = $dbw->select( $tables, $fields,
- array( 'rev_page' => $pageRow->page_id ) + $conds,
+ array(
+ 'rev_page' => $pageRow->page_id,
+ # Don't operate on the current revision
+ # Use < instead of <> in case the current revision has changed
+ # since the page select, which wasn't locking
+ 'rev_id < ' . $pageRow->page_latest
+ ) + $conds,
$fname,
$revLoadOptions
);