-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][SPARK-27562][Shuffle]Complete the verification mechanism for shuffle transmitted data #24447
Conversation
@squito Could you help to review this? |
6c7916e
to
b52e1aa
Compare
HI @turboFei thanks for posting this. Have you looked at SPARK-26089 yet? That actually addresses two out of your three concerns:
I'm not saying there is no value here -- that change does not handle the 3rd one "only detect the compressed or wrapped data." I also have always worried about whether it really makes sense to rely on the the codec to detect corruption, so using a digest could also make sense. But, this is a large change, so the case should be made clearly. |
oops, I just noticed you actually used that jira for this change. So clearly if we were going to do this, you should open another jira and explain the case for having a checksum. or also happy to hear if there is some mistake in the change already committed for SPARK-26089: 688b0c0 |
Thanks, I will open another jira and make the case clearly. |
@squito I have created a new jira[SPARK-27562] and describe the schema. |
8e2baff
to
853542e
Compare
@cloud-fan Could you help to review this? I think this pr can guarantee the accuracy of shuffle data transmission efficiently. |
c0bb54a
to
e2a2fea
Compare
We're closing this PR because it hasn't been updated in a while. If you'd like to revive this PR, please reopen it! |
This seems to be a quite useful feature in heavy load production environment. We're also suffering from such shuffle issue, I think this is a valuable improvement. @turboFei will you continue to work on this PR? If so, I'm going to reopen and help to review it. |
This is a nice feature. We need to think about how to integrate it with the batch shuffle fetch though. |
I will try to finish it. Please help reopen it, thanks. |
Not sure why this PR is closed again, I'm gonna reopen it. @turboFei seems there's lots conflicts in code, can you please bring this to the latest? |
Can one of the admins verify this patch? |
I will. |
It seems that we have to recompute the crc32 value when fetching continuous blocks data. |
…e transmitted data
The behavior of bot is strange, have created a new pr, #28525 |
What changes were proposed in this pull request?
We've seen some shuffle data corruption during shuffle read phase.
As described in SPARK-26089, spark only checks small shuffle blocks before PR #23453, which is proposed by ankuriitg.
There are two changes/improvements that are made in PR #23453.
large block is corrupt in the starting, that block will be re-fetched and if that also fails,
FetchFailureException will be thrown.
reading the stream will be converted to FetchFailureException. This is slightly more aggressive
than was originally intended but since the consumer of the stream may have already read some records and processed them, we can't just re-fetch the block, we need to fail the whole task. Additionally, we also thought about maybe adding a new type of TaskEndReason, which would re-try the task couple of times before failing the previous stage, but given the complexity involved in that solution we decided to not proceed in that direction.
However, I think there still exists some problems with the current shuffle transmitted data verification mechanism:
This pr complete the verification mechanism for shuffle transmitted data:
Firstly, crc32 is choosed for the checksum verification of shuffle data.
Crc is also used for checksum verification in hadoop, it is simple and fast.
During shuffle write phase, after completing the partitionedFile, we compute
the crc32 value for each partition and then write these digests with the indexs into shuffle index file.
For the sortShuffleWriter and unsafe shuffle writer, there is only one partitionedFile for a shuffleMapTask, so the compution of digests(compute the digests for each partition depend on the indexs of this partitionedFile) is cheap.
For the bypassShuffleWriter, the reduce partitions is little than byPassMergeThreshold, so the cost of digests compution is acceptable.
During shuffle read phase, the digest value will be passed with the block data.
And we will recompute the digest of the data obtained to compare with the origin digest value.
When recomputing the digest of data obtained, it only need an additional buffer(2048Bytes) for computing crc32 value.
After recomputing, we will reset the obtained data inputStream, if it is markSupported we only need reset it, otherwise it is a fileSegmentManagerBuffer, we need recreate it.
So, I think this verification mechanism proposed for shuffle transmitted data is efficient and complete.
How was this patch tested?
Unit test.