错误“数据库约束已更改(txId=xxxxx) 在此事务(txId=yyyyy) 开始后,当前不支持”的解释
以下错误,通过 bin/neo4j-shell
Database constraints have changed (txId=84) after this transaction (txId=81) started, which is not yet supported. Please retry your transaction to ensure all constraints are executed.
或记录在 log/debug.log
(3.x) 或 graph.db/messages.log
(2.3.x) 中
2016-10-18 16:40:43.595+0000 ERROR [o.n.s.r.t.TransactionFacade]: Failed to commit transaction. java.lang.RuntimeException: org.neo4j.kernel.api.exceptions.TransactionFailureException: Database constraints have changed (txId=81) after this transaction (txId=84) started, which is not yet supported. Please retry your transaction to ensure all constraints are executed. at org.neo4j.server.rest.transactional.TransitionalTxManagementKernelTransaction.commit(TransitionalTxManagementKernelTransaction.java:87) ~[neo4j-server-2.2.8.jar:2.2.8] at org.neo4j.server.rest.transactional.TransactionHandle.closeContextAndCollectErrors(TransactionHandle.java:278) [neo4j-server-2.2.8.jar:2.2.8]
可以通过以下场景解释
txID | 日期/时间 | Cypher 语句 |
---|---|---|
81 |
2012 年 10 月 19 日 09:00 |
开始 |
84 |
2012 年 10 月 19 日 09:01 |
开始 |
84 |
2012 年 10 月 19 日 09:02 |
create constraint on (n:Person) assert n.user_id is unique; |
84 |
2012 年 10 月 19 日 09:03 |
提交 |
81 |
2012 年 10 月 19 日 09:04 |
create (n:Person {user_id:1234}) |
81 |
2012 年 10 月 19 日 09:05 |
提交 |
其中,异常在 2012 年 10 月 19 日 09:05 由具有 txID 81 的 Cypher 语句引发,当它尝试创建应用于新提交约束的节点时,该事务被回滚。正确的补救措施是重新提交失败的事务。
此页面有帮助吗?