Skip to content
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

[#736] feat(storage): best effort to write same hdfs file when no race condition #744

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

zuston
Copy link
Member

@zuston zuston commented Mar 20, 2023

What changes were proposed in this pull request?

best effort to write same hdfs file when no race condition in PooledHdfsShuffleWriteHandlerTest

Why are the changes needed?

  1. Reduce the file number for one partition to reduce HDFS pressure.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  1. UTs

@zuston zuston requested a review from jerqi March 20, 2023 10:02
// Use add() here because we are sure the capacity will not be exceeded.
// Note: add() throws IllegalStateException when queue is full.
queue.add(writeHandler);
// Use addFirst() here because we are sure the capacity will not be exceeded.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add some comments to explain why we need to use method addFirst?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Add the javadoc for this class.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you didn't address @jerqi's comment. A javadoc for this class is good.
But it still doesn't explain why we are using addFirst here..
And I believe the comment here is not up to date since it was for add() method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Emm. Yes, this comment is not for this. But I still think the javadoc is enough.

@zuston zuston requested a review from jerqi March 21, 2023 02:33
Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @zuston

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2023

Codecov Report

Merging #744 (69d855f) into master (d60d675) will increase coverage by 2.24%.
The diff coverage is 87.50%.

@@             Coverage Diff              @@
##             master     #744      +/-   ##
============================================
+ Coverage     60.63%   62.88%   +2.24%     
- Complexity     1893     1901       +8     
============================================
  Files           238      224      -14     
  Lines         13000    11053    -1947     
  Branches       1090     1091       +1     
============================================
- Hits           7883     6951     -932     
+ Misses         4679     3725     -954     
+ Partials        438      377      -61     
Impacted Files Coverage Δ
...ge/handler/impl/PooledHdfsShuffleWriteHandler.java 43.47% <87.50%> (+43.47%) ⬆️

... and 17 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zuston zuston merged commit 64cf46b into apache:master Mar 21, 2023
@VisibleForTesting
public PooledHdfsShuffleWriteHandler(LinkedBlockingDeque<ShuffleWriteHandler> queue) {
this.queue = queue;
this.maxConcurrency = queue.size();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra space.

Suggested change
this.maxConcurrency = queue.size();
this.maxConcurrency = queue.size();

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, sorry. I missed this thread.

Got it. I will fix this in another PR.

// Use add() here because we are sure the capacity will not be exceeded.
// Note: add() throws IllegalStateException when queue is full.
queue.add(writeHandler);
// Use addFirst() here because we are sure the capacity will not be exceeded.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you didn't address @jerqi's comment. A javadoc for this class is good.
But it still doesn't explain why we are using addFirst here..
And I believe the comment here is not up to date since it was for add() method.

@jerqi
Copy link
Contributor

jerqi commented Mar 28, 2023

cc @zuston You seems that we miss some information from advancedxy.

xianjingfeng pushed a commit to xianjingfeng/incubator-uniffle that referenced this pull request Apr 5, 2023
…no race condition (apache#744)

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

best effort to write same hdfs file when no race condition in `PooledHdfsShuffleWriteHandlerTest`

### Why are the changes needed?

1. Reduce the file number for one partition to reduce HDFS pressure.

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

No.

### How was this patch tested?
1. UTs
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.

None yet

4 participants