You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2007/10/08 09:58:51 UTC

[jira] Created: (DERBY-3112) AllocPages have wrong minimumRecordSize

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.


[jira] Updated: (DERBY-3112) AllocPages have wrong minimumRecordSize

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-3112:
--------------------------------------

    Attachment: d3112-1.diff

The JUnit tests ran cleanly with this patch, which makes AllocPage.createPage() update the field instead of the local variable. I have started derbyall too and will post the results when it has finished.

> 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
>         Attachments: d3112-1.diff
>
>
> 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.


[jira] Closed: (DERBY-3112) AllocPages have wrong minimumRecordSize

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-3112.
-------------------------------------

    Resolution: Duplicate

I had forgotten that I had logged this issue, so I logged it again and fixed it as DERBY-3589. Closing this issue as a duplicate.

> 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
>         Attachments: d3112-1.diff
>
>
> 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.


[jira] Commented: (DERBY-3112) AllocPages have wrong minimumRecordSize

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533106 ] 

Knut Anders Hatlen commented on DERBY-3112:
-------------------------------------------

Derbyall also ran cleanly with the patch.

> 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
>         Attachments: d3112-1.diff
>
>
> 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.


[jira] Commented: (DERBY-3112) AllocPages have wrong minimumRecordSize

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533136 ] 

Knut Anders Hatlen commented on DERBY-3112:
-------------------------------------------

It's probably better to have a method in StoredPage which parses the args[] array and override the method in AllocPage. With the d3112-1 patch, minimumRecordSize would first be initialized with an incorrect value and later updated with the correct value. It's better to get the right value from the beginning.

> 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
>         Attachments: d3112-1.diff
>
>
> 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.