Page MenuHomePhabricator

WatchedItemStoreIntegrationTest::testUpdateResetAndSetNotificationTimestamp fails under sqlite
Closed, ResolvedPublic

Description

2) WatchedItemStoreIntegrationTest::testUpdateResetAndSetNotificationTimestamp
Failed asserting that ResultWrapper Object &000000004aa6b9340000000032c030bf (
    'result' => Array &0 ()
    'db' => DatabaseSqlite Object &000000004aa6f7fc0000000032c030bf (
        'dbDir' => '/home/km/projects/vagrant/mediawiki/data'
        'dbPath' => '/home/km/projects/vagrant/mediawiki/data/my_wiki.sqlite'
        'trxMode' => null
        'mAffectedRows' => 1
        'mLastResult' => null
        'mConn' => PDO Object &000000004aa6f7fb0000000032c030bf ()
        'lockMgr' => FSLockManager Object &000000004aa6f7f90000000032c030bf (
            'lockTypeMap' => Array &1 (
                1 => 1
                2 => 1
                3 => 3
            )
            'lockDir' => '/home/km/projects/vagrant/mediawiki/data/locks'
            'handles' => Array &1
            'locksHeld' => Array &1
            'domain' => 'my_wiki'
            'lockTTL' => 3600
        )
        'mLastQuery' => 'UPDATE  unittest_watchlist SET wl_notificationtimestamp = '20200202020202' WHERE wl_user = '16' AND ((wl_namespace = '0' AND wl_title = 'WatchedItemStoreIntegrationTestPage'))'
        'mDoneWrites' => 1469746890.4177001
        'mPHPError' => false
        'mServer' => null
        'mUser' => null
        'mPassword' => null
        'mDBname' => 'my_wiki'
        'srvCache' => APCBagOStuff Object &000000004aa6e6e80000000032c030bf (
            'nativeSerialize' => true
            'locks' => Array &2 ()
            'lastError' => 0
            'keyspace' => 'my_wiki'
            'logger' => MediaWiki\Logger\LegacyLogger Object &000000004aa6e6e90000000032c030bf (
                'channel' => 'objectcache'
            )
            'asyncHandler' => 'DeferredUpdates::addCallableUpdate'
            'debugMode' => false
            'duplicateKeyLookups' => Array &2
            'reportDupes' => false
            'dupeTrackScheduled' => false
        )
        'mOpened' => true
        'mTrxIdleCallbacks' => Array &3 ()
        'mTrxPreCommitCallbacks' => Array &3
        'mTrxEndCallbacks' => Array &3
        'mTablePrefix' => 'unittest_'
        'mSchema' => null
        'mFlags' => 16
        'mForeign' => false
        'mLBInfo' => Array &3
        'mDefaultBigSelects' => null
        'mSchemaVars' => false
        'mSessionVars' => Array &3
        'preparedArgs' => null
        'htmlErrors' => null
        'delimiter' => ';'
        'mTrxLevel' => 0
        'mTrxShortId' => 'ea792a465bca'
        'mTrxTimestamp' => 1469746890.3296931
        'mTrxSlaveLag' => 1.1920928955078125E-6
        'mTrxFname' => 'DatabaseBase::onTransactionPreCommitOrIdle'
        'mTrxDoneWrites' => false
        'mTrxAutomatic' => false
        'mTrxAtomicLevels' => Array &3
        'mTrxAutomaticAtomic' => false
        'mTrxWriteCallers' => Array &3
        'mTrxWriteDuration' => 0.0
        'mNamedLocksHeld' => Array &3
        'lazyMasterHandle' => DBConnRef Object &000000004aa6f7f70000000032c030bf (
            'lb' => LoadBalancer Object &000000004aa6f7fe0000000032c030bf (
                'mServers' => Array &4 (
                    0 => Array &5 (
                        'host' => ''
                        'user' => ''
                        'password' => ''
                        'dbname' => 'my_wiki'
                        'type' => 'sqlite'
                        'load' => 1
                        'flags' => 16
                        'master' => true
                    )
                )
                'mConns' => Array &4
                'mLoads' => Array &4
                'mGroupLoads' => null
                'mAllowLagged' => false
                'mWaitTimeout' => 10
                'mParentInfo' => Array &4
                'mLoadMonitorClass' => 'LoadMonitorNull'
                'mLoadMonitor' => null
                'srvCache' => APCBagOStuff Object &000000004aa6e6e80000000032c030bf
                'mErrorConnection' => false
                'mReadIndex' => -1
                'mWaitForPos' => false
                'laggedSlaveMode' => false
                'slavesDownMode' => false
                'mLastError' => 'Unknown error'
                'readOnlyReason' => false
                'connsOpened' => 1
                'trxProfiler' => TransactionProfiler Object &000000004aa6e6e30000000032c030bf (
                    'dbLockThreshold' => 3.0
                    'eventThreshold' => 0.25
                    'dbTrxHoldingLocks' => Array &6 ()
                    'dbTrxMethodTimes' => Array &6
                    'hits' => Array &6
                    'expect' => Array &6
                    'expectBy' => Array &6
                    'logger' => MediaWiki\Logger\LegacyLogger Object &000000004aa6bb9a0000000032c030bf (
                        'channel' => 'DBPerformance'
                    )
                )
                'disabled' => false
                'mWriteIndex' => -1
            )
            'conn' => null
            'params' => Array &7 (
                0 => -2
                1 => Array &8 ()
                2 => 'my_wiki'
            )
        )
        'fileHandle' => null
        'allViews' => null
        'trxProfiler' => TransactionProfiler Object &000000004aa6e6e30000000032c030bf
        '_hasDataForTestClass' => 'WatchedItemStoreIntegrationTest'
    )
    'pos' => 0
    'currentRow' => null
) is true.

/home/km/projects/vagrant/mediawiki/tests/phpunit/includes/WatchedItemStoreIntegrationTest.php:178
/home/km/projects/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:389

Event Timeline

So this is triggered from WatchedItemStore::setNotificationTimestampsForUser line 709 which reads:

		$success = $dbw->update(
			'watchlist',
			[ 'wl_notificationtimestamp' => $timestamp ],
			$conds,
			__METHOD__
		);

$success is essentially what is checked by this test.

IDatabase::update is documented as always returning a bool, but apparently this is not the case!

And looking at all update methods a ResultWrapper Object should never be returned? unless I am missing something...

Krinkle subscribed.

Tentatively marking as resolved given we have an sqlite Jenkins job now on each commit, and it is passing.