Page MenuHomePhabricator

MediaWiki with sqlite lacks a CACHE_DB
Closed, ResolvedPublic

Description

When installing MediaWiki with sqlite, I found out a spam of debug message such as:

[localisation] LocalisationCache: using store LCStoreCDB
[SQLBagOStuff] SqlBagOStuff: connecting to [unknown]
[SQLBagOStuff] Connection sqlite object #140 (handle id #144) will be used for SqlBagOStuff
[SQLBagOStuff] DBError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: SELECT  keyname,value,exptime  FROM objectcache    WHERE keyname = 'wikidb:MWSession:s634on7c86imstd9fhgpcrm8l5ha8aob'  
Function: SqlBagOStuff::fetchBlobMulti
Error: 1 no such table: objectcache

[SQLBagOStuff] SqlBagOStuff::setAndLogDBError: ignoring query error

Given a LocalSettings that has:

$wgSQLiteDataDir = "/tmp/quibble-sqlite-d9omwi2c";
$wgObjectCaches[CACHE_DB] = [
    'class' => SqlBagOStuff::class,
    'loggroup' => 'SQLBagOStuff',
    'server' => [
        'type' => 'sqlite',
        'dbname' => 'wikicache',
        'tablePrefix' => '',
        'variables' => [ 'synchronous' => 'NORMAL' ],
        'dbDirectory' => $wgSQLiteDataDir,
        'trxMode' => 'IMMEDIATE',
        'flags' => 0
    ]
];
$wgLocalisationCacheConf['storeServer'] = [
    'type' => 'sqlite',
    'dbname' => "{$wgDBname}_l10n_cache",
    'tablePrefix' => '',
    'variables' => [ 'synchronous' => 'NORMAL' ],
    'dbDirectory' => $wgSQLiteDataDir,
    'trxMode' => 'IMMEDIATE',
    'flags' => 0
];

I suspect 3298a9db9021705a3ebd42ec820f8962a6482974 broke it. The installer does create a wikicache.sqlite file but it is empty / the table is not created at all.

If I use the commit before, the wikicache.git is populated.

Looking at SqlBagOStuff it has something like:

        private function getConnection( $shardIndex ) {
                if ( $this->serverInfos ) {
...
                } else {
...
                        // Automatically create the objectcache table for sqlite as needed
                        if ( $conn->getType() === 'sqlite' ) {
                                $this->initSqliteDatabase( $conn );
                        }
                }

So I guess the logic is flawed and the database is never initialized? It sounds to me the installer should do the initialization.

Event Timeline

hashar created this task.Sep 17 2019, 3:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 17 2019, 3:27 PM
aaron added a comment.Wed, Sep 18, 2:21 AM

Seems like some kind of merge conflict.

Change 537572 had a related patch set uploaded (by Aaron Schulz; owner: Aaron Schulz):
[mediawiki/core@master] objectcache: fix DatabaseSqlite::initSqliteDatabase() call location

https://gerrit.wikimedia.org/r/537572

hashar closed this task as Resolved.Wed, Sep 18, 8:16 AM
hashar assigned this task to aaron.

Change 537572 merged by jenkins-bot:
[mediawiki/core@master] objectcache: fix DatabaseSqlite::initSqliteDatabase() call location

https://gerrit.wikimedia.org/r/537572