I did not decide to skip anything. Let me number the bullets from 
http://www.h2database.com/html/advanced.html#two_phase_commit:

1) Autocommit needs to be switched off
2) A transaction is started, for example by inserting a row
3) The transaction is marked 'prepared' by executing the SQL statement 
PREPARE COMMIT transactionName
4) The transaction can now be committed or rolled back
5) If a problem occurs before the transaction was successfully committed or 
rolled back (for example because a network problem occurred), the 
transaction is in the state 'in-doubt'
6) When re-connecting to the database, the in-doubt transactions can be 
listed with SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT
7) Each transaction in this list must now be committed or rolled back by 
executing COMMIT TRANSACTION transactionName or ROLLBACK TRANSACTION 
transactionName
8) The database needs to be closed and re-opened to apply the changes 

You're talking about pt 7. I'm talking about pt 4. Pt 4 does not explicitly 
state that the transaction shall be committed in any special way (i.e. with 
"COMMIT TRANSACTION txnName") and indeed both "COMMIT" and "COMMIT 
TRANSACTION txnName" work - at least in case of H2 - in the same way *at 
this point*.

But it doesn't matter in this bug report and I'm surprised we're talking 
about it - I think that the testcase I attached is self-explanatory. It 
does not contain "COMMIT TRANSACTION txnName" anywhere because it is not a 
demonstration of how to properly conduct crash recovery in case of 
two-phase commit protocol. The testcase serves the purpose of showing that 
there is a bug in MVStore (but not in PageStore) that reveals itself in the 
following scenario:

1) We have opened a DB that *previously* (in the current session or in some 
session in the past) had a *resolved* in-doubt transaction. There are no 
open transactions now and INFORMATION_SCHEMA.IN_DOUBT is empty.
2) A transaction is started and some data is put in the DB. A crash happens 
during the open transaction (forget 2PC here, the crash occurs before 
"PREPARE COMMIT" is executed; going back to the bullets I numbered for you 
the crash happens after pt 2 but before pt 3).
2) The DB gets re-opened and INFORMATION_SCHEMA.IN_DOUBT is inspected. 
There shall be no in-doubt transactions as no commit was prepared in pt 2. 
Surprisingly, the INFORMATION_SCHEMA.IN_DOUBT lists a transaction that was 
resolved before pt 1.

And please stop nagging me about XA :) There are two test for 2PC in H2's 
source and none of them is using XA.

Hope this helps, let me know if something is still unclear.


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to