Skip to content

Conversation

@mateiz
Copy link
Contributor

@mateiz mateiz commented Aug 1, 2014

All these changes are from @mridulm's work in #1609, but extracted here to fix this specific issue and make it easier to merge not 1.1. This particular set of changes is to make sure that we read exactly the right range of bytes from each spill file in EAOM: some serializers can write bytes after the last object (e.g. the TC_RESET flag in Java serialization) and that would confuse the previous code into reading it as part of the next batch. There are also improvements to cleanup to make sure files are closed.

In addition to bringing in the changes to ExternalAppendOnlyMap, I also copied them to the corresponding code in ExternalSorter and updated its test suite to test for the same issues.

mateiz added 3 commits August 1, 2014 15:02
All these changes are from @mridulm's work in apache#1609, but extracted here
to fix this specific issue. This particular set of changes is to make
sure that we read exactly the right range of bytes from each spill file
in EAOM: some serializers can write bytes after the last object (e.g.
the TC_RESET flag in Java serialization) and that would confuse the
previous code into reading it as part of the next batch. There are also
improvements to cleanup to make sure files are closed.
Modified ExternalSorterSuite to also set a low object stream reset and
batch size, and verified that it failed before the changes and succeeded
after.
@SparkQA
Copy link

SparkQA commented Aug 1, 2014

QA tests have started for PR 1722. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17708/consoleFull

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One delta w.r.t. your patch, @mridulm: you used to do ser = serializer.newInstance before this, but this should not be necessary; our serializers support reading even multiple streams concurrently (though confusingly not writing them as far as I see; they can share an output buffer there). I removed that because creating a new instance is actually kind of expensive for Kryo.

Copy link
Contributor

Choose a reason for hiding this comment

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

So that is something I was not sure of : particularly with kryo (not java).
We were seeing the input buffer getting stepped on from various threads - this was specifically in context of 2G fixes though, where we had to modify the way the buffer was created anyway. I dont know if the initialization changes something else.

@mateiz
Copy link
Contributor Author

mateiz commented Aug 1, 2014

Jenkins, test this please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I also removed some of the more paranoid asserts about batchSizes

Copy link
Contributor

Choose a reason for hiding this comment

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

Those asserts caught the bugs :-) Bug yeah, some of them might have been expensive.

@SparkQA
Copy link

SparkQA commented Aug 2, 2014

QA tests have started for PR 1722. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17734/consoleFull

@SparkQA
Copy link

SparkQA commented Aug 2, 2014

QA results for PR 1722:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17734/consoleFull

@mateiz
Copy link
Contributor Author

mateiz commented Aug 3, 2014

@aarondav / @mridulm any other comments on this, or is it okay to merge?

@mridulm
Copy link
Contributor

mridulm commented Aug 3, 2014

LGTM, thanks Matei !
On 03-Aug-2014 12:13 pm, "Matei Zaharia" [email protected] wrote:

@aarondav https://github.com/aarondav / @mridulm
https://github.com/mridulm any other comments on this, or is it okay to
merge?


Reply to this email directly or view it on GitHub
#1722 (comment).

@mridulm
Copy link
Contributor

mridulm commented Aug 3, 2014

Oh wait, is the java serialier change also ported ?
Else the tests won't do what we want it to do.
On 03-Aug-2014 8:11 pm, "Mridul Muralidharan" [email protected] wrote:

LGTM, thanks Matei !
On 03-Aug-2014 12:13 pm, "Matei Zaharia" [email protected] wrote:

@aarondav https://github.com/aarondav / @mridulm
https://github.com/mridulm any other comments on this, or is it okay
to merge?


Reply to this email directly or view it on GitHub
#1722 (comment).

@aarondav
Copy link
Contributor

aarondav commented Aug 3, 2014

+0, I have not actually reviewed this, I only did a cursory pass-through. When it LGTM to @mridulm, we can merge.

@mateiz
Copy link
Contributor Author

mateiz commented Aug 3, 2014

Ah good point.. I've now pushed the JavaSerializer change.

@mateiz
Copy link
Contributor Author

mateiz commented Aug 3, 2014

Jenkins, test this please

@SparkQA
Copy link

SparkQA commented Aug 3, 2014

QA tests have started for PR 1722. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17817/consoleFull

@SparkQA
Copy link

SparkQA commented Aug 3, 2014

QA results for PR 1722:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17817/consoleFull

@mridulm
Copy link
Contributor

