Skip to content

Conversation

@rickyma
Copy link
Contributor

@rickyma rickyma commented Mar 6, 2024

What changes were proposed in this pull request?

Verify the number of written records to enhance data accuracy.
Make sure all data records are sent by clients.
Make sure bugs like #714 will never be introduced into the code.

Why are the changes needed?

A follow-up PR for #848.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing UTs.

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 54.57%. Comparing base (d8aedf3) to head (1c4f86b).

Files Patch % Lines
...pache/spark/shuffle/writer/WriteBufferManager.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1558      +/-   ##
============================================
+ Coverage     53.65%   54.57%   +0.91%     
- Complexity     2818     2819       +1     
============================================
  Files           436      416      -20     
  Lines         24549    22195    -2354     
  Branches       2080     2080              
============================================
- Hits          13172    12113    -1059     
+ Misses        10554     9330    -1224     
+ Partials        823      752      -71     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented Mar 6, 2024

Test Results

2 312 files  ±0  2 312 suites  ±0   4h 36m 26s ⏱️ +50s
  823 tests ±0    822 ✅ ±0   1 💤 ±0  0 ❌ ±0 
9 697 runs  ±0  9 683 ✅ ±0  14 💤 ±0  0 ❌ ±0 

Results for commit 1c4f86b. ± Comparison against base commit d8aedf3.

♻️ This comment has been updated with latest results.

@rickyma
Copy link
Contributor Author

rickyma commented Mar 6, 2024

PTAL @jerqi @zuston

Copy link
Member

@zuston zuston left a comment

Choose a reason for hiding this comment

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

LGTM overall. Left some minor comments.

And I hope this could be covered by test cases. Like throwing exception when encountering records is not same.

@rickyma rickyma requested a review from zuston March 6, 2024 07:02
@rickyma
Copy link
Contributor Author

rickyma commented Mar 6, 2024

And I hope this could be covered by test cases. Like throwing exception when encountering records is not same.

I think the existing UTs have already covered this. Because this is a base method which will be used in many places.
If anything bad is introduced into the code in the future, I think the UTs won't pass.

@jerqi
Copy link
Contributor

jerqi commented Mar 6, 2024

Maybe record count isn't enough. We should check block count, too.

@rickyma
Copy link
Contributor Author

rickyma commented Mar 6, 2024

Maybe record count isn't enough. We should check block count, too.

BlockIds will be checked in the method checkBlockSendResult. If any block is failed or lost, we will know.

@zuston
Copy link
Member

zuston commented Mar 6, 2024

And I hope this could be covered by test cases. Like throwing exception when encountering records is not same.

I think the existing UTs have already covered this. Because this is a base method which will be used in many places. If anything bad is introduced into the code in the future, I think the UTs won't pass.

No I hope you could mock throwing exception when record is not same.

@rickyma
Copy link
Contributor Author

rickyma commented Mar 6, 2024

And I hope this could be covered by test cases. Like throwing exception when encountering records is not same.

I think the existing UTs have already covered this. Because this is a base method which will be used in many places. If anything bad is introduced into the code in the future, I think the UTs won't pass.

No I hope you could mock throwing exception when record is not same.

I think it's not easy to mock this and might not be very meaningful. The issue in the past was due to a critical bug in the code itself, caused by concurrency problems, which led to data loss even after calling the method WriteBuffer.addRecord. If we revert the code to the previous problematic version and use the content of my current PR, the unit test would definitely fail.

The fact that the unit test with the current check passes actually indicates that the current code is working correctly.

@zuston zuston changed the title [#808][FOLLOWUP] improvement(spark): Verify the number of written records to enhance data accuracy [#808] improvement(spark): Verify the number of written records to enhance data correctness Mar 7, 2024
@zuston zuston merged commit ec4251d into apache:master Mar 7, 2024
@zuston
Copy link
Member

zuston commented Mar 7, 2024

Merged. Thanks @rickyma

@rickyma rickyma deleted the pr-848-followup branch May 5, 2024 08:33
zuston added a commit that referenced this pull request May 30, 2024
…1756)

### What changes were proposed in this pull request?

1. When the spill ratio is `1.0` , the process of calculating target spill size will be ignored to avoid potential race condition that the `usedBytes` and `inSendBytes` are not thread safe. This could guarantee that the all data is flushed to the shuffle server at the end of task.
2. Adding the `bufferManager's` buffer remaining check

### Why are the changes needed?

Due to the #1670 , the partial data held by the bufferManager will not be flushed to shuffle servers in some corner cases, 
this will make task fail fast rather than silently data loss that should thanks the #1558 

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing tests.
zuston added a commit to zuston/incubator-uniffle that referenced this pull request Dec 9, 2024
…umber (apache#1756)

### What changes were proposed in this pull request?

1. When the spill ratio is `1.0` , the process of calculating target spill size will be ignored to avoid potential race condition that the `usedBytes` and `inSendBytes` are not thread safe. This could guarantee that the all data is flushed to the shuffle server at the end of task.
2. Adding the `bufferManager's` buffer remaining check

### Why are the changes needed?

Due to the apache#1670 , the partial data held by the bufferManager will not be flushed to shuffle servers in some corner cases, 
this will make task fail fast rather than silently data loss that should thanks the apache#1558 

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing tests.
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