|
[
Permlink
| « Hide
]
Deepa Remesh added a comment - 22/Oct/05 03:49 AM
Attaching a repro for this. To run with embedded driver, use "java d638". To run with client driver, start network server on port 1528 and use "java d638 client". Client driver throws an exception. It should not throw this exception and should match the behaviour of embedded driver.
I think this bug needs to be cross linked to
http://issues.apache.org/jira/browse/DERBY-310 Simple patch for this case. Ideally setTransactionIsolation should have been done with some DRDA mechanism piggybacking the next query/update and (e.g. like setQueryTimeout were done), but this would do as long as we're using statement.execute("SET CURRENT ISOLATION...");
After some investigation, I have found that this is actually three separate issues:
1) There is a difference between the embedded driver where setTransacionIsolation does not cause a commit and the nework client where setTransactionIsolation causes a commit (Side effect of using SET CURRENT ISOLATION). 2) setTransactionIsolation in the network client does not do the proper householding activity wrt. this is an implicit commit and that Statement.execute("SET CURRENT ISOLATION...") is used to implement it, and hence you get the exception documented in the description 3) (Small) The SQLState and error message is different when Connection.close() is done on an active transaction Suggest that 1) & 3) is placed into separate issues while this issue is related to 2) which is the short term fix for the reported exception. BTW: I think the attached patch si not sufficient in the general case, where there may be some open transaction when setTranascationIsolation is called, and that transaction is implicitely committed. Simpler, cleaner, more correct.
Hi Bernt, I haven't read your code, just trying to follow the comments, but: are you proposing
to change the client to match the embedded behavior, or are you proposing to change embedded to match the client behavior (or maybe you're proposing some 3rd thing entirely)? Thanks Bernt for looking at this issue.
Patch1 seems better to me and will match more with the embedded implementation. With patch1, we do not commit any other statements which could be executed in the meantime. But with patch2, client driver will commit everything executed before the call to setTransactionIsolation. This, I think is not expected when we have explicitly set the connection's auto-commit to false. I am attaching a modified repro 'd638_repro2.java' which executes some statements after setting auto-commit to false and before the call to setTransactionIsolation. With patch1, both embedded and client driver show uncommitted transactions. With patch2, client driver commits everything. However, it is not clear to me what the correct behaviour should be as the JDBC spec only has recommendations for the implementation of setTransactionIsolation method. But I think it will be good to keep embedded and client behaviour similar. Bryan: I propose that we on the short term (and in 10.2 and possibly 10.1) fix the misleading exception which this report is about, but keep the difference. And that the different behaviour will be fixed e.g. for 10.3
Deepa: The current implementation will commit the active transaction. The exception is misleading, since there is no active transaction after setTransactionIsolation in the client. Try out d638_repro3.java. I agree that trying to make embedded and client behaviour similar is ideal, but neither of my patches will actually fix that. The JDBC spec just says that "If this method is called during a transaction, the result is implementation-defined." I now see the current implementation will commit the transaction in all cases. The exception was indeed misleading and
Uploaded new patch (V3) whith test change that will catch changes in wether setTransactionIsolation commits or not.
Committed revision 474720.
Committed revision 475651
Backport for 10.1 branch
Backported from trunk.
Committed revision 475707 This issue has been resolved for over a year with no further movement. Closing.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||