Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikidata, wdwb-tech, Technical-Debt.
Restricted Application added a subscriber: Aklapper.
TASK DESCRIPTION
`SqlIdGenerator` and `UpsertSqlIdGenerator` have some code that’s supposed to
retry acquiring an ID if a database query failed:
$success = $database->newUpdateQueryBuilder()
->update( 'wb_id_counters' )
->set( [ 'id_value' => $id ] )
->where( [ 'id_type' => $type ] )
->caller( __METHOD__ )->execute();
// ...or...
$success = $database->insert(
'wb_id_counters',
[
'id_value' => $id,
'id_type' => $type,
],
__METHOD__
);
// Retry once, since a race condition on initial insert can cause one to
fail.
// Race condition is possible due to occurrence of phantom reads is possible
// at non serializable transaction isolation level.
if ( !$success && $retry ) {
$id = $this->generateNewId( $database, $type, false );
$success = true;
}
However, `IDatabase::update()` (or `UpdateQueryBuilder::execute()`),
`IDatabase::insert()` and `IDatabase::upsert()` no longer return a success
boolean: they either return `true` or throw an exception, and that’s been the
case for years now (at least since rdbms: clean up return values of IDatabase
write methods <https://gerrit.wikimedia.org/r/c/mediawiki/core/+/470071>,
though it’s not completely clear to me if that introduced the change or not).
We should either make the retry code work correctly again (by catching DB
errors that previously would’ve returned `false`? but that’s discouraged…), or
just remove it (on the basis that, apparently, nobody has had an issue with it
being broken for years).
TASK DETAIL
https://phabricator.wikimedia.org/T339346
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Lucas_Werkmeister_WMDE, Astuthiodit_1, karapayneWMDE, Invadibot,
maantietaja, ItamarWMDE, Akuckartz, darthmon_wmde, Nandana, Lahi, Gq86,
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Izno,
Wikidata-bugs, aude, Dinoguy1000, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]