Page MenuHomePhabricator

LCStore is not handling transactions correctly
Open, LowPublic

Description

Broken off from Bug 27383 comment 13

Another problems happens once right at the beginning of every import:

BEGIN

SELECT -- LCStore_DB::get
  • BEGIN -- fails DELETE -- LCStore_DB::startWrite INSERT -- LCStore_DB::set

...

(In reply to comment #11)

Are you getting

Transaction state changed from

in the debug log?

Attaching the bit of the log that covers this section above.


Version: unspecified
Severity: normal

Details

Reference
bz35357

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:18 AM
bzimport set Reference to bz35357.
bzimport added a subscriber: Unknown Object (MLST).

Why does it issue the first get() ?

(In reply to comment #0)

Broken off from Bug 27383 comment 13

Um... that should be Bug 27283 comment 13

(In reply to comment #1)

Why does it issue the first get() ?

Looking at the debug log (http://bug-attachment.wikimedia.org/attachment.cgi?id=10274), this is what is shows:

Query my_wiki (15) (slave): BEGIN
Transaction state changed from IDLE -> TRANS
Query my_wiki (16) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'deps' LIMIT 1
Query my_wiki (17) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'list' LIMIT 1
Query my_wiki (18) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'preload' LIMIT 1
LocalisationCache::isExpired(en): cache missing, need to make one
LocalisationCache::recache: got localisation for en from source

From https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/LocalisationCache.php;h=a50bf0d8a8eed739b78ff401f70d24246b6da024;hb=a358f21ffe39ce7c76a27300aa8002108399d331#l912

910 $this->dbw = wfGetDB( DB_MASTER );
911 try {
912 $this->dbw->begin( METHOD );
913 $this->dbw->delete( 'l10n_cache', array( 'lc_lang' => $code ), METHOD );
914 } catch ( DBQueryError $e ) {
915 if ( $this->dbw->wasReadOnlyError() ) {
916 $this->readOnly = true;
917 $this->dbw->rollback( METHOD );
918 $this->dbw->ignoreErrors( false );
919 return;
920 } else {
921 throw $e;
922 }
923 }

Yes, we try to open a new transaction (this begin will be a no-op on PostgreSQL
if and there is nothing committed at the end. I don't really understand why it is necessary to have manual transaction control here. MySQL deadlocks?