Issue Details (XML | Word | Printable)

Key: DERBY-3099
Type: Bug Bug
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

Possible bug in interaction with buffer manager causing pages not to be freed on rollback to savepoint

Created: 03/Oct/07 08:55 AM   Updated: 11/Oct/07 09:23 PM
Return to search
Component/s: Services, Store
Affects Version/s: 10.3.1.4, 10.4.1.3
Fix Version/s: 10.3.2.1, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works assert.diff 2007-10-10 09:09 AM Knut Anders Hatlen 2 kB
File Licensed for inclusion in ASF works d3099-1.diff 2007-10-10 09:15 AM Knut Anders Hatlen 2 kB
File Licensed for inclusion in ASF works failfast.diff 2007-10-03 09:49 AM Knut Anders Hatlen 0.7 kB
File Licensed for inclusion in ASF works initSpace.diff 2007-10-09 12:02 PM Knut Anders Hatlen 0.7 kB

Resolution Date: 11/Oct/07 06:35 AM


 Description  « Hide
I noticed this strange behaviour when I was working on DERBY-2911. It seems like the result of test case P042 in unit/T_RawStoreFactory.unit is dependent on the actual contents of the buffer manager (which pages have been evicted, which free entries have been reused and so on). I'm not sure if this is a bug in the test or somewhere in the code, or if this is expected behaviour, but it sounds a bit suspicious.

For instance, commenting out all the test cases preceeding P042 makes P042 fail, even though P042 creates a new container so that it should not be affected by any of the previous test cases. Also, commenting out a space optimization in Clock.findFreeItem() so that freed entries are not reused except when rotateClock() is called on a full cache to find a victim, causes the test case to fail. A third way to make it fail, is to vary the scan direction when looking for a free entry to reuse in the new buffer manager (ConcurrentCache). If the scan is disabled or walks the clock from the beginning to the end, the test fails, but if the clock is scanned backwards, it passes.

The code that fails in the test, is

c = t_util.t_openContainer(t, segment, cid, true);
Page checkNextPage = t_util.t_addPage(c);
if (checkNextPage.getPageNumber() == nextPageNumber)
throw T_Fail.testFailMsg(
"expect some pages to be freed by update rollback");

The expected page number is 2, and the actual page number is 7.

Before this, a large row has been inserted on page 1 and overflows to page 2, 3, 4, 5 and 6. Also, page 7 has been added manually before all the updates were rolled back so that the pages from 2 up to 7 should be unallocated. Page 7 is then added and removed, and the transaction is committed. After reopening the container, the test expects the pages from 2 up to 7 to be free, and that t_addPage() should allocate page number 2.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #581544 Wed Oct 03 09:48:58 UTC 2007 kahatlen DERBY-3099: Fixed cleanup code in T_RawStoreFactory.P042() so that it
doesn't hide the actual error and make the test hang for an hour. Also
removed an unused variable.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_RawStoreFactory.java

Repository Revision Date User Message
ASF #583691 Thu Oct 11 06:31:53 UTC 2007 kahatlen DERBY-3099: Pages not freed on rollback to savepoint

Ensured that slotFieldSize and slotEntrySize are properly initialized
before StoredPage.initSpace() is called.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java

Repository Revision Date User Message
ASF #583956 Thu Oct 11 21:22:12 UTC 2007 kahatlen DERBY-3099: Pages not freed on rollback to savepoint

svn merge -c 583691 ../trunk
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java