Page MenuHomePhabricator

$wgForeignFileRepos class ForeignDBViaLBRepo, result in "Empty server array given to LoadBalancer"
Closed, InvalidPublic

Description

I am trying to share files from a commons media wiki.

Using MW 1.29.

I have set the wgForeignFileRepos like following:

$wgForeignFileRepos[] = array(
    'class' => 'ForeignDBViaLBRepo',
    'name' => 'commonsmoegirl',
    'directory' => '/image/common', 
    'url' => 'https://img.moegirl.org/common',
    'hashLevels' => 2, // This must be the same for the other family member
	'transformVia404' => true, 
	'tablePrefix' => '',
    'hasSharedCache' => true, 
    'descBaseUrl' => 'https://commons.moegirl.org/File:',
    'fetchDescription' => false
);

And $wgLBFactoryConf like this:

$wgLBFactoryConf = [
	'class' => 'LBFactoryMulti',

	'sectionsByDB' => [
		'enmoegirl' => 's1',
		'commonsmoegirl' => 's1',
		'wikidata' => 's1', 
	],

	'sectionLoads' => [
		's1' => [
			'127.0.0.1:3306'  => 10, // All on section s1, which has single master, at localhost.
		],
	],

	'groupLoadsByDB' => [],

	'serverTemplate' => [
		'dbname'        => $wgDBname,
		'user'          => $wgDBuser,
		'password'      => $wgDBpassword,
		'type'          => 'mysql',
		'flags'         => DBO_DEFAULT,
		'max lag'       => 30,
			'variables'   => [
				'innodb_lock_wait_timeout' => 15
		
	]
	],
];

However, the system keep throwing out error like following:

Original exception: [08f23e857b902f4095f3a9f1] /%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB:Anabuki_Tomoko.jpg InvalidArgumentException from line 371 of /includes/libs/rdbms/loadbalancer/LoadBalancer.php: Empty server array given to LoadBalancer
Backtrace:
#0 /includes/libs/rdbms/loadbalancer/LoadBalancer.php(333): Wikimedia\Rdbms\LoadBalancer->pickReaderIndex(array, NULL)
#1 /includes/libs/rdbms/loadbalancer/LoadBalancer.php(638): Wikimedia\Rdbms\LoadBalancer->getReaderIndex(boolean, NULL)
#2 /includes/libs/rdbms/loadbalancer/LoadBalancer.php(738): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, NULL)
#3 /includes/filerepo/ForeignDBViaLBRepo.php(69): Wikimedia\Rdbms\LoadBalancer->getConnectionRef(integer, array, NULL)
#4 /includes/filerepo/file/LocalFile.php(273): ForeignDBViaLBRepo->getReplicaDB()
#5 /includes/libs/objectcache/WANObjectCache.php(889): LocalFile->{closure}(boolean, integer, array, NULL)
#6 /includes/libs/objectcache/WANObjectCache.php(1009): WANObjectCache->{closure}(boolean, integer, array, NULL)
#7 /includes/libs/objectcache/WANObjectCache.php(894): WANObjectCache->doGetWithSetCallback(string, integer, Closure, array, NULL)
#8 /includes/filerepo/file/LocalFile.php(303): WANObjectCache->getWithSetCallback(string, integer, Closure, array)
#9 /includes/filerepo/file/LocalFile.php(558): LocalFile->loadFromCache()
#10 /includes/filerepo/FileRepo.php(435): LocalFile->load(integer)
#11 /includes/filerepo/RepoGroup.php(159): FileRepo->findFile(Title, array)
#12 /includes/GlobalFunctions.php(3103): RepoGroup->findFile(Title, array)
#13 /includes/page/WikiFilePage.php(63): wfFindFile(Title)
#14 /includes/page/WikiFilePage.php(129): WikiFilePage->loadFile()
#15 /includes/MediaWiki.php(409): WikiFilePage->getFile()
#16 /includes/MediaWiki.php(291): MediaWiki->initializeArticle()
#17 /includes/MediaWiki.php(862): MediaWiki->performRequest()
#18 /includes/MediaWiki.php(523): MediaWiki->main()
#19 /index.php(43): MediaWiki->run()
#20 {main}

Event Timeline

Zoglun created this task.Dec 24 2017, 5:42 AM
Restricted Application added projects: Commons, Multimedia. · View Herald TranscriptDec 24 2017, 5:42 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Zoglun closed this task as Invalid.Dec 24 2017, 6:22 AM

Solved by add 'wiki' => 'wiki-db-name-used-with-wgLBFactoryConf', to $wgForeignFileRepos[] = array(