title: Inserted rows vanish
body: <p>We're having a problem on a wiki site (using mysql 5.5.9). There is a <code>text</code> table, and a <code>revision</code> table where <code>revision.rev_text_id</code> is a foreign key to <code>text.old_id</code> (there isn't a new one, ask wikimedia).</p>
  
  <p>There is an <code>INSERT INTO text...</code>, then <code>INSERT INTO revision...</code> which uses the new <code>old_id</code>/<code>rev_text_id</code> received from the previous query.</p>
  
  <p>The second query works, the first - I'm not sure. The thing is after the whole thing is gone through (with a few dozen more queries) the <code>revision</code> row is there, with a fresh new value in it's <code>rev_text_id</code> column.</p>
  
  <p>However, the <code>text</code> row isn't there. Funny thing - the <code>text</code> table auto increment advances, as the next action skips a value for it's <code>old_id</code>, the missing value matching what we have in <code>revision</code> table.</p>
  
  <p>Is there a chance the first query makes the auto increment index advance though the row isn't actually inserted? What causes this?</p>
  
  <p><strong>ADDTITION</strong></p>
  
  <p>When I copied the <code>INSERT INTO text</code> query from the logs and ran it on the server - it executed fine (row was added to table)</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Full queries are:</p>
  
  <pre><code>INSERT INTO text (old_id,old_text,old_flags) VALUES (NULL,'{text input by user}','utf8');
  INSERT INTO `revision` (rev_id,rev_page,rev_text_id,rev_comment,rev_minor_edit,rev_user,rev_user_text,rev_timestamp,rev_deleted,rev_len,rev_parent_id,rev_sha1) VALUES (NULL,'{pageId}','{textId}','{comment}','{isMinor}','{userId}','{userName}','{TS}','{isDeleted}','{length}','{parentRevision}','{HASH}')"
  </code></pre>
  
  <p>Also, if relevant, <code>text</code> table is running InnoDB and <code>revision</code> is MyISAM.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>More information from logs:</p>
  
  <p>Bad request</p>
  
  <pre><code>BEGIN
  INSERT  INTO `text`
  INSERT  INTO `revision`
  UPDATE  `page` SET page_latest
  INSERT  INTO `recentchanges`
  INSERT  INTO `cu_changes`
  SELECT  wl_user  FROM `watchlist` 
  SELECT  user_id  FROM `user` 
  SELECT  user_id,user_name,user_real_name,user_password,user_newpassword,user_newpass_time,user_email,user_touched,use
  SELECT  ug_group  FROM `user_groups` 
  SELECT  up_property,up_value  FROM `user_properties` 
  SELECT  user_id,user_name,user_real_name,user_password,user_newpassword,user_newpass_time,user_email,user_touched,use
  SELECT  ug_group  FROM `user_groups` 
  SELECT  up_property,up_value  FROM `user_properties` 
  SELECT  lc_value  FROM `l10n_cache` 
  SELECT  lc_value  FROM `l10n_cache`
  ...
  </code></pre>
  
  <p>A few more <code>SELECT</code>s. Pause of activity for 2 sec, then the log has commands from a new user, no more queries from this user (on same thread).</p>
  
  <p>An edit by same user to a different page, which went well:</p>
  
  <pre><code>BEGIN
  INSERT INTO `text`
  INSERT INTO `revision`
  UPDATE `page` SET page_latest
  INSERT INTO `recentchanges`
  INSERT INTO `cu_changes`
  SELECT wl_user  FROM `watchlist` 
  COMMIT
  BEGIN
  UPDATE `watchlist` SET wl_notificationtimestamp
  COMMIT
  BEGIN
  SELECT user_id  FROM `user`
  SELECT user_id,user_name,user_real_name,user_password,user_newpasswo
  SELECT ug_group  FROM `user_groups` 
  SELECT up_property,up_value  FROM `user_properties` 
  SELECT *  FROM `user` 
  SELECT up_property,up_value  FROM `user_properties` 
  INSERT INTO `logging`
  UPDATE `user` SET user_editcount=user_editcount+1
  SELECT 1  FROM `user` 
  UPDATE `user` SET user_touched = '20121227211743'
  COMMIT
  </code></pre>
  
  <p>etc.</p>