title: Is Optimistic-Locking absolutely safe?
body: <p>when using optimistic-locking strategy, it can solve concurrency problem like below:</p>
  
  <pre>
  | the first transaction started        |
  |                                      |  
  | select a row                         |
  |                                      |  the second transaction started
  | update the row with version checking |
  |                                      |  select the same row 
  | commit txn                           |
  |                                      |  update the row with version checking
  |                                      |  
  |                                      |  rolls back because version is dirty
  </pre>
  
  <p>But what if in the extremely rare cases if the update in the second transaction is after the udpate in the first transaction but before the the transaction commit?</p>
  
  <pre>
  | the first transaction started        |
  |                                      |  the second transaction started
  | select a row                         |
  |                                      |  select the same row 
  | update the row with version checking |
  |                                      |  update the row with version checking
  | commit txn                           |
  |                                      |  rolls back because version is dirty // will it?
  |                                      |  
  |                                      |  
  </pre>
  
  <p>I made an experiment that the update in the second transaction could not read the 'dirty' version because the first transaction had not been committed yet. Will the second transaction fail in this case?</p>