Removed references to DB ignoreErrors() function.

Change-Id: I9441d897d45bca189c17b8bcca4ea7b3469af8b0
This commit is contained in:
Aaron Schulz 2012-12-11 11:24:12 -08:00
parent 86fe0e06ee
commit 1da33a49a0
4 changed files with 77 additions and 87 deletions

View file

@ -1031,7 +1031,6 @@ class LCStore_DB implements LCStore {
if ( $this->dbw->wasReadOnlyError() ) {
$this->readOnly = true;
$this->dbw->rollback( __METHOD__ );
$this->dbw->ignoreErrors( false );
return;
} else {
throw $e;

View file

@ -302,55 +302,51 @@ abstract class QueryPage extends SpecialPage {
return false;
}
if ( $ignoreErrors ) {
$ignoreW = $dbw->ignoreErrors( true );
$ignoreR = $dbr->ignoreErrors( true );
}
# Clear out any old cached data
$dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
# Do query
$res = $this->reallyDoQuery( $limit, false );
$num = false;
if ( $res ) {
$num = $res->numRows();
# Fetch results
$vals = array();
while ( $res && $row = $dbr->fetchObject( $res ) ) {
if ( isset( $row->value ) ) {
if ( $this->usesTimestamps() ) {
$value = wfTimestamp( TS_UNIX,
$row->value );
try {
# Clear out any old cached data
$dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
# Do query
$res = $this->reallyDoQuery( $limit, false );
$num = false;
if ( $res ) {
$num = $res->numRows();
# Fetch results
$vals = array();
while ( $res && $row = $dbr->fetchObject( $res ) ) {
if ( isset( $row->value ) ) {
if ( $this->usesTimestamps() ) {
$value = wfTimestamp( TS_UNIX,
$row->value );
} else {
$value = intval( $row->value ); // @bug 14414
}
} else {
$value = intval( $row->value ); // @bug 14414
$value = 0;
}
} else {
$value = 0;
$vals[] = array( 'qc_type' => $this->getName(),
'qc_namespace' => $row->namespace,
'qc_title' => $row->title,
'qc_value' => $value );
}
$vals[] = array( 'qc_type' => $this->getName(),
'qc_namespace' => $row->namespace,
'qc_title' => $row->title,
'qc_value' => $value );
}
# Save results into the querycache table on the master
if ( count( $vals ) ) {
if ( !$dbw->insert( 'querycache', $vals, __METHOD__ ) ) {
// Set result to false to indicate error
$num = false;
# Save results into the querycache table on the master
if ( count( $vals ) ) {
$dbw->insert( 'querycache', $vals, __METHOD__ );
}
# Update the querycache_info record for the page
$dbw->delete( 'querycache_info', array( 'qci_type' => $this->getName() ), $fname );
$dbw->insert( 'querycache_info',
array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ),
$fname );
}
if ( $ignoreErrors ) {
$dbw->ignoreErrors( $ignoreW );
$dbr->ignoreErrors( $ignoreR );
} catch ( DBError $e ) {
if ( !$ignoreErrors ) {
throw $e; // report query error
}
# Update the querycache_info record for the page
$dbw->delete( 'querycache_info', array( 'qci_type' => $this->getName() ), $fname );
$dbw->insert( 'querycache_info', array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ), $fname );
$num = false; // set result to false to indicate error
}
return $num;
}

View file

@ -53,16 +53,13 @@ class ViewCountUpdate implements DeferrableUpdate {
}
# Not important enough to warrant an error page in case of failure
$oldignore = $dbw->ignoreErrors( true );
$dbw->insert( 'hitcounter', array( 'hc_id' => $this->id ), __METHOD__ );
$checkfreq = intval( $wgHitcounterUpdateFreq / 25 + 1 );
if ( rand() % $checkfreq == 0 && $dbw->lastErrno() == 0 ) {
$this->collect();
}
$dbw->ignoreErrors( $oldignore );
try {
$dbw->insert( 'hitcounter', array( 'hc_id' => $this->id ), __METHOD__ );
$checkfreq = intval( $wgHitcounterUpdateFreq / 25 + 1 );
if ( rand() % $checkfreq == 0 && $dbw->lastErrno() == 0 ) {
$this->collect();
}
} catch ( DBError $e ) {}
}
protected function collect() {

View file

@ -524,52 +524,50 @@ class Profiler {
return;
}
$errorState = $dbw->ignoreErrors( true );
if( $wgProfilePerHost ){
$pfhost = wfHostname();
} else {
$pfhost = '';
}
$this->collateData();
try {
$this->collateData();
foreach( $this->mCollated as $name => $elapsed ){
$eventCount = $this->mCalls[$name];
$timeSum = (float) ($elapsed * 1000);
$memorySum = (float)$this->mMemory[$name];
$name = substr($name, 0, 255);
foreach( $this->mCollated as $name => $elapsed ){
$eventCount = $this->mCalls[$name];
$timeSum = (float) ($elapsed * 1000);
$memorySum = (float)$this->mMemory[$name];
$name = substr($name, 0, 255);
// Kludge
$timeSum = ($timeSum >= 0) ? $timeSum : 0;
$memorySum = ($memorySum >= 0) ? $memorySum : 0;
// Kludge
$timeSum = ($timeSum >= 0) ? $timeSum : 0;
$memorySum = ($memorySum >= 0) ? $memorySum : 0;
$dbw->update( 'profiling',
array(
"pf_count=pf_count+{$eventCount}",
"pf_time=pf_time+{$timeSum}",
"pf_memory=pf_memory+{$memorySum}",
),
array(
'pf_name' => $name,
'pf_server' => $pfhost,
),
__METHOD__ );
$dbw->update( 'profiling',
array(
"pf_count=pf_count+{$eventCount}",
"pf_time=pf_time+{$timeSum}",
"pf_memory=pf_memory+{$memorySum}",
),
array(
'pf_name' => $name,
'pf_server' => $pfhost,
),
__METHOD__ );
$rc = $dbw->affectedRows();
if ( $rc == 0 ) {
$dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ),
__METHOD__, array ('IGNORE'));
$rc = $dbw->affectedRows();
if ( $rc == 0 ) {
$dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ),
__METHOD__, array ('IGNORE'));
}
// When we upgrade to mysql 4.1, the insert+update
// can be merged into just a insert with this construct added:
// "ON DUPLICATE KEY UPDATE ".
// "pf_count=pf_count + VALUES(pf_count), ".
// "pf_time=pf_time + VALUES(pf_time)";
}
// When we upgrade to mysql 4.1, the insert+update
// can be merged into just a insert with this construct added:
// "ON DUPLICATE KEY UPDATE ".
// "pf_count=pf_count + VALUES(pf_count), ".
// "pf_time=pf_time + VALUES(pf_time)";
}
$dbw->ignoreErrors( $errorState );
} catch ( DBError $e ) {}
}
/**