Bug #52013 | Unique constraint violation warning deferred | ||
---|---|---|---|
Submitted: | 12 Mar 2010 19:46 | Modified: | 29 Nov 2013 11:53 |
Reporter: | Todd Farmer (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Cluster: Cluster/J | Severity: | S2 (Serious) |
Version: | 7.1+ | OS: | Any |
Assigned to: | Jon Stephens | CPU Architecture: | Any |
[12 Mar 2010 19:46]
Todd Farmer
[13 Mar 2010 6:17]
Jonas Oreland
It's an optimization, to avoid round-trip it will defer contacting ndb until "forced" to. (This is equivalent to using "set sql_allow_batching=1;") For JPA i think that we should 1) create an explicit flush (unless already existing) 2) create a "flush after each operation"-setting (default off) (unless already existing) 3) document behavior
[16 Mar 2010 21:27]
Craig Russell
For immediate feedback use autotransaction. Instead of: tx.begin(); session.persist(fish); tx.commit(); do this: session.persist(fish); You will get an immediate exception. I'll see where this behavior can be documented.
[17 Mar 2010 3:32]
Todd Farmer
So, to be clear, what we are saying then is that the only time Cluster/J and MySQL SQL (JDBC) behavior is the same is when auto-commit is enabled? If Cluster/J is used in a transactional context, it will exhibit different behavior than the corresponding SQL executed against a SQL node? I understood Jonas to say that this may be configurable - I would encourage that to be done, and for the default to be behavior consistent with existing behavior.
[7 Nov 2013 1:45]
Craig Russell
Posted by developer: I suggest that we update http://dev.mysql.com/doc/ndbapi/en/mccj-using-clusterj-operations.html where we discuss basic operations. Specifically, this section is not precisely correct: "If the row with the same id as this Employee instance already exists in the database, the persist() method fails." This would be a good place to introduce the flush method and the fact that database operations in general are deferred until commit unless autocommit is on. We can start with a brief enhanced description: If autocommit is on, and a row with the same id as this Employee instance already exists in the database, the persist() method fails. If autocommit is off and a row with the same id as this Employee instance already exists in the database, the persist() method succeeds but a subsequent commit() fails.
[29 Nov 2013 11:53]
Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products. Fixed in mysqldoc rev 36857. Closed.