db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6926) InitPageOperation does not check before reading and writing
Date Sun, 19 Mar 2017 15:37:41 GMT

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

Bryan Pendleton commented on DERBY-6926:
----------------------------------------

Can you contribute a patch showing precisely what code you think should be added to
readExternal() and writeExternal()? That would make it easier to understand what
behaviors would change, why the new behaviors would be an improvement, etc.


> InitPageOperation does not check before reading and writing
> -----------------------------------------------------------
>
>                 Key: DERBY-6926
>                 URL: https://issues.apache.org/jira/browse/DERBY-6926
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 10.12.1.1
>            Reporter: Hao Zhong
>
> The readExternal and writeExternal methods are not checked before reading and writing.
Indeed, other classes do check before that. For example, CompressSpacePageOperation implements
the above two methods, and both are checked. In particular, the code of CompressSpacePageOperation.readExternal
 is:
> public void readExternal(ObjectInput in)
> 		 throws IOException, ClassNotFoundException
> 	{
> 		super.readExternal(in);
> 		if( !(this instanceof CompressSpacePageOperation10_2) )
> 		{
> 			newHighestPage      = in.readInt();
> 			num_pages_truncated = CompressedNumber.readInt(in);
> 		}
> 	}
> The code of InitPageOperation.readExternal  is:
> public void readExternal(ObjectInput in) 
> 		 throws IOException, ClassNotFoundException
> 	{
> 		super.readExternal(in);
> 		nextRecordId = CompressedNumber.readInt(in);
> 		initFlag = CompressedNumber.readInt(in);
> 		pageOffset = CompressedNumber.readLong(in);
> 		pageFormatId = in.readInt();
> 	}.
> It is better to guide the method as CompressSpacePageOperation does.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message