Page MenuHomePhabricator

Exception Caught: Error in numRows(): Table 'metawiki.revtag_type' doesn't exist (10.0.6.36)
Closed, ResolvedPublic

Description

When adding or removing a page from a group on [[m:Special:AggregateGroups]], the change is saved (as I can check by refreshing the page), but I get the error "Exception Caught: Error in numRows(): Table 'metawiki.revtag_type' doesn't exist (10.0.6.36)" which is a bit ugly at least.
Another error with revtag_type was bug 39287, provisionally adding it in dependencies.


Version: 1.21.x
Severity: major
URL: https://meta.wikimedia.org/wiki/Special:AggregateGroups

Details

Reference
bz42430

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:57 AM
bzimport set Reference to bz42430.

This is an issue in the core database abstraction layer.

Minimal test case:

$db = wfGetDB( DB_SLAVE ); $res = $db->select( 'page', '*', array( 'page_id' => 1 ) ); $db->tableExists( 'foo' ); var_dump( $res->numRows() );
Error in numRows(): Table 'mediawiki.bw_foo' doesn't exist (localhost)

  • Bug 42633 has been marked as a duplicate of this bug. ***

Dependency for this issue appears to have been resolved (bug 39287), but the issue still exists.

happened to me just now, when trying to associate a page with a new aggregate group.

  • Bug 44794 has been marked as a duplicate of this bug. ***
  • Bug 45283 has been marked as a duplicate of this bug. ***
  • Bug 45879 has been marked as a duplicate of this bug. ***

(In reply to comment #8)

  • Bug 45879 has been marked as a duplicate of this bug. ***

Workaround for this specific case in translate: https://gerrit.wikimedia.org/r/#/c/52769/

Minimal test case confirms it's ok in vanilla PHP.

<?php

$sql = "SELECT * FROM wikidb.mw_user LIMIT 1";
$sql1 = "SELECT 1 FROM foobar LIMIT 1";

$con=mysql_connect("","","");

$result = mysql_query($sql, $con);
$result1 = mysql_query($sql1, $con);

var_dump( (bool)$result1 ); echo "\n";
echo mysql_num_rows( $result ) . "\n";

mysql_close($con);


/**

  • @throws DBUnexpectedError
  • @param $res ResultWrapper
  • @return int
	 */

function numRows( $res ) {

		if ( $res instanceof ResultWrapper ) {
			$res = $res->result;
		}
		wfSuppressWarnings();
		$n = mysql_num_rows( $res );
		wfRestoreWarnings();
		if( $this->lastErrno() ) {
			throw new DBUnexpectedError( $this, 'Error in numRows(): ' . htmlspecialchars( $this->lastError() ) );
		}
		return $n;

}

It's strange, as the code in numRows() is very minimal and doesn't depend on any class member variables

If this is not backported, I need to consider Reedy's workaround for Translate as BC code.

Still needs backporting – only 2 days left.

Still needs manual cherry-pick.

(In reply to comment #14)

Still needs manual cherry-pick.

To 1.21?

(In reply to comment #15)

(In reply to comment #14)

Still needs manual cherry-pick.

To 1.21?

Apparently... Unless someone rejects the backport request, that is.