Page MenuHomePhabricator

Fatal error: Call to protected method Database::makeSelectOptions
Closed, DeclinedPublic

Description

Our integration tests stopped working due to:

Fatal error: Call to protected method Database::makeSelectOptions() ...

Access to this method was public in previous releases [0] and has been used since [1]. I would really appreciated that developers don't break interfaces [2] (and hereby contracts) especially for public methods.

MediaWiki 1.28.0-alpha (2b4a975)
PHP 5.6.8 (apache2handler)
MySQL 5.6.24
ICU 54.1

PS: This is the second time within weeks that changes to the DB layer causes integration tests to fail and I would like to ask for more consideration when changing DB related code.

[0] https://github.com/wikimedia/mediawiki/blob/REL1_27/includes/db/Database.php#L1107

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/c87e501aa908d55481d0538179d712a0695dbb44/src/SQLStore/QueryEngine/QueryEngine.php#L285

[2] https://github.com/wikimedia/mediawiki/blob/ad7f1df5e1f91c344ba9ce5db28e106b09635f9c/includes/libs/rdbms/database/Database.php#L1106

Event Timeline

Hello,

Thanks for the report - however I don't think the tag DBA is appropriate for this report as we are not responsible for that part of the infrastructure.

I would suggest you take a look at this tags:

mediawiki-database (https://phabricator.wikimedia.org/project/view/165/)
mediawiki-api (https://phabricator.wikimedia.org/project/profile/200/)

Or if not completely sure, maybe mediawiki-general-or-unknown (https://phabricator.wikimedia.org/project/view/135/)

Let me know if I can help further
Cheers

Manuel.

Try to use Database::selectSQLText to build SQL

$dbr->selectSQLText(
	[ $qobj->alias => $qobj->joinTable ],
	[
		'id' => $qobj->alias.smw_id,
		't' => $qobj->alias.smw_title,
		'ns' => $qobj->alias.smw_namespace,
		'iw' => $qobj->alias.smw_iw,
		'so' => $qobj->alias.smw_subobject,
		'sortkey' => $qobj->alias.smw_sortkey,
	],
	$qobj->where !== '' ? [ $qobj->where ] : [],
	__METHOD__,
	array_merge( [ 'DISTINCT' ], $sqlOptions )
);

[ Untested, I am not sure what is in $qobj->from ]

Was changed in I855d0e0d6571ea15c03d2a27bf55ad5e14cd15d4 / 1bd86b3490fb8d9b6270dfa031097d78d1e7d185

Try to use Database::selectSQLText to build SQL

While I appreciated the effort, I don't think this is a solution.

[ Untested, I am not sure what is in $qobj->from ]

It contains concatenate (generated) INNER/LEFT JOIN statements hence the use of $db->query( ... ) later on.

The EXPLAIN will be part of an output that looks like http://sandbox.semantic-mediawiki.org/wiki/Issue/1171

The mentioned method was public in previous releases hence I'd expect [0] to apply.

[0] https://www.mediawiki.org/wiki/Deprecation#How_to_deprecate_a_method.2C_function.2C_etc.

Caused by rMW1bd86b3490fb8d9b6270dfa031097d78d1e7d185

Adding @aaron to task since he did the commit and not sure why we changed to protected from public.

C'mon, another breaking change disregarding the deprecation policy? If I where working for WMF I'd be embarrassed by the frequency of those. Also: yay for tons of protected methods, makes it clear how good the design is from miles away.

C'mon, another breaking change disregarding the deprecation policy?

What deprecation policy are you talking about?

If I where working for WMF I'd be embarrassed by the frequency of those. Also: yay for tons of protected methods, makes it clear how good the design is from miles away.

Fun fact: MediaWiki is a community supported project too. You've made plenty of contributions to core, I'm sure you could submit a patch to make a single function public again. And I have no idea what your point about protected methods is supposed to mean. Are you saying the design is good? Or is it sarcasm?

Tons of public methods is a bad design if anything, since it leads to a gigantically wide interface.

Tons of public methods is a bad design if anything, since it leads to a gigantically wide interface.

We are all (more or less) proficient developers and no one would dispute this but (as I pointed out above) removing its signature from one day to another, having an extension to fail, spending hours on investing the issue, is not what I would call the most professional approach.

Leaving a bug release [0] to fail on grounds of incompatibility is even less comprehensible.

My comment from T147683#2784789 applies here as well.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/1751#issuecomment-258651052

Tons of public methods is a bad design if anything, since it leads to a gigantically wide interface.

We are all (more or less) proficient developers and no one would dispute this but (as I pointed out above) removing its signature from one day to another, having an extension to fail, spending hours on investing the issue, is not what I would call the most professional approach.

Leaving a bug release [0] to fail on grounds of incompatibility is even less comprehensible.

My comment from T147683#2784789 applies here as well.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/1751#issuecomment-258651052

Sure, my comment was in response to https://phabricator.wikimedia.org/T147550#2774338

Krinkle closed this task as Declined.EditedJul 23 2019, 4:35 PM
Krinkle subscribed.

This predates the deprecation policy adopted in Jan 2017. It would've followed one release cycle of deprecation if the policy had been enacted earlier, and also removed or made protected by now.

Note that the method is protected, not private. This means we do support limited use outside core through sub classes, which custom RDBMs implementations may make use of.

SMW choses to wrap the class instead, which means it does not get to use these methods currently. Given the use of wrapping, I would expect it to only build on its public methods and not re-implement lower-level functionality.

If there are specific features you wish existed in the RDBMS layer, I recommend creating tasks for that instead. Which we could either accept, or provide a means to extend it in SMW in a way we can recognise and support long-term.