X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDatabase.php;h=523f7cd462f8adaeec38ac3b469054f8955ba772;hp=5f7215277bbf76bf7e8b8798876f58c793d21895;hb=b5fe7fbbed00c402c53e45912140ee2090e5c60a;hpb=e7038cda804d5edbd4222981ad2c1e4aa6c981b7 diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 5f7215277b..523f7cd462 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -35,6 +35,7 @@ use BagOStuff; use HashBagOStuff; use LogicException; use InvalidArgumentException; +use UnexpectedValueException; use Exception; use RuntimeException; @@ -282,6 +283,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->flags |= self::DBO_TRX; } } + // Disregard deprecated DBO_IGNORE flag (T189999) + $this->flags &= ~self::DBO_IGNORE; $this->sessionVars = $params['variables']; @@ -693,7 +696,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware public function setFlag( $flag, $remember = self::REMEMBER_NOTHING ) { if ( ( $flag & self::DBO_IGNORE ) ) { - throw new \UnexpectedValueException( "Modifying DBO_IGNORE is not allowed." ); + throw new UnexpectedValueException( "Modifying DBO_IGNORE is not allowed." ); } if ( $remember === self::REMEMBER_PRIOR ) { @@ -704,7 +707,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING ) { if ( ( $flag & self::DBO_IGNORE ) ) { - throw new \UnexpectedValueException( "Modifying DBO_IGNORE is not allowed." ); + throw new UnexpectedValueException( "Modifying DBO_IGNORE is not allowed." ); } if ( $remember === self::REMEMBER_PRIOR ) { @@ -1277,7 +1280,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * @throws DBQueryError */ public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) { - if ( $this->getFlag( self::DBO_IGNORE ) || $tempIgnore ) { + if ( $tempIgnore ) { $this->queryLogger->debug( "SQL ERROR (ignored): $error\n" ); } else { $sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5 * 1024 ); @@ -3389,10 +3392,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->trxWriteAdjQueryCount = 0; $this->trxWriteCallers = []; // First SELECT after BEGIN will establish the snapshot in REPEATABLE-READ. - // Get an estimate of the replica DB lag before then, treating estimate staleness - // as lag itself just to be safe - $status = $this->getApproximateLagStatus(); - $this->trxReplicaLag = $status['lag'] + ( microtime( true ) - $status['since'] ); + // Get an estimate of the replication lag before any such queries. + $this->trxReplicaLag = $this->getApproximateLagStatus()['lag']; // T147697: make explicitTrxActive() return true until begin() finishes. This way, no // caller will think its OK to muck around with the transaction just because startAtomic() // has not yet completed (e.g. setting trxAtomicLevels).