AllocPages have wrong minimumRecordSize
---------------------------------------
Key: DERBY-3112
URL: https://issues.apache.org/jira/browse/DERBY-3112
Project: Derby
Issue Type: Bug
Components: Store
Affects Versions: 10.4.0.0
Reporter: Knut Anders Hatlen
Priority: Minor
AllocPage.createPage() contains this code at its beginning:
super.createPage(newIdentity, args);
// args[0] is the format id
// args[1] is whether to sync the page to disk or not
// args[2] is the pagesize (used by StoredPage)
// args[3] is the spareSize (used by StoredPage)
// args[4] is the number of bytes to reserve for container
header
// args[5] is the minimumRecordSize
// NOTE: the arg list here must match the one in FileContainer
int pageSize = args[2];
int minimumRecordSize = args[5];
borrowedSpace = args[4];
The variable minimumRecordSize is local and unused, so setting it has no
effect. The local variable hides a field with the same name inherited from
StoredPage. That field is initialized to args[4] when super.createPage() is
called. According to the comment in AllocPage, args[4] is the number of bytes
to reserve for the container header (aka borrowedSpace), not the minimum record
size. (args[4] is however the minimum record size if the page is a plain
StoredPage, that's why super.createPage() will use that value.) I therefore
believe that this code intended to update StoredPage.minimumRecordSize, not a
local, unused variable.
I don't know if this can lead to incorrect behaviour, but it doesn't look right.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.