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

Jørgen Løland commented on DERBY-3116:
--------------------------------------

Hi Knut Anders.

Patch d3116-1 looks correct to me, but it seems a little overkill to always 
reinitiate the byte[] in StoredPage. Could you achieve the same thing by moving 
the initSpace call from StoredPage#usePageBuffer to StoredPage#createPage? 
Alternatively make initSpace protected and call StoredPage#initSpace from 
CachedPage#setPageArray when the page is reused?

Another bug? In StoredPage#initSpace, slotEntrySize is used when setting 
maxFieldSize. However, initSpace is called before slotEntrySize has been 
updated in usePageBuffer. 

Not related to your patch: There is a problem with the Javadoc in AllocPage 
(unclosed paragraph "<p"). Fixing that would show more javadoc in the html 
files.

> 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
>            Priority: Minor
>         Attachments: d3116-1.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