📄 xastatetran.out
字号:
ij> disconnect;ij> -- This test tests state transitons with XAxa_datasource 'wombat';ij> xa_connect;ij> xa_getconnection;ij> -- set up some stuff for the testxa_start xa_noflags 0;ij> run resource '/org/apache/derbyTesting/functionTests/tests/store/global_xactTable.view';ij> create view global_xactTable asselect cast(global_xid as char(2)) as gxid, status, case when first_instant is NULL then 'NULL' else 'false' end as readOnly, cast (username as char(10)) as username, type from new org.apache.derby.diag.TransactionTable() t;0 rows inserted/updated/deletedij> create table xastate(a int);0 rows inserted/updated/deletedij> xa_end xa_success 0;ij> xa_commit xa_1phase 0;ij> ----------------------------------------------- INIT STATE (Transaction not started)----------------------------------------------- the following should workxa_start xa_noflags 10;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(1 |IDLE |NULL |APP |UserTransaction ij> xa_end xa_success 10;ij> xa_rollback 10;ij> -- the following should error XAER_NOTAxa_start xa_join 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_start xa_resume 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_end xa_success 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_end xa_fail 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_end xa_suspend 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_prepare 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_commit xa_1phase 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_commit xa_2phase 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_rollback 11;IJ ERROR: XAER_NOTA ij> -- the following should error XAER_NOTAxa_forget 11;IJ ERROR: XAER_NOTA ij> ----------------------------------------------- NOTASSOCIATED (Transaction started but not associated with a resource)---------------------------------------------xa_start xa_noflags 20;ij> xa_end xa_success 20;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |IDLE |NULL |APP |UserTransaction ij> -- the following should error XAER_DUPIDxa_start xa_noflags 20;IJ ERROR: XAER_DUPID ij> -- the following should workxa_start xa_join 20;ij> xa_end xa_success 20;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |IDLE |NULL |APP |UserTransaction ij> -- the following should error (transaction wasn't suspended) XAER_PROTOxa_start xa_resume 20;IJ ERROR: XAER_PROTO ij> -- the following should workxa_start xa_join 20;ij> xa_end xa_suspend 20;ij> xa_start xa_resume 20;ij> xa_end xa_success 20;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |IDLE |NULL |APP |UserTransaction ij> -- the following should work (xa_success after xa_suspend assume xa_start xa_resume)xa_start xa_join 20;ij> xa_end xa_suspend 20;ij> xa_end xa_success 20;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |IDLE |NULL |APP |UserTransaction ij> -- the following should error XAER_PROTOxa_end xa_success 20;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_end xa_fail 20;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_end xa_suspend 20;IJ ERROR: XAER_PROTO ij> -- the following should work xa_prepare 20;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------ij> -- the following should error (since xact was readonly we have already forgotten-- about the transaction) XAER_NOTA--xa_commit xa_1phase 20;IJ ERROR: XAER_NOTA ij> -- the following should workxa_start xa_noflags 21;ij> insert into xastate values(1);1 row inserted/updated/deletedij> xa_end xa_success 21;ij> xa_commit xa_1phase 21;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------ij> -- the following should error(since xact has been committed) XAER_NOTAxa_commit xa_2phase 21;IJ ERROR: XAER_NOTA ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------ij> xa_start xa_noflags 22;ij> insert into xastate values(2);1 row inserted/updated/deletedij> xa_end xa_success 22;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |ACTIVE |false|APP |UserTransaction ij> -- in not associated state, this should fail since we haven't done prepare XAER_PROTOxa_commit xa_2phase 22;IJ ERROR: XAER_PROTO ij> -- the following should workxa_rollback 22;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------ij> -- the following should error XAER_PROTO (transaction wasn't prepared)xa_start xa_noflags 23;ij> insert into xastate values(1);1 row inserted/updated/deletedij> xa_end xa_success 23;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(2 |ACTIVE |false|APP |UserTransaction ij> xa_forget 23;IJ ERROR: XAER_PROTO ij> ---- clean up transactionxa_rollback 23;ij> ----------------------------------------------- ASSOCIATED (Transaction started and associated with this resource)---------------------------------------------xa_start xa_noflags 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> -- the following should error XAER_PROTOxa_start xa_noflags 40;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_start xa_join 40;IJ ERROR: XAER_PROTO ij> -- the following should error (transaction wasn't suspended) XAER_PROTOxa_start xa_resume 40;IJ ERROR: XAER_PROTO ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> -- the following should workxa_end xa_success 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> xa_rollback 40;ij> -- get back in associated statexa_start xa_noflags 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> -- the following should workxa_end xa_fail 40;IJ ERROR: XA_RBROLLBACK ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> xa_rollback 40;ij> -- get back in associated statexa_start xa_noflags 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> -- the following should workxa_end xa_suspend 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> xa_end xa_success 40;ij> xa_rollback 40;ij> -- get back in associated statexa_start xa_noflags 40;ij> select * from global_xactTable where gxid is not null order by gxid;GXID|STATUS |READ&|USERNAME |TYPE -------------------------------------------------------------(4 |IDLE |NULL |APP |UserTransaction ij> -- the following should error XAER_PROTOxa_prepare 40;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_commit xa_1phase 40;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_commit xa_2phase 40;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_rollback 40;IJ ERROR: XAER_PROTO ij> -- the following should error XAER_PROTOxa_forget 40;IJ ERROR: XAER_PROTO ij> --
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -