rdbms: remove some dead code from Database::begin
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Mar 2018 21:51:47 +0000 (14:51 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Mar 2018 22:49:48 +0000 (22:49 +0000)
The "since" filed is computed after getLag(), so this was useless

Change-Id: I252602e85709b1cfc191d4783bd1c53d5b3e8fe8

includes/libs/rdbms/database/Database.php

index 00d9b0b..523f7cd 100644 (file)
@@ -3392,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).