Last modified: 2014-11-07 13:07:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44957, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42957 - Ensure transactional integrity of uniqueness constraints
Ensure transactional integrity of uniqueness constraints
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Wikidata bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-11 18:50 UTC by Daniel Kinzler
Modified: 2014-11-07 13:07 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Kinzler 2012-12-11 18:50:34 UTC
Wikibase imposes some hard constraints on entities, by requiring some of their properties to be unique - for instance, only one item can have a link to a given site and title, and only one property can have a given name in a given language.

We must ensure that these constraints are enforced in the same transaction that performs the primary data save. Not only have the constraints to be checked in that transaction, any updates of reference tables for the unique properties also have to be done in that transaction. This is currently not the case, it seems.

Note: prepareSave() is called within that transaction, before the primary data is saved. doEditUpdates is called after the primary save, but outside the transaction. doDeleteUpdates is called after a page is deleted, but within the primary transaction. We may need an afterSave() method that is called after the primary save, but inside the transaction.

Beware lock retention times: doing more things in the primary transaction increases the likelyhood of timeouts/deadlocks.
Comment 1 Lydia Pintscher 2013-11-04 11:30:52 UTC
Is this the same as bug 42325?
Comment 2 Daniel Kinzler 2014-11-07 13:07:41 UTC
MediaWiki doesn't give us enough control to assure full transactional integrity. Generally, MediaWiki chooses performance over db integrity, e.g. by sacrificing transactional scope for reduced lock retention times.

As of now, we check global constraints inside the main transaction (via prepareSave), but update secondary tables only after the main transaction (via doEditUpdates and doDeleteUpdates). This follows the precedence set by MediaWiki core for updating secondary tables like pagelinks. It's more problematic for tables that are used to enforce global constraints, but I think we can live with it for now. 

Closing "wontfix" since I see no way to fully fix this without sacrificing scalability, and we are doing "pretty good" as it is.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links