[ 
https://issues.apache.org/jira/browse/DERBY-3116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-3116:
--------------------------------------

    Attachment: d3116-2.diff

Uploading a new patch which resolves a conflict with a recent commit. The new 
patch also contains an assert which exposes the bug in the lack of a test for 
it.

 - Without the fixes, the assert will cause database creation to fail.
 - With the fix in AllocPage.createPage(), unit/T_RawStoreFactory.unit will 
fail when an AllocPage is evicted from the page cache to make room for an 
AllocPage with a different borrowedSpace value.
 - With the fix in CachedPage.setPageArray(), unit/T_RawStoreFactory.unit 
passes.

I'm re-running derbyall and suites.All now. Since there were no more comments 
on the previous patch, I intend to commit the updated patch to trunk and 10.4 
if all the tests pass.

> totalSpace not properly initialized in AllocPage
> ------------------------------------------------
>
>                 Key: DERBY-3116
>                 URL: https://issues.apache.org/jira/browse/DERBY-3116
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3116-1.diff, d3116-2.diff
>
>
> There are some problems with the initialization of totalSpace in AllocPage. 
> It is initialized in StoredPage.initSpace() which is again called from 
> StoredPage.usePageBuffer(), and it is set to the value returned from 
> AllocPage.getMaxFreeSpace(). The problems are:
>   1) The calculation in getMaxFreeSpace() uses borrowedSpace, but when 
> createIdentity() is called on an AllocPage, borrowedSpace has not been 
> initialized when getMaxFreeSpace() is called and the calculated size is wrong.
>   2) When a page object is reused, usePageBuffer() is only called if a new 
> byte array must be allocated (because the new page has a different size than 
> the old page). This means that the totalSize field gets the same value as in 
> the old page if their sizes are equal, which is not necessarily correct.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to