Matthias Mullie has uploaded a new change for review.

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

Change subject: (bug 62634) Fatal exception "DatabaseBase::makeList: empty 
input for field rev_id" on Special:Contributions
......................................................................

(bug 62634) Fatal exception "DatabaseBase::makeList: empty input for field 
rev_id" on Special:Contributions

$id was a UUID object here. Using it as array key results in warning
"Illegal offset type", causing the element not to be added to $pks,
resulting in an empty array being fed to findRevIdReal() which, in
turn, will attempt to build a query "WHERE 'rev_id' = <empty>",
resulting in an error from DatabaseBase::makeList.

This likely only happened on Special:Contributions, since it's
one of the few places where we can't read data from cache.
It happened inconsistently, because it only attempts this code
path when there are 3 different "queries". In the case of this
specific error: this happened when a user has > 3 Flow entries in
his/her contributions, that had previous revisions. So this mainly
occurs for people editing/moderating a lot in Flow.

Bug: 62634
Change-Id: I9ed1486cd203a324e24c1f62d0f38d2e0d95cc30
---
M includes/Data/RevisionStorage.php
1 file changed, 23 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/94/118694/1

diff --git a/includes/Data/RevisionStorage.php 
b/includes/Data/RevisionStorage.php
index a610750..91a4227 100644
--- a/includes/Data/RevisionStorage.php
+++ b/includes/Data/RevisionStorage.php
@@ -155,8 +155,9 @@
                $duplicator = new ResultDuplicator( array( 'rev_id' ), 1 );
                $pks = array();
                foreach ( $queries as $idx => $query ) {
+                       $query = UUID::convertUUIDs( $query );
                        $id = $query['rev_id'];
-                       $duplicator->add( UUID::convertUUIDs( $query ), $idx );
+                       $duplicator->add( $query, $idx );
                        $pks[$id] = $id;
                }
 
@@ -210,26 +211,28 @@
        }
 
        protected function findRevIdReal( ResultDuplicator $duplicator, array 
$revisionIds ) {
-               //  SELECT * from flow_tree_revision
-               //        JOIN flow_revision ON tree_rev_id = rev_id
-               //   WHERE tree_rev_id IN (...)
-               $dbr = $this->dbFactory->getDB( DB_MASTER );
-               $res = $dbr->select(
-                       array( 'flow_revision', 'rev' => $this->joinTable() ),
-                       '*',
-                       array( 'rev_id' => $revisionIds ),
-                       __METHOD__,
-                       array(),
-                       array( 'rev' => array( 'JOIN', 'rev_id = ' . 
$this->joinField() ) )
-               );
-               if ( !$res ) {
-                       // TODO: dont fail, but dont end up caching bad result 
either
-                       throw new DataModelException( 'query failure', 
'process-data' );
-               }
+               if ( $revisionIds ) {
+                       //  SELECT * from flow_tree_revision
+                       //        JOIN flow_revision ON tree_rev_id = rev_id
+                       //   WHERE tree_rev_id IN (...)
+                       $dbr = $this->dbFactory->getDB( DB_MASTER );
+                       $res = $dbr->select(
+                               array( 'flow_revision', 'rev' => 
$this->joinTable() ),
+                               '*',
+                               array( 'rev_id' => $revisionIds ),
+                               __METHOD__,
+                               array(),
+                               array( 'rev' => array( 'JOIN', 'rev_id = ' . 
$this->joinField() ) )
+                       );
+                       if ( !$res ) {
+                               // TODO: dont fail, but dont end up caching bad 
result either
+                               throw new DataModelException( 'query failure', 
'process-data' );
+                       }
 
-               foreach ( $res as $row ) {
-                       $row = (array)$row;
-                       $duplicator->merge( $row, array( $row ) );
+                       foreach ( $res as $row ) {
+                               $row = (array)$row;
+                               $duplicator->merge( $row, array( $row ) );
+                       }
                }
 
                return $duplicator->getResult();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ed1486cd203a324e24c1f62d0f38d2e0d95cc30
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

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

Reply via email to