Greetings,
So I've recently been hitting occasional deadlocks on the Recent changes table when running multiple simultaneous import jobs into a MW 1.15.1 installation. The import jobs are going through a custom extension that executes Article::doEdit() to import the pages one by one -- and unfortunately, the extension runs once for every page imported.
1) Would adding EDIT_DEFER_UPDATES to the doEdit arguments make any difference? (I presume not, since index.php is getting executed for every page.)
2) If I set EDIT_SUPPRESS_RC for the edits, is there any way I can run the updates as a batch after the import job is finished?
3) Any other ideas for reducing load on the system? (Other than doing a 'real' XML bulk import, that is...)
4) The actual deadlock seems to be because of conflicting gap locks on the RC table. Has anybody seen this before (MySQL 5.1.49), and any ideas for ways around it? It's a fairly beefy DB cluster and the load just isn't that high.
[2010-08-04 13:27:28 +1000] FATAL - RuntimeError: API error: code 'internal_api_error_DBQueryError', info 'Exception Caught: A database error has occurred Query: INSERT INTO `recentchanges` (rc_timestamp,rc_cur_time,rc_namespace,rc_title,rc_type,rc_minor,rc_cur_id,rc_user,rc_user_text,rc_comment,rc_this_oldid,rc_last_oldid,rc_bot,rc_moved_to_ns,rc_moved_to_title,rc_ip,rc_patrolled,rc_new,rc_old_len,rc_new_len,rc_deleted,rc_logid,rc_log_type,rc_log_action,rc_params,rc_id) VALUES ('20100804032731','20100804032731','100','Vancouver_4/Background/History/Cinema_Tv','3','0','0','1','Atlasmw','content was: 'The film industry has a starring role in Vancouvers Hollywood North economy, and the city ranks third in North American film production (behind the obvio ' (and the only contributor was '[[Special:Contributions/Atlasmw|Atlasmw]]')','0','0','0','0','','10.61.53.254','1','0',NULL,NULL,'0','298386','delete','delete','',NULL)
Function: RecentChange::save Error: 1213 Deadlock found when trying to get lock; try restarting transaction (dbmaster.mediawiki.load)
And from MySQL:
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 26771 n bits 448 index `rc_cur_id` of table `mediawiki`.`recentchanges` trx id 0 1432732 lock_mode X locks gap before rec insert intention waiting Record lock, heap no 2 PHYSICAL RECORD: n_fields 2; compact format; info bits 0 0: len 4; hex 000245e7; asc E ;; 1: len 4; hex 8003c873; asc s;;
Cheers, -jani