title: MySQL Repeatable Read isolation level and Lost Update phenomena
body: <p>In <a href="https://vladmihalcea.com/books/high-performance-java-persistence/" rel="nofollow noreferrer">High Performance Java Persistence</a> book's 6.3.3.3 section it's written that Lost Update phenomena is possible in MySQL Repeatable Read isolation level. This is the screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/psrEy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/psrEy.png" alt="enter image description here"></a></p>
  
  <p>Assuming the following(isolation level is REPEATABLE READ):</p>
  
  <pre><code>              tx1                     |                tx2
  -----------------------------------------------------------------------------------
  START TRANSACTION;                    |
  SELECT * FROM test WHERE id = 1;      |
  ( say, DB_TRX_ID = 7 at this moment)   |
                                        |
                                        |  START TRANSACTION;
                                        |  SELECT * FROM test WHERE id = 1;
                                        |  UPDATE test SET name="x" WHERE id = 1;
                                        |  COMMIT;(say, makes DB_TRX_ID = 10)
                                        |
  UPDATE test SET name="y" WHERE id = 1;|
  COMMIT;
  </code></pre>
  
  <p>Question: </p>
  
  <p>Upon tx1 commit will MVCC detect that the row version(DB_TRX_ID) is not equal to 7 anymore(instead it's 10) and perform a rollback ? Or the commit will be succeeded causing a Lost Update ?</p>