Skip to content

Conversation

@pengbo
Copy link
Contributor

@pengbo pengbo commented Apr 11, 2019

What changes were proposed in this pull request?

Finish the rest work of #24317, #9030
a. Implement Kryo serialization for UnsafeArrayData
b. fix UnsafeMapData Java/Kryo Serialization issue when two machines have different Oops size
c. Move the duplicate code "getBytes()" to Utils.

How was this patch tested?

According Units has been added & tested

@pengbo
Copy link
Contributor Author

pengbo commented Apr 11, 2019

cc @cloud-fan @sandeep-katta @rxin
Please have a look

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

/**
* General utilities available for unsafe data
*/
public class UnsafeDataUtils {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package private? and final and with private constructor for good measure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I prefer to make this class public, as it's "UnsafeDataUtils" which may contain other public utilities. It may turn to be "package private" if it's named UnsafeSerializationUtils.

Your comments will be appreciated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be made public later if it needs to be. Otherwise it becomes something apps can inadvertently depend on in their code. We want to discourage that.

&& baseOffset == Platform.BYTE_ARRAY_OFFSET
&& (((byte[]) baseObject).length == sizeInBytes)) {
return (byte[]) baseObject;
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it matters, but if you're changing this, this 'else' is redundant

Copy link
Contributor Author

@pengbo pengbo Apr 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out, feel really happy to reduct one line of code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really trivial, no need to change it. This is more just about talking about code style preferences

@pengbo
Copy link
Contributor Author

pengbo commented Apr 11, 2019

@srowen updated as discussed, please recheck when available. thanks

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK do we need to add these classes to the list that is automatically registered with Kryo by default too?

@pengbo pengbo closed this Apr 11, 2019
@pengbo
Copy link
Contributor Author

pengbo commented Apr 11, 2019

OK do we need to add these classes to the list that is automatically registered with Kryo by default too?

I am not quite sure what's the main advantage. If that's for performance, I think in this case it makes no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants