Merge "Avoid profiler spam for numeric IN() clauses for each possible number of items"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 23 Aug 2013 23:09:47 +0000 (23:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 23 Aug 2013 23:09:47 +0000 (23:09 +0000)
1  2 
includes/db/Database.php

diff --combined includes/db/Database.php
@@@ -923,12 -923,6 +923,12 @@@ abstract class DatabaseBase implements 
                        }
                }
  
 +              # Keep track of whether the transaction has write queries pending
 +              if ( $this->mTrxLevel && !$this->mTrxDoneWrites && $this->isWriteQuery( $sql ) ) {
 +                      $this->mTrxDoneWrites = true;
 +                      Profiler::instance()->transactionWritingIn( $this->mServer, $this->mDBname );
 +              }
 +
                $isMaster = !is_null( $this->getLBInfo( 'master' ) );
                if ( !Profiler::instance()->isStub() ) {
                        # generalizeSQL will probably cut down the query to reasonable
                        wfProfileIn( $queryProf );
                }
  
 -              # Keep track of whether the transaction has write queries pending
 -              if ( $this->mTrxLevel && !$this->mTrxDoneWrites && $this->isWriteQuery( $sql ) ) {
 -                      $this->mTrxDoneWrites = true;
 -                      Profiler::instance()->transactionWritingIn( $this->mServer, $this->mDBname );
 -              }
 -
                if ( $this->debug() ) {
                        static $cnt = 0;
  
                $sql = preg_replace( '/\s+/', ' ', $sql );
  
                # All numbers => N
-               $sql = preg_replace( '/-?[0-9]+/s', 'N', $sql );
+               $sql = preg_replace( '/-?\d+(,-?\d+)+/s', 'N,...,N', $sql );
+               $sql = preg_replace( '/-?\d+/s', 'N', $sql );
  
                return $sql;
        }