Issue Details (XML | Word | Printable)

Key: DERBY-2597
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Knut Anders Hatlen
Reporter: Knut Anders Hatlen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby
DERBY-827

Language result sets should not reuse current isolation level across executions

Created: 27/Apr/07 08:11 AM   Updated: 29/Jun/09 02:10 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.1.4
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-2597-1.diff 2007-04-30 12:15 PM Knut Anders Hatlen 22 kB
File Licensed for inclusion in ASF works derby-2597-1.stat 2007-04-30 12:15 PM Knut Anders Hatlen 0.4 kB
File Licensed for inclusion in ASF works derby-2597-2.diff 2007-05-09 06:14 PM Knut Anders Hatlen 2 kB
File Licensed for inclusion in ASF works derby-2597-3.diff 2007-05-10 02:35 PM Knut Anders Hatlen 10 kB
File Licensed for inclusion in ASF works derby-2597-3.stat 2007-05-10 02:35 PM Knut Anders Hatlen 0.6 kB

Bug behavior facts: Performance
Resolution Date: 11/May/07 08:38 AM


 Description  « Hide
Some of the language result sets cache the current isolation level in their constructors. To allow reuse of the result sets, they should check the isolation level each time they are opened. Currently, this affects HashScanResultSet, TableScanResultSet, LastIndexKeyResultSet and UpdateResultSet (and their sub-classes).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Knut Anders Hatlen added a comment - 30/Apr/07 12:15 PM
The attached patch (derby-2597-1) solves the problem for HashScanResultSet, TableScanResultSet and LastIndexKeyResultSet (and their sub-classes) by refreshing the isolation level on each open. Since the code that found the correct isolation level and lock mode was almost identical in all those classes, I created a common base class for them (ScanResultSet) and removed the duplicated code.

With this patch, ResultSetsFromPreparedStatementTest runs cleanly even with the DERBY-827 patch applied.

Derbyall and suites.All ran cleanly on Solaris 10, Java 1.6.

Knut Anders Hatlen added a comment - 07/May/07 11:45 AM
Committed derby-2597-1.diff with revision 535860.

Knut Anders Hatlen added a comment - 09/May/07 06:14 PM
Attaching patch which adds a JUnit fixture which tests whether an UpdateResultSet is able to detect changes in isolation level between executions. The test passes on trunk, but fails when the patch for DERBY-827 is applied (it continues with table-level locking after changing isolation level from serializable to read committed).

Knut Anders Hatlen added a comment - 09/May/07 06:19 PM
Committed derby-2597-2.diff with revision 536613.

Knut Anders Hatlen added a comment - 10/May/07 02:35 PM
Attaching derby-2597-3 which fixes the failure in testUpdateResultSetWithIsolation() when running with the DERBY-827 patch. What the patch does, is:

1) Move the static method UpdateResultSet.decodeLockMode() into DMLWriteResultSet and make it non-static. This makes it possible to add debug code that checks that it is only called when the {Update,Delete,Insert}ResultSet has been opened (to prevent calls at ResultSet construction time).

2) Move UpdateResultSet's call to decodeLockMode() from the constructor to open().

3) Make the NoRowsResultSetImpl class hierarchy maintain an isOpen variable that is set to true on open and to false on close. Previously, an isClosed variable was used, which was false until the first call to close(), after which it would be true forever even after the RS was reopened. This change was necessary to be able to assert that the result set had been opened in decodeLockMode().

With this patch, I think all result set classes are able to detect isolation level changes between executions.

Derbyall and suites.All ran cleanly with the patch (except the tests that currently fail in the Tinderbox). The patch is ready for review. Thanks.

Knut Anders Hatlen added a comment - 11/May/07 08:38 AM
Committed derby-2597-3 with revision 537128.