Merge "Push all DeferredUpdates to POSTSEND queue when running that queue"
[lhc/web/wiklou.git] / includes / objectcache / SqlBagOStuff.php
index 141a375..70795ec 100644 (file)
@@ -23,6 +23,9 @@
 
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\DBError;
+use Wikimedia\Rdbms\DBQueryError;
+use Wikimedia\Rdbms\DBConnectionError;
 use \MediaWiki\MediaWikiServices;
 use \Wikimedia\WaitConditionLoop;
 use \Wikimedia\Rdbms\TransactionProfiler;
@@ -145,7 +148,7 @@ class SqlBagOStuff extends BagOStuff {
        protected function getSeparateMainLB() {
                global $wgDBtype;
 
-               if ( $wgDBtype === 'mysql' && $this->usesMainDB() ) {
+               if ( $this->usesMainDB() && $wgDBtype !== 'sqlite' ) {
                        if ( !$this->separateMainLB ) {
                                // We must keep a separate connection to MySQL in order to avoid deadlocks
                                $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
@@ -153,8 +156,7 @@ class SqlBagOStuff extends BagOStuff {
                        }
                        return $this->separateMainLB;
                } else {
-                       // However, SQLite has an opposite behavior. And PostgreSQL needs to know
-                       // if we are in transaction or not (@TODO: find some PostgreSQL work-around).
+                       // However, SQLite has an opposite behavior due to DB-level locking
                        return null;
                }
        }
@@ -585,7 +587,7 @@ class SqlBagOStuff extends BagOStuff {
                                        while ( true ) {
                                                $conds = $baseConds;
                                                if ( $maxExpTime !== false ) {
-                                                       $conds[] = 'exptime > ' . $db->addQuotes( $maxExpTime );
+                                                       $conds[] = 'exptime >= ' . $db->addQuotes( $maxExpTime );
                                                }
                                                $rows = $db->select(
                                                        $this->getTableNameByShard( $i ),