objectcache: fix DatabaseSqlite::initSqliteDatabase() call location
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 18 Sep 2019 02:22:51 +0000 (19:22 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 18 Sep 2019 02:23:44 +0000 (19:23 -0700)
This should be called in the non-LB cause (e.g. custom DBs).

Follow-up mishandled merge conflict in 3298a9db9021.

Bug: T233117
Change-Id: I71a5c28db05a3c294e5c244037be2ee0209d61ad

includes/objectcache/SqlBagOStuff.php

index d713396..4a3445e 100644 (file)
@@ -194,6 +194,10 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
                                $conn = Database::factory( $type, $info );
                                $conn->clearFlag( DBO_TRX ); // auto-commit mode
                                $this->conns[$shardIndex] = $conn;
+                               // Automatically create the objectcache table for sqlite as needed
+                               if ( $conn->getType() === 'sqlite' ) {
+                                       $this->initSqliteDatabase( $conn );
+                               }
                        }
                        $conn = $this->conns[$shardIndex];
                } else {
@@ -206,10 +210,6 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
                        $attribs = $lb->getServerAttributes( $lb->getWriterIndex() );
                        $flags = $attribs[Database::ATTR_DB_LEVEL_LOCKING] ? 0 : $lb::CONN_TRX_AUTOCOMMIT;
                        $conn = $lb->getMaintenanceConnectionRef( $index, [], false, $flags );
-                       // Automatically create the objectcache table for sqlite as needed
-                       if ( $conn->getType() === 'sqlite' ) {
-                               $this->initSqliteDatabase( $conn );
-                       }
                }
 
                $this->logger->debug( sprintf( "Connection %s will be used for SqlBagOStuff", $conn ) );