mridulm commented Aug 3, 2014

LGTM !
Though I would prefer if @aarondav also took a look at it - since this is based on my earlier work, I might be too close to it to see potential issues ...

This makes it precise -- before we'd only reset after (reset + 1) writes
@mateiz
Copy link
Contributor Author

mateiz commented Aug 3, 2014

I just fixed objectStreamReset slightly so that 1 means "reset after every object" (that's what it was intended to be originally)

@mateiz
Copy link
Contributor Author

mateiz commented Aug 4, 2014

Jenkins, test this please

@SparkQA
Copy link

SparkQA commented Aug 4, 2014

QA tests have started for PR 1722. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17835/consoleFull

@SparkQA
Copy link

SparkQA commented Aug 4, 2014

QA results for PR 1722:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17835/consoleFull

@mateiz
Copy link
Contributor Author

mateiz commented Aug 4, 2014

Jenkins, test this please

@SparkQA
Copy link

SparkQA commented Aug 4, 2014

QA tests have started for PR 1722. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17837/consoleFull

@SparkQA
Copy link

SparkQA commented Aug 4, 2014

QA results for PR 1722:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17837/consoleFull

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the right behavior, but is a slight change ... I dont think anyone is expecting the earlier behavior though !

@mridulm
Copy link
Contributor

mridulm commented Aug 4, 2014

LGTM !

@mateiz
Copy link
Contributor Author

mateiz commented Aug 4, 2014

Alright, I've merged this in. Thanks for looking over it!

@asfgit asfgit closed this in 8e7d5ba Aug 4, 2014
asfgit pushed a commit that referenced this pull request Aug 4, 2014
…in ExternalMap / Sorter

All these changes are from mridulm's work in #1609, but extracted here to fix this specific issue and make it easier to merge not 1.1. This particular set of changes is to make sure that we read exactly the right range of bytes from each spill file in EAOM: some serializers can write bytes after the last object (e.g. the TC_RESET flag in Java serialization) and that would confuse the previous code into reading it as part of the next batch. There are also improvements to cleanup to make sure files are closed.

In addition to bringing in the changes to ExternalAppendOnlyMap, I also copied them to the corresponding code in ExternalSorter and updated its test suite to test for the same issues.

Author: Matei Zaharia <[email protected]>

Closes #1722 from mateiz/spark-2792 and squashes the following commits:

5d4bfb5 [Matei Zaharia] Make objectStreamReset counter count the last object written too
18fe865 [Matei Zaharia] Update docs on objectStreamReset
576ee83 [Matei Zaharia] Allow objectStreamReset to be 0
0374217 [Matei Zaharia] Remove super paranoid code to close file handles
bda37bb [Matei Zaharia] Implement Mridul's ExternalAppendOnlyMap fixes in ExternalSorter too
0d6dad7 [Matei Zaharia] Added Mridul's test changes for ExternalAppendOnlyMap
9a78e4b [Matei Zaharia] Add @mridulm's fixes to ExternalAppendOnlyMap for batch sizes
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
…in ExternalMap / Sorter

All these changes are from mridulm's work in apache#1609, but extracted here to fix this specific issue and make it easier to merge not 1.1. This particular set of changes is to make sure that we read exactly the right range of bytes from each spill file in EAOM: some serializers can write bytes after the last object (e.g. the TC_RESET flag in Java serialization) and that would confuse the previous code into reading it as part of the next batch. There are also improvements to cleanup to make sure files are closed.

In addition to bringing in the changes to ExternalAppendOnlyMap, I also copied them to the corresponding code in ExternalSorter and updated its test suite to test for the same issues.

Author: Matei Zaharia <[email protected]>

Closes apache#1722 from mateiz/spark-2792 and squashes the following commits:

5d4bfb5 [Matei Zaharia] Make objectStreamReset counter count the last object written too
18fe865 [Matei Zaharia] Update docs on objectStreamReset
576ee83 [Matei Zaharia] Allow objectStreamReset to be 0
0374217 [Matei Zaharia] Remove super paranoid code to close file handles
bda37bb [Matei Zaharia] Implement Mridul's ExternalAppendOnlyMap fixes in ExternalSorter too
0d6dad7 [Matei Zaharia] Added Mridul's test changes for ExternalAppendOnlyMap
9a78e4b [Matei Zaharia] Add @mridulm's fixes to ExternalAppendOnlyMap for batch sizes
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.

4 participants