Merge "Log startAtomic()/endAtomic() to the query logger"
This commit is contained in:
commit
b6fecdf6fe
1 changed files with 12 additions and 0 deletions
|
|
@ -3684,6 +3684,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
|
||||
$sectionId = new AtomicSectionIdentifier;
|
||||
$this->trxAtomicLevels[] = [ $fname, $sectionId, $savepointId ];
|
||||
$this->queryLogger->debug( 'startAtomic: entering level ' .
|
||||
( count( $this->trxAtomicLevels ) - 1 ) . " ($fname)" );
|
||||
|
||||
return $sectionId;
|
||||
}
|
||||
|
|
@ -3696,6 +3698,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
// Check if the current section matches $fname
|
||||
$pos = count( $this->trxAtomicLevels ) - 1;
|
||||
list( $savedFname, $sectionId, $savepointId ) = $this->trxAtomicLevels[$pos];
|
||||
$this->queryLogger->debug( "endAtomic: leaving level $pos ($fname)" );
|
||||
|
||||
if ( $savedFname !== $fname ) {
|
||||
throw new DBUnexpectedError(
|
||||
|
|
@ -3728,6 +3731,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
throw new DBUnexpectedError( $this, "No atomic section is open (got $fname)." );
|
||||
}
|
||||
|
||||
$excisedFnames = [];
|
||||
if ( $sectionId !== null ) {
|
||||
// Find the (last) section with the given $sectionId
|
||||
$pos = -1;
|
||||
|
|
@ -3743,6 +3747,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
$excisedIds = [];
|
||||
$len = count( $this->trxAtomicLevels );
|
||||
for ( $i = $pos + 1; $i < $len; ++$i ) {
|
||||
$excisedFnames[] = $this->trxAtomicLevels[$i][0];
|
||||
$excisedIds[] = $this->trxAtomicLevels[$i][1];
|
||||
}
|
||||
$this->trxAtomicLevels = array_slice( $this->trxAtomicLevels, 0, $pos + 1 );
|
||||
|
|
@ -3753,6 +3758,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
$pos = count( $this->trxAtomicLevels ) - 1;
|
||||
list( $savedFname, $savedSectionId, $savepointId ) = $this->trxAtomicLevels[$pos];
|
||||
|
||||
if ( $excisedFnames ) {
|
||||
$this->queryLogger->debug( "cancelAtomic: canceling level $pos ($savedFname) " .
|
||||
"and descendants " . implode( ', ', $excisedFnames ) );
|
||||
} else {
|
||||
$this->queryLogger->debug( "cancelAtomic: canceling level $pos ($savedFname)" );
|
||||
}
|
||||
|
||||
if ( $savedFname !== $fname ) {
|
||||
throw new DBUnexpectedError(
|
||||
$this,
|
||||
|
|
|
|||
Loading…
Reference in a new issue