4

是否有可能使进化成为事务性的,因此每次进化都成功或
完全失败?

我试图用 begin/commit 块(我使用 PostgreSQL)包装起起落落,但收到一个奇怪的错误:

Oops, cannot start the server.
org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction.
  at org.postgresql.jdbc2.AbstractJdbc2Connection.setReadOnly(AbstractJdbc2Connection.java:725)
  at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1324)
  at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:262)
  at com.jolbox.bonecp.ConnectionHandle.recreateConnectionHandle(ConnectionHandle.java:281)
  at com.jolbox.bonecp.ConnectionHandle.close(ConnectionHandle.java:512)
  at play.api.db.evolutions.Evolutions$.applyScript(Evolutions.scala:274)
  at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:472)
  at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:502)
  at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:461)
  at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:459)
  at scala.collection.immutable.List.foreach(List.scala:318)
  at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:459)
  at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
  at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
  at scala.collection.immutable.List.foreach(List.scala:318)
  at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:88)
  at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
  at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
  at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
  at play.api.Play$.start(Play.scala:87)
  at play.core.StaticApplication.<init>(ApplicationProvider.scala:52)
  at play.core.server.NettyServer$.createServer(NettyServer.scala:243)
  at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:279)
  at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:274)
  at scala.Option.map(Option.scala:145)
  at play.core.server.NettyServer$.main(NettyServer.scala:274)
  at play.core.server.NettyServer.main(NettyServer.scala)

请注意,我在 Mode.Prod 中使用 evolutions.use.locks=true 运行进化,否则数据库连接将处于自动提交模式,这与使进化具有事务性相反。

4

0 回答 0