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 2008/04/02 15:29:24 UTC

[jira] Created: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

AllocPage.createPage() doesn't initialize minimumRecordSize correctly
---------------------------------------------------------------------

                 Key: DERBY-3589
                 URL: https://issues.apache.org/jira/browse/DERBY-3589
             Project: Derby
          Issue Type: Bug
          Components: Store
    Affects Versions: 10.3.1.4, 10.4.1.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


AllocPage.createPage() will initialize minimumRecordSize to the same
value as borrowedSpace. See this code taken from AllocPage.java:

-------------------
	protected void createPage(PageKey newIdentity, int[] args) 
		 throws StandardException
	{

		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];
-------------------

Here it correctly takes args[5] and puts into the local variable
minimumRecordSize. However, that variable hides a field with the same
name, and that field is set to args[4] in the call to
super.createPage() at the first line in the method. The local variable
is never used.

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


[jira] Updated: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Knut Anders Hatlen updated DERBY-3589:
--------------------------------------

    Attachment: d3589-1a.stat
                d3589-1a.diff

Attached is a patch that changes the signature of CachedPage.createPage() so that it takes a PageCreationArgs object instead of an int array. The PageCreationArgs object contains the same information as the array, only that it has named fields and thereby fixes the problem with minimumRecordSize being taken from the wrong array element.

I have started the full regression test suite.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Updated: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Mike Matrigali updated DERBY-3589:
----------------------------------


I am working on backporting this fix to 10.3, let me know if anyone see's a problem with this.  Merge went fine and
am running tests now.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.4.1.3, 10.5.0.0
>
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Updated: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Knut Anders Hatlen updated DERBY-3589:
--------------------------------------

       Derby Info:   (was: [Patch Available])
    Fix Version/s: 10.5.0.0
                   10.4.1.0

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.4.1.0, 10.5.0.0
>
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Updated: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Knut Anders Hatlen updated DERBY-3589:
--------------------------------------

    Derby Info: [Patch Available]

Derbyall and suites.All ran cleanly.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Commented: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

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

I wonder if it would be better if createPage() took a struct class instead of an array. With named fields we avoid the problem that one array element is interpreted differently by AllocPage.createPage() and StoredPage.createPage(). I think this would also solve DERBY-3116.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Commented: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

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

I was too quick there. This change alone wouldn't solve DERBY-3116, since that issue is about a field being initialized too late, not about being initialized to the wrong value.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Updated: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Kathey Marsden updated DERBY-3589:
----------------------------------

    Fix Version/s: 10.3.3.1

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.3
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.3.3.1, 10.4.1.3, 10.5.0.0
>
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Commented: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

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

I committed the patch to trunk with revision 644620.
I don't know the consequences of this bug, if there are any, but I think it's worth porting it to 10.4 anyway as it looks obvious that the existing code doesn't do what it intends to do.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.4.1.0, 10.5.0.0
>
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Assigned: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Knut Anders Hatlen reassigned DERBY-3589:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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


[jira] Resolved: (DERBY-3589) AllocPage.createPage() doesn't initialize minimumRecordSize correctly

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

Knut Anders Hatlen resolved DERBY-3589.
---------------------------------------

    Resolution: Fixed

Committed to 10.4 with revision 644961.

> AllocPage.createPage() doesn't initialize minimumRecordSize correctly
> ---------------------------------------------------------------------
>
>                 Key: DERBY-3589
>                 URL: https://issues.apache.org/jira/browse/DERBY-3589
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.4.1.0, 10.5.0.0
>
>         Attachments: d3589-1a.diff, d3589-1a.stat
>
>
> AllocPage.createPage() will initialize minimumRecordSize to the same
> value as borrowedSpace. See this code taken from AllocPage.java:
> -------------------
> 	protected void createPage(PageKey newIdentity, int[] args) 
> 		 throws StandardException
> 	{
> 		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];
> -------------------
> Here it correctly takes args[5] and puts into the local variable
> minimumRecordSize. However, that variable hides a field with the same
> name, and that field is set to args[4] in the call to
> super.createPage() at the first line in the method. The local variable
> is never used.

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