From: Tim Starling Date: Wed, 10 Oct 2018 04:03:21 +0000 (+1100) Subject: Log startAtomic()/endAtomic() to the query logger X-Git-Tag: 1.34.0-rc.0~3784^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta//%22%22?a=commitdiff_plain;h=ad32a557fc1260206986fb81c5f1005d132943a5;p=lhc%2Fweb%2Fwiklou.git Log startAtomic()/endAtomic() to the query logger Change-Id: Ife7e292ef42946ec1c5e9121b7be6a90301b3903 --- diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 1b3e6cc5da..66fc10e4db 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -3658,6 +3658,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; } @@ -3670,6 +3672,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( @@ -3702,6 +3705,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; @@ -3717,6 +3721,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 ); @@ -3727,6 +3732,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,