Page MenuHomePhabricator

BlueSpiceFoundation REL1_27 cause DatabaseUpdater::setAppliedUpdates Error: 1062 Duplicate entry 'updatelist-1.27.4-15295832440'
Closed, DuplicatePublic

Description

On REL1_27, when using install.php --with-extensions and BlueSpiceFoundation, the installer eventually fails:

...site_stats is populated...done.
A database query error has occurred.
Query: INSERT  INTO `updatelog` (ul_key,ul_value) VALUES ( ..... )
Function: DatabaseUpdater::setAppliedUpdates
Error: 1062 Duplicate entry 'updatelist-1.27.4-15295832440' for key 'PRIMARY' (localhost:/tmp/quibble-mysql-cdias6r8/socket)

Backtrace:
#0 includes/db/Database.php(901): DatabaseBase->reportQueryError('Duplicate entry...', 1062, 'INSERT  INTO `u...', 'DatabaseUpdater...', false)
#1 includes/db/Database.php(1467): DatabaseBase->query('INSERT  INTO `u...', 'DatabaseUpdater...')
#2 includes/installer/DatabaseUpdater.php(481): DatabaseBase->insert('`updatelog`', Array, 'DatabaseUpdater...')
#3 includes/installer/DatabaseUpdater.php(427): DatabaseUpdater->setAppliedUpdates('1.27.4', Array)
#4 maintenance/update.php(199): DatabaseUpdater->doUpdates(Array)
#5 maintenance/doMaintenance.php(103): UpdateMediaWiki->execute()
#6 maintenance/update.php(244): require_once('/workspace/src/...')
#7 {main}

Dummy change: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/BlueSpiceFoundation/+/441382 and comment check experimental.

That might be a race condition in the updater. See also T47194 T73087 and ccd051bc44974ba32749c845bf5d9aa0ca96aa24

Event Timeline

hashar triaged this task as Normal priority.Jun 21 2018, 12:31 PM
hashar created this task.
Restricted Application removed a project: Patch-For-Review. · View Herald TranscriptJun 21 2018, 12:31 PM
hashar updated the task description. (Show Details)Jun 21 2018, 12:33 PM
hashar updated the task description. (Show Details)Jun 21 2018, 12:38 PM
hashar added a subscriber: Physikerwelt.EditedJun 21 2018, 12:53 PM

The duplicate key for the update log is supposedly fixed by ccd051bc44974ba32749c845bf5d9aa0ca96aa24 which does roughly:

abstract class DatabaseUpdater {
    protected static $updateCounter = 0;

    protected function setAppliedUpdates( $version, $updates = [] ) {
        $key = "updatelist-$version-" . time() . self::$updateCounter;
        self::$updateCounter++;
        $this->db->insert( 'updatelog',
            [ 'ul_key' => $key, 'ul_value' => serialize( $updates ) ],
            __METHOD__ );
    }
}

The trace shows a key of updatelist-1.27.4-15295832440 with 15295832440 == 2018-06-21T12:48:45+00:00.

Maybe self::$updateCounter is not properly initialized due to some behavior different in php7.

A second run worked just fine on the dummy change https://gerrit.wikimedia.org/r/c/mediawiki/extensions/BlueSpiceFoundation/+/441382

Vvjjkkii renamed this task from BlueSpiceFoundation REL1_27 cause DatabaseUpdater::setAppliedUpdates Error: 1062 Duplicate entry 'updatelist-1.27.4-15295832440' to 6iaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii removed Osnard as the assignee of this task.
Vvjjkkii raised the priority of this task from Normal to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: Aklapper, gerritbot.
CommunityTechBot renamed this task from 6iaaaaaaaa to BlueSpiceFoundation REL1_27 cause DatabaseUpdater::setAppliedUpdates Error: 1062 Duplicate entry 'updatelist-1.27.4-15295832440'.Jul 2 2018, 11:25 AM
CommunityTechBot assigned this task to Osnard.
CommunityTechBot lowered the priority of this task from High to Normal.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: Aklapper, gerritbot.
Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptOct 17 2018, 5:05 PM

Using T207241 instead, I got a patch attached. The real issue is in mediawiki/core REL1_27 branch as mentioned above.