在 CentOS 上使用 Postgres 8.4.3 准备事务
我已在本地 postgres.config 中将 'max_prepared_transactions' 设置为 20,但事务失败并出现以下错误跟踪(但仅在 Linux 上)。由于在 Windows 中相同的代码可以无缝工作,所以我在想这是否不是权限问题。解决办法是什么? 谢谢 彼得
372300 [Atomikos:7] WARN atomikos - XA resource 'XADBMS': rollback for XID '3137332E3230332E3132362E3139302E746D30303030313030303037:3137332E3230332E3132362E3139302E746D31' raised -3: the XA resource detected an internal error org.postgresql.xa.PGXAException: Error rolling back prepared transaction at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:357) at com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:873) at com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:90) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:86) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595) Caused by: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier "1096044365_MTczLjIwMy4xMjYuMTkwLnRtMDAwMDEwMDAwNw==_MTczLjIwMy4xMjYuMTkwLnRtMQ==" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:299) at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:347)
I have set 'max_prepared_transactions' to 20 in the local postgres.config and yet the transaction fails with the following error trace (but only on Linux). Since in Windows the same code works seamlessly I am wandering if this isn't an issue of permission. What would be the solution?
Thanks
Peter
372300 [Atomikos:7] WARN atomikos - XA resource 'XADBMS': rollback for XID '3137332E3230332E3132362E3139302E746D30303030313030303037:3137332E3230332E3132362E3139302E746D31' raised -3: the XA resource detected an internal error org.postgresql.xa.PGXAException: Error rolling back prepared transaction at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:357) at com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:873) at com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:90) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:86) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595) Caused by: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier "1096044365_MTczLjIwMy4xMjYuMTkwLnRtMDAwMDEwMDAwNw==_MTczLjIwMy4xMjYuMTkwLnRtMQ==" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:299) at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:347)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已编辑,以帮助其他搜索相同症状的见解的人
该错误表明您仍超出
max_prepared_transactions
限制。确保您编辑的配置文件是正在使用的配置文件,并且您已告诉 postgresql 重新加载其配置以获取您编辑的
max_prepared_transactions
。您可以使用 SQL 查询数据库以了解该设置的用途:
原始答案如下(基于正确设置
max_prepared_transactions
的假设):Are you到底使用 setAutoCommit() 吗?您可能遇到这个最近发现的错误:
http://archives.postgresql。 org/pgsql-jdbc/2010-03/msg00013.php
这篇文章展示了一些准备 XA 连接的小型可重复测试,您可以查看一下,看看您是否正在做类似的事情:
http://archives.postgresql.org/pgsql-jdbc/2009-01/msg00025。 php
Edited to Help other who search for insight on the same symptoms
The error indicates that you're still surpassing your
max_prepared_transactions
limit.Make sure that the config file you've edited is the one that is being used, and that you've told postgresql to reload its configuration to pick up your edited
max_prepared_transactions
.You can query the database to find out what it is using for that setting with the SQL:
Original Answer Follows (based on the assumption that
max_prepared_transactions
was set correctly):Are you using setAutoCommit() at all? You may be experiencing this recently found bug:
http://archives.postgresql.org/pgsql-jdbc/2010-03/msg00013.php
This other post shows some small repeatable tests of preparing XA connections, which you could take a look at to see if you're doing anything similar:
http://archives.postgresql.org/pgsql-jdbc/2009-01/msg00025.php