*/
$wgTrxProfilerLimits = array(
// Basic GET and POST requests
- 'GET' => array( 'masterConns' => 0, 'writes' => 0, 'readQueryTime' => 5 ),
- 'POST' => array( 'maxAffected' => 500, 'readQueryTime' => 5, 'writeQueryTime' => 1 ),
+ 'GET' => array(
+ 'masterConns' => 0,
+ 'writes' => 0,
+ 'readQueryTime' => 5
+ ),
+ 'POST' => array(
+ 'readQueryTime' => 5,
+ 'writeQueryTime' => 1,
+ 'maxAffected' => 500
+ ),
// Background job runner
- 'JobRunner' => array( 'maxAffected' => 500, 'readQueryTime' => 30, 'writeQueryTime' => 5 ),
+ 'JobRunner' => array(
+ 'readQueryTime' => 30,
+ 'writeQueryTime' => 5,
+ 'maxAffected' => 500
+ ),
// Command-line scripts
- 'Maintenance' => array( 'maxAffected' => 1000, 'writeQueryTime' => 5 )
+ 'Maintenance' => array(
+ 'writeQueryTime' => 5,
+ 'maxAffected' => 1000
+ )
);
/**
}
$this->runOnTransactionPreCommitCallbacks();
+ $writeTime = $this->pendingWriteQueryDuration();
$this->doCommit( $fname );
if ( $this->mTrxDoneWrites ) {
$this->mDoneWrites = microtime( true );
$this->getTransactionProfiler()->transactionWritingOut(
- $this->mServer, $this->mDBname, $this->mTrxShortId );
+ $this->mServer, $this->mDBname, $this->mTrxShortId, $writeTime );
}
$this->runOnTransactionIdleCallbacks();
}
}
$this->runOnTransactionPreCommitCallbacks();
+ $writeTime = $this->pendingWriteQueryDuration();
$this->doCommit( $fname );
if ( $this->mTrxDoneWrites ) {
$this->mDoneWrites = microtime( true );
$this->getTransactionProfiler()->transactionWritingOut(
- $this->mServer, $this->mDBname, $this->mTrxShortId );
+ $this->mServer, $this->mDBname, $this->mTrxShortId, $writeTime );
}
$this->runOnTransactionIdleCallbacks();
}
'masterConns' => INF,
'maxAffected' => INF,
'readQueryTime' => INF,
- 'writeQueryTime' => INF,
+ 'writeQueryTime' => INF
);
/** @var array */
protected $expectBy = array();
* @param string $server DB server
* @param string $db DB name
* @param string $id ID string of transaction
+ * @param float $writeTime Time spent in write queries
*/
- public function transactionWritingOut( $server, $db, $id ) {
+ public function transactionWritingOut( $server, $db, $id, $writeTime = 0.0 ) {
$name = "{$server} ({$db}) (TRX#$id)";
if ( !isset( $this->dbTrxMethodTimes[$name] ) ) {
$this->logger->info( "Detected no transaction for '$name' - out of sync." );
return;
}
+ // Warn if too much time was spend writing...
+ if ( $writeTime > $this->expect['writeQueryTime'] ) {
+ $this->reportExpectationViolated( 'writeQueryTime',
+ "[transaction $id writes to {$server} ({$db})]" );
+ }
// Fill in the last non-query period...
$lastQuery = end( $this->dbTrxMethodTimes[$name] );
if ( $lastQuery ) {