免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2941 | 回复: 0
打印 上一主题 下一主题

Some work is done outside global transaction [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-04 22:15 |只看该作者 |倒序浏览
mysql> create table test(a varchar(100))engine=innodb;
Query OK, 0 rows affected (0.08 sec)
mysql> set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test values('abc');
Query OK, 1 row affected (0.00 sec)
mysql> xa start '1111';
ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction
如果set autocommit=0后面紧接着就xa start,是不会报错的。因为此时本地(非XA)事务还未开始。
手册上说:
          Within the context of a given client connection, XA
          transactions and local (non-XA) transactions are mutually
          exclusive. For example, if XA START has
          been issued to begin an XA transaction, a local transaction
          cannot be started until the XA transaction has been committed
          or rolled back. Conversely, if a local transaction has been
          started with START TRANSACTION, no XA
          statements can be used until the transaction has been
          committed or rolled back.
在一个客户端连接的上下文中,XA事务和本地(非XA)事务是互斥的。例如,如果用XA START开始了一个XA事务,在该事务提交或者回滚前,是不能开始本地事务的(在同一连接中)。相反,如果用START TRANSACTION开始了一个本地事务,在该事务提交或者回滚前,XA相关的语句是不能执行的。
        
          Note that if an XA transaction is in the
          ACTIVE state, you cannot issue any
          statements that cause an implicit commit. That would violate
          the XA contract because you could not roll back the XA
          transaction. You will receive the following error if you try
          to execute such a statement:
注意如果一个XA事务处于ACTIVE状态,你不能执行导致隐含提交的语句。那会破坏XA的规矩,因为你会无法回滚XA事务。如果你尝试执行这样一条语句,你会得到下面的错误:
        
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed
when global transaction is in the ACTIVE state
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)
mysql> xa start '2222';
ERROR 1400 (XAE09): XAER_OUTSIDE: Some work is done outside global transaction
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/25477/showart_210141.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP